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 <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9330>
This commit is contained in:
Gert Wollny 2021-02-28 20:15:56 +01:00
parent 935d9e6863
commit bd57bf6d82
3 changed files with 16 additions and 0 deletions

View file

@ -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};

View file

@ -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;

View file

@ -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;