turnip: add dirty bit for push constants
authorJonathan Marek <jonathan@marek.ca>
Thu, 12 Dec 2019 22:13:55 +0000 (17:13 -0500)
committerJonathan Marek <jonathan@marek.ca>
Fri, 13 Dec 2019 01:33:17 +0000 (20:33 -0500)
Fixes push constants not updating in some cases.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_private.h

index 3af7c13ed095c641ec9a53f54fad0c4421d5f1f4..9d4667054692bc7319eab6e169267a45da23974a 100644 (file)
@@ -2090,8 +2090,9 @@ tu_CmdPushConstants(VkCommandBuffer commandBuffer,
                     uint32_t size,
                     const void *pValues)
 {
-   TU_FROM_HANDLE(tu_cmd_buffer, cmd_buffer, commandBuffer);
-   memcpy((void*) cmd_buffer->push_constants + offset, pValues, size);
+   TU_FROM_HANDLE(tu_cmd_buffer, cmd, commandBuffer);
+   memcpy((void*) cmd->push_constants + offset, pValues, size);
+   cmd->state.dirty |= TU_CMD_DIRTY_PUSH_CONSTANTS;
 }
 
 VkResult
@@ -3146,18 +3147,7 @@ tu6_bind_draw_states(struct tu_cmd_buffer *cmd,
    }
 
    if (cmd->state.dirty &
-         (TU_CMD_DIRTY_PIPELINE | TU_CMD_DIRTY_DESCRIPTOR_SETS)) {
-      bool needs_border = false;
-      struct tu_cs_entry vs_tex, fs_tex;
-
-      result = tu6_emit_textures(cmd, MESA_SHADER_VERTEX, &vs_tex, &needs_border);
-      if (result != VK_SUCCESS)
-         return result;
-
-      result = tu6_emit_textures(cmd, MESA_SHADER_FRAGMENT, &fs_tex, &needs_border);
-      if (result != VK_SUCCESS)
-         return result;
-
+         (TU_CMD_DIRTY_PIPELINE | TU_CMD_DIRTY_DESCRIPTOR_SETS | TU_CMD_DIRTY_PUSH_CONSTANTS)) {
       draw_state_groups[draw_state_group_count++] =
          (struct tu_draw_state_group) {
             .id = TU_DRAW_STATE_VS_CONST,
@@ -3170,6 +3160,21 @@ tu6_bind_draw_states(struct tu_cmd_buffer *cmd,
             .enable_mask = 0x6,
             .ib = tu6_emit_consts(cmd, pipeline, descriptors_state, MESA_SHADER_FRAGMENT)
          };
+   }
+
+   if (cmd->state.dirty &
+         (TU_CMD_DIRTY_PIPELINE | TU_CMD_DIRTY_DESCRIPTOR_SETS)) {
+      bool needs_border = false;
+      struct tu_cs_entry vs_tex, fs_tex;
+
+      result = tu6_emit_textures(cmd, MESA_SHADER_VERTEX, &vs_tex, &needs_border);
+      if (result != VK_SUCCESS)
+         return result;
+
+      result = tu6_emit_textures(cmd, MESA_SHADER_FRAGMENT, &fs_tex, &needs_border);
+      if (result != VK_SUCCESS)
+         return result;
+
       draw_state_groups[draw_state_group_count++] =
          (struct tu_draw_state_group) {
             .id = TU_DRAW_STATE_VS_TEX,
index 1edc4a24d7774df73792f4ce97119e043c48a5ac..2d9051284e1cb99267642f4cd9b7803aee6735d0 100644 (file)
@@ -835,6 +835,7 @@ enum tu_cmd_dirty_bits
    TU_CMD_DIRTY_COMPUTE_PIPELINE = 1 << 1,
    TU_CMD_DIRTY_VERTEX_BUFFERS = 1 << 2,
    TU_CMD_DIRTY_DESCRIPTOR_SETS = 1 << 3,
+   TU_CMD_DIRTY_PUSH_CONSTANTS = 1 << 4,
 
    TU_CMD_DIRTY_DYNAMIC_LINE_WIDTH = 1 << 16,
    TU_CMD_DIRTY_DYNAMIC_STENCIL_COMPARE_MASK = 1 << 17,