summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_cmd_buffer.c
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2015-12-18 01:42:46 -0800
committerJordan Justen <[email protected]>2015-12-18 01:45:11 -0800
commit5e82a91324d13c9194416347521120a93beef133 (patch)
tree9d2d8012b6dd421f548d06d11d3d172f22a2c203 /src/vulkan/anv_cmd_buffer.c
parentd7f66f9f6fb47ddf30c782961eb2fc1dcc593975 (diff)
anv/gen8: Add support for gl_NumWorkGroups
Co-authored-by: Kristian Høgsberg <[email protected]> Signed-off-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/vulkan/anv_cmd_buffer.c')
-rw-r--r--src/vulkan/anv_cmd_buffer.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c
index 759c4677a74..bfe06591d6d 100644
--- a/src/vulkan/anv_cmd_buffer.c
+++ b/src/vulkan/anv_cmd_buffer.c
@@ -619,17 +619,22 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
struct anv_pipeline_layout *layout;
uint32_t color_count, bias, state_offset;
- if (stage == MESA_SHADER_COMPUTE)
- layout = cmd_buffer->state.compute_pipeline->layout;
- else
+ switch (stage) {
+ case MESA_SHADER_FRAGMENT:
layout = cmd_buffer->state.pipeline->layout;
-
- if (stage == MESA_SHADER_FRAGMENT) {
bias = MAX_RTS;
color_count = subpass->color_count;
- } else {
+ break;
+ case MESA_SHADER_COMPUTE:
+ layout = cmd_buffer->state.compute_pipeline->layout;
+ bias = 1;
+ color_count = 0;
+ break;
+ default:
+ layout = cmd_buffer->state.pipeline->layout;
bias = 0;
color_count = 0;
+ break;
}
/* This is a little awkward: layout can be NULL but we still have to
@@ -657,6 +662,27 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
iview->bo, iview->offset);
}
+ if (stage == MESA_SHADER_COMPUTE &&
+ cmd_buffer->state.compute_pipeline->cs_prog_data.uses_num_work_groups) {
+ struct anv_bo *bo = cmd_buffer->state.num_workgroups_bo;
+ uint32_t bo_offset = cmd_buffer->state.num_workgroups_offset;
+
+ struct anv_state surface_state;
+ surface_state =
+ anv_cmd_buffer_alloc_surface_state(cmd_buffer);
+
+ fill_descriptor_buffer_surface_state(cmd_buffer->device,
+ surface_state.map, stage,
+ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
+ bo_offset, 12);
+
+ if (!cmd_buffer->device->info.has_llc)
+ anv_state_clflush(surface_state);
+
+ bt_map[0] = surface_state.offset + state_offset;
+ add_surface_state_reloc(cmd_buffer, surface_state, bo, bo_offset);
+ }
+
if (layout == NULL)
goto out;