hk: stop reserving uniform for image heap

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36127>
This commit is contained in:
Alyssa Rosenzweig
2025-07-12 20:30:04 -04:00
committed by Marge Bot
parent 97ff0ada8b
commit 1ea1b2d360
3 changed files with 9 additions and 17 deletions
+1 -2
View File
@@ -690,8 +690,7 @@ hk_upload_usc_words(struct hk_cmd_buffer *cmd, struct hk_shader *s,
}
if (s->info.set_count) {
unsigned set_base = s->info.image_heap_uniform + 4;
agx_usc_uniform(&b, set_base, 4 * s->info.set_count, set_ptr);
agx_usc_uniform(&b, s->info.set_uniform, 4 * s->info.set_count, set_ptr);
}
static_assert(offsetof(struct hk_root_descriptor_table, root_desc_addr) == 0,
+7 -14
View File
@@ -945,7 +945,6 @@ hk_init_link_ht(struct hk_shader *shader, gl_shader_stage sw_stage)
struct fixed_uniforms {
unsigned sets;
unsigned image_heap;
unsigned root;
};
@@ -960,18 +959,14 @@ lower_uniforms(nir_builder *b, nir_intrinsic_instr *intr, void *data)
return true;
}
if (intr->intrinsic != nir_intrinsic_load_texture_handle_agx &&
intr->intrinsic != nir_intrinsic_load_root_agx &&
if (intr->intrinsic != nir_intrinsic_load_root_agx &&
intr->intrinsic != nir_intrinsic_load_descriptor_set_agx)
return false;
b->cursor = nir_before_instr(&intr->instr);
nir_def *rep;
if (intr->intrinsic == nir_intrinsic_load_texture_handle_agx) {
rep = nir_bindless_image_agx(b, intr->src[0].ssa,
.desc_set = ctx->image_heap);
} else if (intr->intrinsic == nir_intrinsic_load_descriptor_set_agx) {
if (intr->intrinsic == nir_intrinsic_load_descriptor_set_agx) {
unsigned s = nir_intrinsic_desc_set(intr);
rep = nir_load_preamble(b, 1, 64, .base = ctx->sets + (4 * s));
} else {
@@ -1098,18 +1093,16 @@ hk_compile_nir(struct hk_device *dev, const VkAllocationCallbacks *pAllocator,
}
}
struct fixed_uniforms f = {.root = 0, .image_heap = 4, .sets = 8};
struct fixed_uniforms f = {.root = 0, .sets = 4};
if (sw_stage == MESA_SHADER_FRAGMENT) {
f.image_heap = AGX_ABI_FUNI_COUNT;
f.root = AGX_ABI_FUNI_ROOT;
f.sets = AGX_ABI_FUNI_COUNT + 4;
f.sets = AGX_ABI_FUNI_COUNT;
} else if (sw_stage == MESA_SHADER_VERTEX) {
f.root = AGX_ABI_VUNI_COUNT_VK(nr_vbos);
f.image_heap = f.root + 4;
f.sets = f.root + 8;
f.sets = f.root + 4;
}
shader->info.image_heap_uniform = f.image_heap;
shader->info.set_uniform = f.sets;
shader->info.set_count = set_count;
/* XXX: rename */
@@ -1128,7 +1121,7 @@ hk_compile_nir(struct hk_device *dev, const VkAllocationCallbacks *pAllocator,
struct agx_shader_key backend_key = {
/* Sets at the end */
.reserved_preamble = f.image_heap + (4 * (set_count + 1)),
.reserved_preamble = f.sets + (4 * set_count),
.dev = agx_gather_device_key(&dev->dev),
.no_stop = nir->info.stage == MESA_SHADER_FRAGMENT,
+1 -1
View File
@@ -107,7 +107,7 @@ struct hk_shader_info {
gl_shader_stage stage : 8;
uint8_t clip_distance_array_size;
uint8_t cull_distance_array_size;
uint8_t image_heap_uniform;
uint8_t set_uniform;
uint8_t set_count;
/* XXX: is there a less goofy way to do this? I really don't want dynamic