* enabling early_fragment_tests even if the user didn't.
*/
if (!(c->s->info.num_images ||
- c->s->info.num_ssbos ||
- c->s->info.num_abos)) {
+ c->s->info.num_ssbos)) {
c->s->info.fs.early_fragment_tests = true;
}
}
replaced |= (1 << var->data.binding);
}
}
+
+ /* Make sure that shader->info.num_ssbos still reflects the maximum SSBO
+ * index that can be used in the shader.
+ */
+ if (shader->info.num_ssbos > 0) {
+ shader->info.num_ssbos += ssbo_offset;
+ } else {
+ /* We can't use num_abos, because it only represents the number of
+ * active atomic counters, and currently unlike SSBO's they aren't
+ * compacted so num_abos actually isn't a bound on the index passed
+ * to nir_intrinsic_atomic_counter_*. e.g. if we have a single atomic
+ * counter declared like:
+ *
+ * layout(binding=1) atomic_uint counter0;
+ *
+ * then when we lower accesses to it the atomic_counter_* intrinsics
+ * will have 1 as the index but num_abos will still be 1.
+ * */
+ shader->info.num_ssbos = util_last_bit(replaced);
+ }
+ shader->info.num_abos = 0;
}
return progress;
*/
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.
- */
- bt->sizes[IRIS_SURFACE_GROUP_SSBO] = IRIS_MAX_ABOS + info->num_ssbos;
+ bt->sizes[IRIS_SURFACE_GROUP_SSBO] = info->num_ssbos;
for (int i = 0; i < IRIS_SURFACE_GROUP_COUNT; i++)
assert(bt->sizes[i] <= SURFACE_GROUP_MAX_ELEMENTS);