v3dv: dirty viewport doesn't affect fragment shaders
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 16 Apr 2021 10:25:29 +0000 (12:25 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 16 Apr 2021 12:29:11 +0000 (12:29 +0000)
The uniform state for the viewport is only used with geometry stages.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10283>

src/broadcom/vulkan/v3dv_cmd_buffer.c

index af4ebed..9ccc1a1 100644 (file)
@@ -3740,14 +3740,23 @@ update_gfx_uniform_state(struct v3dv_cmd_buffer *cmd_buffer,
    struct v3dv_pipeline *pipeline = cmd_buffer->state.gfx.pipeline;
    assert(pipeline);
 
-   const bool dirty_descriptors_only =
-      (cmd_buffer->state.dirty & dirty_uniform_state) ==
-      V3DV_CMD_DIRTY_DESCRIPTOR_SETS;
+   const bool has_new_pipeline = dirty_uniform_state & V3DV_CMD_DIRTY_PIPELINE;
+   const bool has_new_viewport = dirty_uniform_state & V3DV_CMD_DIRTY_VIEWPORT;
+   const bool has_new_push_constants = dirty_uniform_state & V3DV_CMD_DIRTY_PUSH_CONSTANTS;
+   const bool has_new_descriptors = dirty_uniform_state & V3DV_CMD_DIRTY_DESCRIPTOR_SETS;
 
-   const bool needs_fs_update =
-      !dirty_descriptors_only ||
+   const bool has_new_descriptors_fs =
+      has_new_descriptors &&
       (cmd_buffer->state.dirty_descriptor_stages & VK_SHADER_STAGE_FRAGMENT_BIT);
 
+   const bool has_new_descriptors_vs =
+      has_new_descriptors &&
+      (cmd_buffer->state.dirty_descriptor_stages & VK_SHADER_STAGE_VERTEX_BIT);
+
+   const bool needs_fs_update = has_new_pipeline ||
+                                has_new_push_constants ||
+                                has_new_descriptors_fs;
+
    if (needs_fs_update) {
       struct v3dv_shader_variant *fs_variant =
          pipeline->shared_data->variants[BROADCOM_SHADER_FRAGMENT];
@@ -3756,9 +3765,10 @@ update_gfx_uniform_state(struct v3dv_cmd_buffer *cmd_buffer,
          v3dv_write_uniforms(cmd_buffer, pipeline, fs_variant);
    }
 
-   const bool needs_vs_update =
-      !dirty_descriptors_only ||
-      (cmd_buffer->state.dirty_descriptor_stages & VK_SHADER_STAGE_VERTEX_BIT);
+   const bool needs_vs_update = has_new_viewport ||
+                                has_new_pipeline ||
+                                has_new_push_constants ||
+                                has_new_descriptors_vs;
 
    if (needs_vs_update) {
       struct v3dv_shader_variant *vs_variant =