From: Kenneth Graunke Date: Wed, 25 Jul 2018 00:44:09 +0000 (-0700) Subject: iris: fix SSBO indexing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b7b061c4e21db353efed7f446e58849ec3b3c0f4;p=mesa.git iris: fix SSBO indexing st/nir offsets SSBO indexes by MaxABOs. This is not what we want, as it bloats the binding tables. We'll need to adjust it to use info->num_abos as the offset and buffer base instead. For now, just use the inefficient format to get us rolling. We can add a PIPE_CAP later. --- diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 98af24cf223..cda649127c7 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -43,6 +43,9 @@ struct blorp_params; #define IRIS_RESOURCE_FLAG_DYNAMIC_MEMZONE (PIPE_RESOURCE_FLAG_DRV_PRIV << 2) #define IRIS_MAX_TEXTURE_SAMPLERS 32 +/* IRIS_MAX_ABOS and IRIS_MAX_SSBOS must be the same. */ +#define IRIS_MAX_ABOS 16 +#define IRIS_MAX_SSBOS 16 #define IRIS_MAX_VIEWPORTS 16 #define IRIS_DIRTY_COLOR_CALC_STATE (1ull << 0) diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index f98b17bb1fb..105ac0e5f62 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -384,8 +384,9 @@ iris_get_shader_param(struct pipe_screen *pscreen, case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: case PIPE_SHADER_CAP_MAX_SHADER_IMAGES: - case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS: return IRIS_MAX_TEXTURE_SAMPLERS; + case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS: + return IRIS_MAX_ABOS + IRIS_MAX_SSBOS; case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS: case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTER_BUFFERS: return 0; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index bc27de8f7d8..13371908e3e 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -2680,8 +2680,15 @@ iris_populate_binding_table(struct iris_context *ice, bt_map[s++] = use_const_buffer(batch, cbuf); } - for (int i = 0; i < info->num_abos + info->num_ssbos; i++) { - bt_map[s++] = use_ssbo(batch, ice, shs, i); + /* XXX: st is wasting 16 binding table slots for ABOs. Should add a cap + * for changing nir_lower_atomics_to_ssbos setting and buffer_base offset + * in st_atom_storagebuf.c so it'll compact them into one range, with + * SSBOs starting at info->num_abos. Ideally it'd reset num_abos to 0 too + */ + if (info->num_abos + info->num_ssbos > 0) { + for (int i = 0; i < IRIS_MAX_ABOS + info->num_ssbos; i++) { + bt_map[s++] = use_ssbo(batch, ice, shs, i); + } } #if 0