mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
etnaviv: nir: Use nir_shader_tex_pass(..)
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34706>
This commit is contained in:
parent
3eb7575679
commit
1d11872828
1 changed files with 6 additions and 16 deletions
|
|
@ -6,17 +6,12 @@
|
|||
#include "etnaviv_nir.h"
|
||||
|
||||
static bool
|
||||
lower_txs(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
||||
lower_txs(nir_builder *b, nir_tex_instr *tex, UNUSED void *data)
|
||||
{
|
||||
if (instr->type != nir_instr_type_tex)
|
||||
return false;
|
||||
|
||||
nir_tex_instr *tex = nir_instr_as_tex(instr);
|
||||
|
||||
if (tex->op != nir_texop_txs)
|
||||
return false;
|
||||
|
||||
b->cursor = nir_instr_remove(instr);
|
||||
b->cursor = nir_instr_remove(&tex->instr);
|
||||
|
||||
nir_def *idx = nir_imm_int(b, tex->texture_index);
|
||||
nir_def *sizes = nir_load_texture_size_etna(b, 32, idx);
|
||||
|
|
@ -27,17 +22,12 @@ lower_txs(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
|||
}
|
||||
|
||||
static bool
|
||||
legalize_txf_lod(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
||||
legalize_txf_lod(nir_builder *b, nir_tex_instr *tex, UNUSED void *data)
|
||||
{
|
||||
if (instr->type != nir_instr_type_tex)
|
||||
return false;
|
||||
|
||||
nir_tex_instr *tex = nir_instr_as_tex(instr);
|
||||
|
||||
if (tex->op != nir_texop_txf)
|
||||
return false;
|
||||
|
||||
b->cursor = nir_before_instr(instr);
|
||||
b->cursor = nir_before_instr(&tex->instr);
|
||||
|
||||
int lod_index = nir_tex_instr_src_index(tex, nir_tex_src_lod);
|
||||
assert(lod_index >= 0);
|
||||
|
|
@ -67,10 +57,10 @@ etna_nir_lower_texture(nir_shader *s, struct etna_shader_key *key)
|
|||
key->tex_swizzle,
|
||||
true);
|
||||
|
||||
NIR_PASS(progress, s, nir_shader_instructions_pass, lower_txs,
|
||||
NIR_PASS(progress, s, nir_shader_tex_pass, lower_txs,
|
||||
nir_metadata_control_flow, NULL);
|
||||
|
||||
NIR_PASS(progress, s, nir_shader_instructions_pass, legalize_txf_lod,
|
||||
NIR_PASS(progress, s, nir_shader_tex_pass, legalize_txf_lod,
|
||||
nir_metadata_control_flow, NULL);
|
||||
|
||||
return progress;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue