radv: copy the number of viewports/scissors at pipeline bind time
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 20 Sep 2017 12:03:30 +0000 (14:03 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 21 Sep 2017 07:03:20 +0000 (09:03 +0200)
The number of viewports/scissors can only be specified at pipeline
creation time, so make sure to copy them when binding a new one
because the dynamic state is cleared in BeginCommandBuffer().

Fixes: dcf46e995d ("radv: do not update the number of scissors in vkCmdSetScissor()")
Fixes: 60878dd00c ("radv: do not update the number of viewports in vkCmdSetViewport()")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_cmd_buffer.c

index 6132fc0cef25ed4e5a0e65b82cd67aaf3584bbbd..fbbb1b1c68ec6b8d3ef423cd08f31edc812d676a 100644 (file)
@@ -83,14 +83,18 @@ radv_dynamic_state_copy(struct radv_dynamic_state *dest,
                        const struct radv_dynamic_state *src,
                        uint32_t copy_mask)
 {
+       /* Make sure to copy the number of viewports/scissors because they can
+        * only be specified at pipeline creation time.
+        */
+       dest->viewport.count = src->viewport.count;
+       dest->scissor.count = src->scissor.count;
+
        if (copy_mask & (1 << VK_DYNAMIC_STATE_VIEWPORT)) {
-               dest->viewport.count = src->viewport.count;
                typed_memcpy(dest->viewport.viewports, src->viewport.viewports,
                             src->viewport.count);
        }
 
        if (copy_mask & (1 << VK_DYNAMIC_STATE_SCISSOR)) {
-               dest->scissor.count = src->scissor.count;
                typed_memcpy(dest->scissor.scissors, src->scissor.scissors,
                             src->scissor.count);
        }