summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-07-24 17:44:09 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:07 -0800
commitb7b061c4e21db353efed7f446e58849ec3b3c0f4 (patch)
tree2a01ce9337936fcba377b9a6ecee30cb0f1354d7 /src/gallium/drivers
parent376c7253f814979cf25f101188af1085a509f642 (diff)
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.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/iris/iris_context.h3
-rw-r--r--src/gallium/drivers/iris/iris_screen.c3
-rw-r--r--src/gallium/drivers/iris/iris_state.c11
3 files changed, 14 insertions, 3 deletions
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