X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fvc4%2Fvc4_nir_lower_txf_ms.c;h=108524377ac7c768bc105a2333b669b6b60ea561;hb=59a692916ca251db995050f7fc0bb7b4e6e4780b;hp=2490819c297962703fd2e92f90a92f596e351083;hpb=d5fa51bdee51ed4c24c28dd51be669a04b67e640;p=mesa.git diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c b/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c index 2490819c297..108524377ac 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c @@ -23,8 +23,7 @@ #include "vc4_qir.h" #include "kernel/vc4_packet.h" -#include "tgsi/tgsi_info.h" -#include "glsl/nir/nir_builder.h" +#include "compiler/nir/nir_builder.h" /** @file vc4_nir_lower_txf_ms.c * Walks the NIR generated by TGSI-to-NIR to lower its nir_texop_txf_ms @@ -47,8 +46,8 @@ vc4_nir_lower_txf_ms_instr(struct vc4_compile *c, nir_builder *b, nir_tex_instr *txf = nir_tex_instr_create(c->s, 1); txf->op = nir_texop_txf; - txf->sampler = txf_ms->sampler; - txf->sampler_index = txf_ms->sampler_index; + txf->texture = txf_ms->texture; + txf->texture_index = txf_ms->texture_index; txf->coord_components = txf_ms->coord_components; txf->is_shadow = txf_ms->is_shadow; txf->is_new_style_shadow = txf_ms->is_new_style_shadow; @@ -80,7 +79,7 @@ vc4_nir_lower_txf_ms_instr(struct vc4_compile *c, nir_builder *b, uint32_t tile_h_shift = 5; uint32_t tile_size = (tile_h * tile_w * VC4_MAX_SAMPLES * sizeof(uint32_t)); - unsigned unit = txf_ms->sampler_index; + unsigned unit = txf_ms->texture_index; uint32_t w = align(c->key->tex[unit].msaa_width, tile_w); uint32_t w_tiles = w / tile_w; @@ -123,7 +122,7 @@ vc4_nir_lower_txf_ms_instr(struct vc4_compile *c, nir_builder *b, txf->src[0].src_type = nir_tex_src_coord; txf->src[0].src = nir_src_for_ssa(nir_vec2(b, addr, nir_imm_int(b, 0))); - nir_ssa_dest_init(&txf->instr, &txf->dest, 4, NULL); + nir_ssa_dest_init(&txf->instr, &txf->dest, 4, 32, NULL); nir_builder_instr_insert(b, &txf->instr); nir_ssa_def_rewrite_uses(&txf_ms->dest.ssa, nir_src_for_ssa(&txf->dest.ssa)); @@ -131,30 +130,20 @@ vc4_nir_lower_txf_ms_instr(struct vc4_compile *c, nir_builder *b, } static bool -vc4_nir_lower_txf_ms_block(nir_block *block, void *arg) +vc4_nir_lower_txf_ms_impl(struct vc4_compile *c, nir_function_impl *impl) { - struct vc4_compile *c = arg; - nir_function_impl *impl = - nir_cf_node_get_function(&block->cf_node); - nir_builder b; nir_builder_init(&b, impl); - nir_foreach_instr_safe(block, instr) { - if (instr->type == nir_instr_type_tex) { - vc4_nir_lower_txf_ms_instr(c, &b, - nir_instr_as_tex(instr)); + nir_foreach_block(block, impl) { + nir_foreach_instr_safe(instr, block) { + if (instr->type == nir_instr_type_tex) { + vc4_nir_lower_txf_ms_instr(c, &b, + nir_instr_as_tex(instr)); + } } } - return true; -} - -static bool -vc4_nir_lower_txf_ms_impl(struct vc4_compile *c, nir_function_impl *impl) -{ - nir_foreach_block(impl, vc4_nir_lower_txf_ms_block, c); - nir_metadata_preserve(impl, nir_metadata_block_index | nir_metadata_dominance); @@ -163,9 +152,9 @@ vc4_nir_lower_txf_ms_impl(struct vc4_compile *c, nir_function_impl *impl) } void -vc4_nir_lower_txf_ms(struct vc4_compile *c) +vc4_nir_lower_txf_ms(nir_shader *s, struct vc4_compile *c) { - nir_foreach_function(c->s, function) { + nir_foreach_function(function, s) { if (function->impl) vc4_nir_lower_txf_ms_impl(c, function->impl); }