Mesa (main): nouveau: Use nir_lower_tex for projectors
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Aug 9 15:32:26 UTC 2021
Module: Mesa
Branch: main
Commit: bf87b9ad81dbff34ab53d733bcfac9228ea4121c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf87b9ad81dbff34ab53d733bcfac9228ea4121c
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Mon Jul 12 11:27:29 2021 -0500
nouveau: Use nir_lower_tex for projectors
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11826>
---
.../drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 23 +++++++---------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
index 75e3ef14786..37ad8a1a53b 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -166,7 +166,6 @@ private:
bool visit(nir_tex_instr *);
// tex stuff
- Value* applyProjection(Value *src, Value *proj);
unsigned int getNIRArgCount(TexInstruction::Target&);
nir_shader *nir;
@@ -2913,14 +2912,6 @@ Converter::convert(glsl_sampler_dim dim, bool isArray, bool isShadow)
}
#undef CASE_SAMPLER
-Value*
-Converter::applyProjection(Value *src, Value *proj)
-{
- if (!proj)
- return src;
- return mkOp2v(OP_MUL, TYPE_F32, getScratch(), src, proj);
-}
-
unsigned int
Converter::getNIRArgCount(TexInstruction::Target& target)
{
@@ -2963,7 +2954,6 @@ Converter::visit(nir_tex_instr *insn)
std::vector<nir_src*> offsets;
uint8_t mask = 0;
bool lz = false;
- Value *proj = NULL;
TexInstruction::Target target = convert(insn->sampler_dim, insn->is_array, insn->is_shadow);
operation op = getOperation(insn->op);
@@ -2976,7 +2966,6 @@ Converter::visit(nir_tex_instr *insn)
int msIdx = nir_tex_instr_src_index(insn, nir_tex_src_ms_index);
int lodIdx = nir_tex_instr_src_index(insn, nir_tex_src_lod);
int offsetIdx = nir_tex_instr_src_index(insn, nir_tex_src_offset);
- int projIdx = nir_tex_instr_src_index(insn, nir_tex_src_projector);
int sampOffIdx = nir_tex_instr_src_index(insn, nir_tex_src_sampler_offset);
int texOffIdx = nir_tex_instr_src_index(insn, nir_tex_src_texture_offset);
int sampHandleIdx = nir_tex_instr_src_index(insn, nir_tex_src_sampler_handle);
@@ -2985,12 +2974,9 @@ Converter::visit(nir_tex_instr *insn)
bool bindless = sampHandleIdx != -1 || texHandleIdx != -1;
assert((sampHandleIdx != -1) == (texHandleIdx != -1));
- if (projIdx != -1)
- proj = mkOp1v(OP_RCP, TYPE_F32, getScratch(), getSrc(&insn->src[projIdx].src, 0));
-
srcs.resize(insn->coord_components);
for (uint8_t i = 0u; i < insn->coord_components; ++i)
- srcs[i] = applyProjection(getSrc(&insn->src[coordsIdx].src, i), proj);
+ srcs[i] = getSrc(&insn->src[coordsIdx].src, i);
// sometimes we get less args than target.getArgCount, but codegen expects the latter
if (insn->coord_components) {
@@ -3018,7 +3004,7 @@ Converter::visit(nir_tex_instr *insn)
if (offsetIdx != -1)
offsets.push_back(&insn->src[offsetIdx].src);
if (compIdx != -1)
- srcs.push_back(applyProjection(getSrc(&insn->src[compIdx].src, 0), proj));
+ srcs.push_back(getSrc(&insn->src[compIdx].src, 0));
if (texOffIdx != -1) {
srcs.push_back(getSrc(&insn->src[texOffIdx].src, 0));
texOffIdx = srcs.size() - 1;
@@ -3149,6 +3135,11 @@ Converter::run()
NIR_PASS_V(nir, nir_lower_subgroups, &subgroup_options);
+ struct nir_lower_tex_options tex_options = {};
+ tex_options.lower_txp = ~0;
+
+ NIR_PASS_V(nir, nir_lower_tex, &tex_options);
+
NIR_PASS_V(nir, nir_lower_load_const_to_scalar);
NIR_PASS_V(nir, nir_lower_alu_to_scalar, NULL, NULL);
NIR_PASS_V(nir, nir_lower_phis_to_scalar, false);
More information about the mesa-commit
mailing list