From: Rob Clark Date: Tue, 6 Mar 2018 13:30:41 +0000 (-0500) Subject: freedreno/ir3: add local_group_size X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f783838099eec11d38a13dd021d500d812cf410;p=mesa.git freedreno/ir3: add local_group_size Signed-off-by: Rob Clark --- diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index a3e82ab593b..bca1a822a9f 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -2194,6 +2194,11 @@ emit_intrinsic(struct ir3_context *ctx, nir_intrinsic_instr *intr) dst[i] = create_driver_param(ctx, IR3_DP_NUM_WORK_GROUPS_X + i); } break; + case nir_intrinsic_load_local_group_size: + for (int i = 0; i < intr->num_components; i++) { + dst[i] = create_driver_param(ctx, IR3_DP_LOCAL_GROUP_SIZE_X + i); + } + break; case nir_intrinsic_discard_if: case nir_intrinsic_discard: { struct ir3_instruction *cond, *kill; diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c b/src/gallium/drivers/freedreno/ir3/ir3_shader.c index 555c654374e..8ed7f5673c8 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c @@ -949,7 +949,9 @@ ir3_emit_cs_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *rin [IR3_DP_NUM_WORK_GROUPS_X] = info->grid[0], [IR3_DP_NUM_WORK_GROUPS_Y] = info->grid[1], [IR3_DP_NUM_WORK_GROUPS_Z] = info->grid[2], - /* do we need work-group-size? */ + [IR3_DP_LOCAL_GROUP_SIZE_X] = info->block[0], + [IR3_DP_LOCAL_GROUP_SIZE_Y] = info->block[1], + [IR3_DP_LOCAL_GROUP_SIZE_Z] = info->block[2], }; ctx->emit_const(ring, SHADER_COMPUTE, offset * 4, 0, diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h index 040ea4cd9d8..272368c6980 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h @@ -44,12 +44,15 @@ enum ir3_driver_param { IR3_DP_NUM_WORK_GROUPS_X = 0, IR3_DP_NUM_WORK_GROUPS_Y = 1, IR3_DP_NUM_WORK_GROUPS_Z = 2, + IR3_DP_LOCAL_GROUP_SIZE_X = 4, + IR3_DP_LOCAL_GROUP_SIZE_Y = 5, + IR3_DP_LOCAL_GROUP_SIZE_Z = 6, /* NOTE: gl_NumWorkGroups should be vec4 aligned because * glDispatchComputeIndirect() needs to load these from * the info->indirect buffer. Keep that in mind when/if * adding any addition CS driver params. */ - IR3_DP_CS_COUNT = 4, /* must be aligned to vec4 */ + IR3_DP_CS_COUNT = 8, /* must be aligned to vec4 */ /* vertex shader driver params: */ IR3_DP_VTXID_BASE = 0,