Move the viewport clamping back to rendermanager to avoid a struct copy in the common case.

This commit is contained in:
Henrik Rydgård committed 2019-10-15 09:48:42 +02:00
1 parent 361f804275
commit 107a0d805e
2 files changed
+11 -6

No files matched your search

+2 -5
View File
@@ -1011,11 +1011,8 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
final_vp.y = rc.y;
final_vp.width = rc.w;
final_vp.height = rc.h;
// We can't allow values outside this range unless we use VK_EXT_depth_range_unrestricted.
// Sometimes state mapping produces 65536/65535 which is slightly outside.
// TODO: This should be fixed at the source.
final_vp.maxDepth = clamp_value(vp.maxDepth, 0.0f, 1.0f);
final_vp.minDepth = clamp_value(vp.minDepth, 0.0f, 1.0f);
final_vp.maxDepth = vp.maxDepth;
final_vp.minDepth = vp.minDepth;
vkCmdSetViewport(cmd, 0, 1, &final_vp);
}
break;
+9 -1
View File
@@ -122,7 +122,15 @@ public:
_dbg_assert_(G3D, (int)vp.width >= 0);
_dbg_assert_(G3D, (int)vp.height >= 0);
VkRenderData data{ VKRRenderCommand::VIEWPORT };
data.viewport.vp = vp;
data.viewport.vp.x = vp.x;
data.viewport.vp.y = vp.y;
data.viewport.vp.width = vp.width;
data.viewport.vp.height = vp.height;
// We can't allow values outside this range unless we use VK_EXT_depth_range_unrestricted.
// Sometimes state mapping produces 65536/65535 which is slightly outside.
// TODO: This should be fixed at the source.
data.viewport.vp.minDepth = clamp_value(vp.minDepth, 0.0f, 1.0f);
data.viewport.vp.maxDepth = clamp_value(vp.maxDepth, 0.0f, 1.0f);
curRenderStep_->commands.push_back(data);
}