summaryrefslogtreecommitdiffstats
path: root/src/vulkan/gen8_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/gen8_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/gen8_cmd_buffer.c')
-rw-r--r--src/vulkan/gen8_cmd_buffer.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/vulkan/gen8_cmd_buffer.c b/src/vulkan/gen8_cmd_buffer.c
index 5e566d3aaa1..73d475eae0e 100644
--- a/src/vulkan/gen8_cmd_buffer.c
+++ b/src/vulkan/gen8_cmd_buffer.c
@@ -617,6 +617,20 @@ void genX(CmdDispatch)(
struct anv_pipeline *pipeline = cmd_buffer->state.compute_pipeline;
struct brw_cs_prog_data *prog_data = &pipeline->cs_prog_data;
+ if (prog_data->uses_num_work_groups) {
+ struct anv_state state =
+ anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, 12, 4);
+ uint32_t *sizes = state.map;
+ sizes[0] = x;
+ sizes[1] = y;
+ sizes[2] = z;
+ if (!cmd_buffer->device->info.has_llc)
+ anv_state_clflush(state);
+ cmd_buffer->state.num_workgroups_offset = state.offset;
+ cmd_buffer->state.num_workgroups_bo =
+ &cmd_buffer->device->dynamic_state_block_pool.bo;
+ }
+
cmd_buffer_flush_compute_state(cmd_buffer);
anv_batch_emit(&cmd_buffer->batch, GENX(GPGPU_WALKER),
@@ -649,6 +663,11 @@ void genX(CmdDispatchIndirect)(
struct anv_bo *bo = buffer->bo;
uint32_t bo_offset = buffer->offset + offset;
+ if (prog_data->uses_num_work_groups) {
+ cmd_buffer->state.num_workgroups_offset = bo_offset;
+ cmd_buffer->state.num_workgroups_bo = bo;
+ }
+
cmd_buffer_flush_compute_state(cmd_buffer);
emit_lrm(&cmd_buffer->batch, GPGPU_DISPATCHDIMX, bo, bo_offset);