From: Caio Marcelo de Oliveira Filho Date: Tue, 4 Jun 2019 20:38:36 +0000 (-0700) Subject: iris: Create binding table slot for num_work_groups only when needed X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f346b277d14c5ff103e2698f82d9914e5cfd0667;p=mesa.git iris: Create binding table slot for num_work_groups only when needed Reviewed-by: Sagar Ghuge Reviewed-by: Kenneth Graunke --- diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 691fb1fb258..4bb2a7b96e3 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -670,7 +670,6 @@ iris_setup_binding_table(struct nir_shader *nir, BITFIELD64_MASK(num_render_targets); } else if (info->stage == MESA_SHADER_COMPUTE) { bt->sizes[IRIS_SURFACE_GROUP_CS_WORK_GROUPS] = 1; - bt->used_mask[IRIS_SURFACE_GROUP_CS_WORK_GROUPS] = 1; } bt->sizes[IRIS_SURFACE_GROUP_TEXTURE] = util_last_bit(info->textures_used); @@ -706,6 +705,10 @@ iris_setup_binding_table(struct nir_shader *nir, nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); switch (intrin->intrinsic) { + case nir_intrinsic_load_num_work_groups: + bt->used_mask[IRIS_SURFACE_GROUP_CS_WORK_GROUPS] = 1; + break; + case nir_intrinsic_image_size: case nir_intrinsic_image_load: case nir_intrinsic_image_store: diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 9cab4625b81..23f8d290368 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -4141,7 +4141,8 @@ iris_populate_binding_table(struct iris_context *ice, return; } - if (stage == MESA_SHADER_COMPUTE) { + if (stage == MESA_SHADER_COMPUTE && + shader->bt.used_mask[IRIS_SURFACE_GROUP_CS_WORK_GROUPS]) { /* surface for gl_NumWorkGroups */ struct iris_state_ref *grid_data = &ice->state.grid_size; struct iris_state_ref *grid_state = &ice->state.grid_surf_state;