From f5b3a2fe32b3cb84a8f3e932e7eebdc2ed900e76 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Fri, 22 Jan 2016 16:26:34 -0800 Subject: [PATCH] anv/gen7: Add support for gl_NumWorkGroups Signed-off-by: Jordan Justen --- src/vulkan/gen7_cmd_buffer.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/vulkan/gen7_cmd_buffer.c b/src/vulkan/gen7_cmd_buffer.c index 613971651b2..e4a35388170 100644 --- a/src/vulkan/gen7_cmd_buffer.c +++ b/src/vulkan/gen7_cmd_buffer.c @@ -725,6 +725,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, GEN7_GPGPU_WALKER, @@ -757,6 +771,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); gen7_batch_lrm(&cmd_buffer->batch, GPGPU_DISPATCHDIMX, bo, bo_offset); -- 2.30.2