r600/sfn: Handle non-compressed MS texel fetch

v2: Fix formatting (Filip)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17822>
This commit is contained in:
Gert Wollny 2022-07-31 15:30:07 +02:00 committed by Marge Bot
parent 82437c69c4
commit a2cb85800b
2 changed files with 44 additions and 2 deletions

View file

@ -336,7 +336,7 @@ bool TexInstr::from_nir(nir_tex_instr *tex, Shader& shader)
case nir_texop_tex:
return emit_tex_tex(tex, src, shader);
case nir_texop_txf:
return emit_tex_txf(tex, src, shader);
return emit_tex_txf(tex, src, shader);
case nir_texop_txb:
case nir_texop_txl:
return emit_tex_txl_txb(tex, src, shader);
@ -349,7 +349,10 @@ bool TexInstr::from_nir(nir_tex_instr *tex, Shader& shader)
case nir_texop_txd:
return emit_tex_txd(tex, src, shader);
case nir_texop_txf_ms:
return emit_tex_tex_ms(tex, src, shader);
if (shader.chip_class() < ISA_CC_EVERGREEN)
return emit_tex_tex_ms_direct(tex, src, shader);
else
return emit_tex_tex_ms(tex, src, shader);
case nir_texop_tg4:
return emit_tex_tg4(tex, src, shader);
case nir_texop_texture_samples:
@ -499,6 +502,44 @@ bool TexInstr::emit_buf_txf(nir_tex_instr *tex, Inputs& src, Shader& shader)
return true;
}
bool TexInstr::emit_tex_tex_ms_direct(nir_tex_instr *tex, Inputs& src, Shader& shader)
{
assert(tex->src[0].src.is_ssa);
auto& vf = shader.value_factory();
r600::sfn_log << SfnLog::instr << "emit '"
<< *reinterpret_cast<nir_instr*>(tex)
<< "' (" << __func__ << ")\n";
auto sampler = get_sampler_id(tex->sampler_index, src.sampler_deref);
assert(!sampler.indirect && "Indirect sampler selection not yet supported");
auto temp2 = vf.temp_vec4(pin_group);
for (unsigned i = 0; i < tex->coord_components; ++i) {
unsigned k = i;
if (tex->is_array && tex->sampler_dim == GLSL_SAMPLER_DIM_1D && i == 1)
k = 2;
shader.emit_instruction(new AluInstr(op1_mov, temp2[k],
src.coord[k], AluInstr::write));
}
shader.emit_instruction(new AluInstr(op1_mov, temp2[3], src.ms_index,
AluInstr::last_write));
auto dst = vf.dest_vec4(tex->dest, pin_group);
/* txf doesn't need rounding for the array index, but 1D has the array index
* in the z component */
auto tex_ir = new TexInstr(ld, dst, {0,1,2,3}, temp2,
sampler.id,
sampler.id + R600_MAX_CONST_BUFFERS, src.sampler_offset);
shader.emit_instruction(tex_ir);
return true;
}
bool TexInstr::emit_tex_tex_ms(nir_tex_instr *tex, Inputs& src, Shader& shader)
{
assert(tex->src[0].src.is_ssa);

View file

@ -159,6 +159,7 @@ private:
static bool emit_buf_txf(nir_tex_instr *tex, Inputs& src, Shader& shader);
static bool emit_tex_txf(nir_tex_instr *tex, Inputs& src, Shader& shader);
static bool emit_tex_tex_ms_direct(nir_tex_instr *tex, Inputs& src, Shader& shader);
static bool emit_tex_tex_ms(nir_tex_instr *tex, Inputs& src, Shader& shader);
static bool emit_tex_tex(nir_tex_instr *tex, Inputs& src, Shader& shader);
static bool emit_tex_txl_txb(nir_tex_instr *tex, Inputs& src, Shader& shader);