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.
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);