Module: Mesa
Branch: staging/22.2
Commit: 8abdd60d1fbebabdb9a014e7a0bbd1da10afd33c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8abdd60d1fbebabdb9a014e7a0bbd1da10afd33c

Author: Samuel Pitoiset <[email protected]>
Date:   Thu Aug 25 10:29:00 2022 +0200

radv: re-emit viewports if negative one to one or depth clamp mode changed

The following sequence would be broken if we don't re-emit viewports.

vkCmdSetViewport()
VkCmdBindPipeline(negative_one_to_one = false)
vkCmdDraw()
VkCmdBindPipeline(negative_one_to_one = true)
vkCmdDraw()

Found by inspection.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timur Kristóf <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18245>
(cherry picked from commit 64045fcf7ce3fed6bbc08441cb16c3ca5c76c795)

---

 .pick_status.json                | 2 +-
 src/amd/vulkan/radv_cmd_buffer.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 676e642e799..1c765b66e7b 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -10183,7 +10183,7 @@
         "description": "radv: re-emit viewports if negative one to one or 
depth clamp mode changed",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index f0f2cd44326..64a83cecdee 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -1523,6 +1523,11 @@ radv_emit_graphics_pipeline(struct radv_cmd_buffer 
*cmd_buffer)
       MAX2(cmd_buffer->scratch_size_per_wave_needed, 
pipeline->base.scratch_bytes_per_wave);
    cmd_buffer->scratch_waves_wanted = MAX2(cmd_buffer->scratch_waves_wanted, 
pipeline->base.max_waves);
 
+   if (!cmd_buffer->state.emitted_graphics_pipeline ||
+       cmd_buffer->state.emitted_graphics_pipeline->negative_one_to_one != 
pipeline->negative_one_to_one ||
+       cmd_buffer->state.emitted_graphics_pipeline->depth_clamp_mode != 
pipeline->depth_clamp_mode)
+      cmd_buffer->state.dirty |= RADV_CMD_DIRTY_DYNAMIC_VIEWPORT;
+
    if (!cmd_buffer->state.emitted_graphics_pipeline ||
        
radv_rast_prim_is_points_or_lines(cmd_buffer->state.emitted_graphics_pipeline->rast_prim)
 != radv_rast_prim_is_points_or_lines(pipeline->rast_prim) ||
        cmd_buffer->state.emitted_graphics_pipeline->line_width != 
pipeline->line_width)

Reply via email to