Module: Mesa
Branch: master
Commit: bd57bf6d820f0cbc6cb3c1026f99c15d596d1bbf
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd57bf6d820f0cbc6cb3c1026f99c15d596d1bbf

Author: Gert Wollny <[email protected]>
Date:   Sun Feb 28 20:15:56 2021 +0100

r600/sfn: handle querying the number of layers in cube arrays

This has to be loaded from a constant buffer instead of the actual
texture.

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9330>

---

 src/gallium/drivers/r600/sfn/sfn_emitinstruction.cpp    | 5 +++++
 src/gallium/drivers/r600/sfn/sfn_emitinstruction.h      | 2 ++
 src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp | 9 +++++++++
 3 files changed, 16 insertions(+)

diff --git a/src/gallium/drivers/r600/sfn/sfn_emitinstruction.cpp 
b/src/gallium/drivers/r600/sfn/sfn_emitinstruction.cpp
index 42162ca4d8c..0f8a39d992e 100644
--- a/src/gallium/drivers/r600/sfn/sfn_emitinstruction.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_emitinstruction.cpp
@@ -165,6 +165,11 @@ int EmitInstruction::remap_atomic_base(int base)
        return m_proc.remap_atomic_base(base);
 }
 
+void EmitInstruction::set_has_txs_cube_array_comp()
+{
+   m_proc.sh_info().has_txq_cube_array_z_comp = 1;
+}
+
 const std::set<AluModifiers> EmitInstruction::empty = {};
 const std::set<AluModifiers> EmitInstruction::write = {alu_write};
 const std::set<AluModifiers> EmitInstruction::last_write = {alu_write, 
alu_last_instr};
diff --git a/src/gallium/drivers/r600/sfn/sfn_emitinstruction.h 
b/src/gallium/drivers/r600/sfn/sfn_emitinstruction.h
index bc6e3be43e3..463e1428a37 100644
--- a/src/gallium/drivers/r600/sfn/sfn_emitinstruction.h
+++ b/src/gallium/drivers/r600/sfn/sfn_emitinstruction.h
@@ -91,6 +91,8 @@ protected:
                         const PValue& reg, bool map);
 
    int remap_atomic_base(int base);
+
+   void set_has_txs_cube_array_comp();
 private:
 
    ShaderFromNirProcessor& m_proc;
diff --git a/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp 
b/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp
index 906c9c72268..5cc2fbd860d 100644
--- a/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp
@@ -336,6 +336,15 @@ bool EmitTexInstruction::emit_tex_txs(nir_tex_instr* 
instr, TexInputs& tex_src,
                                    sampler.id + R600_MAX_CONST_BUFFERS, 
tex_src.sampler_offset);
       ir->set_dest_swizzle(dest_swz);
       emit_instruction(ir);
+
+      if (instr->is_array && instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE) {
+         PValue src(new UniformValue(512 + R600_BUFFER_INFO_OFFSET / 16 + 
(sampler.id >> 2),
+                                     sampler.id & 3, 
R600_BUFFER_INFO_CONST_BUFFER));
+
+         auto alu = new AluInstruction(op1_mov, dst[2], src, {last_write});
+         emit_instruction(alu);
+         set_has_txs_cube_array_comp();
+      }
    }
 
    return true;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to