From ded0733ff842b5e2d8023df0f8e68ce446306081 Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Fri, 17 May 2024 19:50:33 -0500 Subject: [PATCH] tests: Offset the viewport by 0.5 when running d3dbc shaders. --- tests/shader_runner_vulkan.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index af36d564..b5d06cce 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -726,7 +726,7 @@ static VkPipeline create_graphics_pipeline(struct vulkan_shader_runner *runner, VkPipelineVertexInputStateCreateInfo input_desc = {.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO}; VkPipelineColorBlendStateCreateInfo blend_desc = {.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO}; VkPipelineMultisampleStateCreateInfo ms_desc = {.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO}; - static const VkViewport viewport = {.y = RENDER_TARGET_HEIGHT, + VkViewport viewport = {.y = RENDER_TARGET_HEIGHT, .width = RENDER_TARGET_WIDTH, .height = -RENDER_TARGET_HEIGHT, .maxDepth = 1}; VkPipelineViewportStateCreateInfo vp_desc = {.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO}; static const VkRect2D rt_rect = {.extent.width = RENDER_TARGET_WIDTH, .extent.height = RENDER_TARGET_HEIGHT}; @@ -849,6 +849,12 @@ static VkPipeline create_graphics_pipeline(struct vulkan_shader_runner *runner, ia_desc.topology = vulkan_primitive_topology_from_d3d(primitive_topology); + if (runner->r.minimum_shader_model < SHADER_MODEL_4_0) + { + viewport.x += 0.5f; + viewport.y += 0.5f; + } + vp_desc.viewportCount = 1; vp_desc.pViewports = &viewport; vp_desc.scissorCount = 1;