From bd57bf6d820f0cbc6cb3c1026f99c15d596d1bbf Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Sun, 28 Feb 2021 20:15:56 +0100 Subject: [PATCH] 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 Part-of: --- 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 EmitInstruction::empty = {}; const std::set EmitInstruction::write = {alu_write}; const std::set 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;