agx: Do not move bindless handles
NIR->AGX translation relies on bindless handles being vec2 instructions with a constant first index. Moving the entire vec2 into the preamble would mess this up, so tell nir_opt_preamble to never do this. It's still allowed to move the offset calculation into the preamble, if it thinks that's beneficial. Fixes dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.* Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24635>
This commit is contained in:
committed by
Marge Bot
parent
c252120239
commit
5196558204
@@ -76,6 +76,39 @@ rewrite_cost(nir_ssa_def *def, const void *data)
|
||||
static bool
|
||||
avoid_instr(const nir_instr *instr, const void *data)
|
||||
{
|
||||
const nir_ssa_def *def = nir_instr_ssa_def((nir_instr *)instr);
|
||||
|
||||
/* Do not move bindless handles, since we need those to retain their constant
|
||||
* base index.
|
||||
*/
|
||||
if (def) {
|
||||
nir_foreach_use(use, def) {
|
||||
if (use->parent_instr->type == nir_instr_type_tex) {
|
||||
/* Check if used as a bindless texture handle */
|
||||
nir_tex_instr *tex = nir_instr_as_tex(use->parent_instr);
|
||||
int handle_idx =
|
||||
nir_tex_instr_src_index(tex, nir_tex_src_texture_handle);
|
||||
|
||||
if (handle_idx >= 0 && tex->src[handle_idx].src.ssa == def)
|
||||
return true;
|
||||
} else if (use->parent_instr->type == nir_instr_type_intrinsic) {
|
||||
/* Check if used as a bindless image handle */
|
||||
nir_intrinsic_instr *intr =
|
||||
nir_instr_as_intrinsic(use->parent_instr);
|
||||
|
||||
switch (intr->intrinsic) {
|
||||
case nir_intrinsic_bindless_image_load:
|
||||
case nir_intrinsic_bindless_image_store:
|
||||
if (intr->src[0].ssa == def)
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user