aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-05-29 15:30:51 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-06-03 14:14:45 -0700
commit045aeccf0e10ea23cbec1f3e23ac0e69b8820394 (patch)
tree172b6c58955d741d919be14460059cbd65e922bd
parent56114448096ab5ac25599d157f0b168137ba5bf6 (diff)
iris: Always reserve binding table space for NIR constants
Don't have a separate mechanism for NIR constants to be removed from the table. If unused, we will compact it away. The use_null_surface is needed when INTEL_DISABLE_COMPACT_BINDING_TABLE is set. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/gallium/drivers/iris/iris_program.c8
-rw-r--r--src/gallium/drivers/iris/iris_state.c15
2 files changed, 14 insertions, 9 deletions
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
index f18c914f62d..3f8896ffd7d 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -678,14 +678,14 @@ iris_setup_binding_table(struct nir_shader *nir,
bt->sizes[IRIS_SURFACE_GROUP_IMAGE] = info->num_images;
- /* Allocate a slot in the UBO section for NIR constants if present.
+ /* Allocate an extra slot in the UBO section for NIR constants.
+ * Binding table compaction will remove it if unnecessary.
+ *
* We don't include them in iris_compiled_shader::num_cbufs because
* they are uploaded separately from shs->constbuf[], but from a shader
* point of view, they're another UBO (at the end of the section).
*/
- if (nir->constant_data_size > 0)
- num_cbufs++;
- bt->sizes[IRIS_SURFACE_GROUP_UBO] = num_cbufs;
+ bt->sizes[IRIS_SURFACE_GROUP_UBO] = num_cbufs + 1;
/* The first IRIS_MAX_ABOs indices in the SSBO group are for atomics, real
* SSBOs start after that. Compaction will remove unused ABOs.
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index abfd812c572..9cab4625b81 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -4191,11 +4191,16 @@ iris_populate_binding_table(struct iris_context *ice,
foreach_surface_used(i, IRIS_SURFACE_GROUP_UBO) {
uint32_t addr;
- if ((i == bt->sizes[IRIS_SURFACE_GROUP_UBO] - 1) && ish->const_data) {
- iris_use_pinned_bo(batch, iris_resource_bo(ish->const_data), false);
- iris_use_pinned_bo(batch, iris_resource_bo(ish->const_data_state.res),
- false);
- addr = ish->const_data_state.offset;
+ if (i == bt->sizes[IRIS_SURFACE_GROUP_UBO] - 1) {
+ if (ish->const_data) {
+ iris_use_pinned_bo(batch, iris_resource_bo(ish->const_data), false);
+ iris_use_pinned_bo(batch, iris_resource_bo(ish->const_data_state.res),
+ false);
+ addr = ish->const_data_state.offset;
+ } else {
+ /* This can only happen with INTEL_DISABLE_COMPACT_BINDING_TABLE=1. */
+ addr = use_null_surface(batch, ice);
+ }
} else {
addr = use_ubo_ssbo(batch, ice, &shs->constbuf[i],
&shs->constbuf_surf_state[i], false);