From: Gert Wollny Date: Sat, 9 May 2020 13:21:01 +0000 (+0200) Subject: r600/sfn: Add support for texture_samples X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cd2d7966ac44697d31684e2b5b5b492142915a1e;p=mesa.git r600/sfn: Add support for texture_samples Signed-off-by: Gert Wollny Reviewed-by: Reviewed-by: Dave Airlie Part-of: --- diff --git a/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp b/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp index 1495714fab0..a063f6c424e 100644 --- a/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp @@ -97,7 +97,10 @@ bool EmitTexInstruction::do_emit(nir_instr* instr) return emit_tex_txf_ms(ir, src); case nir_texop_query_levels: return emit_tex_txs(ir, src, {3,7,7,7}); + case nir_texop_texture_samples: + return emit_tex_texture_samples(ir, src, {3,7,7,7}); default: + return false; } } @@ -630,6 +633,22 @@ bool EmitTexInstruction::emit_tex_txs(nir_tex_instr* instr, TexInputs& tex_src, } +bool EmitTexInstruction::emit_tex_texture_samples(nir_tex_instr* instr, TexInputs& src, + const std::array &dest_swz) +{ + GPRVector dest = vec_from_nir(instr->dest, nir_dest_num_components(instr->dest)); + GPRVector help{0,{4,4,4,4}}; + + auto dyn_offset = PValue(); + int res_id = R600_MAX_CONST_BUFFERS + instr->sampler_index; + + auto ir = new TexInstruction(TexInstruction::get_nsampled, dest, help, + 0, res_id, src.sampler_offset); + ir->set_dest_swizzle(dest_swz); + emit_instruction(ir); + return true; +} + bool EmitTexInstruction::emit_tex_tg4(nir_tex_instr* instr, TexInputs& src) { r600::sfn_log << SfnLog::instr << "emit '" diff --git a/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.h b/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.h index 5c998b99b45..e63a6f9cc71 100644 --- a/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.h +++ b/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.h @@ -73,6 +73,8 @@ private: bool emit_tex_txl(nir_tex_instr* instr, TexInputs& src); bool emit_tex_txs(nir_tex_instr* instr, TexInputs& src, const std::array &dest_swz); + bool emit_tex_texture_samples(nir_tex_instr* instr, TexInputs& src, + const std::array &dest_swz); bool emit_tex_lod(nir_tex_instr* instr, TexInputs& src); bool emit_tex_tg4(nir_tex_instr* instr, TexInputs& src); bool emit_tex_txf_ms(nir_tex_instr* instr, TexInputs& src);