aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2020-05-09 15:21:01 +0200
committerMarge Bot <[email protected]>2020-05-19 07:52:13 +0000
commitcd2d7966ac44697d31684e2b5b5b492142915a1e (patch)
treed91ff146f08f18cbf819e77acab4c7cfc23d9241
parent358b0a57bfd7b5f7e0e05fa4f4cfab5c106a82ff (diff)
r600/sfn: Add support for texture_samples
Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Reviewed-by: Dave Airlie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5085>
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp19
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_emittexinstruction.h2
2 files changed, 21 insertions, 0 deletions
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<int, 4> &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<int, 4> &dest_swz);
+ bool emit_tex_texture_samples(nir_tex_instr* instr, TexInputs& src,
+ const std::array<int, 4> &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);