From: Gert Wollny Date: Sat, 9 May 2020 09:30:19 +0000 (+0200) Subject: r600/sfn: Add support for image_size X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e458683a5255382a8f56ab91309e067ce94029ae;p=mesa.git r600/sfn: Add support for image_size Signed-off-by: Gert Wollny Part-of: --- diff --git a/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.cpp b/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.cpp index f8a843bc61b..972a0651395 100644 --- a/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.cpp @@ -3,6 +3,7 @@ #include "sfn_instruction_fetch.h" #include "sfn_instruction_gds.h" #include "sfn_instruction_misc.h" +#include "sfn_instruction_tex.h" #include "../r600_pipe.h" #include "../r600_asm.h" @@ -78,6 +79,8 @@ bool EmitSSBOInstruction::do_emit(nir_instr* instr) case nir_intrinsic_image_atomic_imin: case nir_intrinsic_image_atomic_imax: return emit_image_load(intr); + case nir_intrinsic_image_size: + return emit_image_size(intr); default: return false; } @@ -501,6 +504,26 @@ bool EmitSSBOInstruction::fetch_return_value(const nir_intrinsic_instr *intrin) return true; } +bool EmitSSBOInstruction::emit_image_size(const nir_intrinsic_instr *intrin) +{ + GPRVector dest = vec_from_nir(intrin->dest, nir_dest_num_components(intrin->dest)); + GPRVector src{9,{4,4,4,4}}; + + int res_id = R600_IMAGE_REAL_RESOURCE_OFFSET; + auto const_offset = nir_src_as_const_value(intrin->src[0]); + auto dyn_offset = PValue(); + if (const_offset) + res_id += const_offset[0].u32; + else + dyn_offset = from_nir(intrin->src[0], 0); + + auto ir = new TexInstruction(TexInstruction::get_resinfo, dest, src, + 0/* ?? */, + res_id, dyn_offset); + emit_instruction(ir); + return true; +} + GPRVector EmitSSBOInstruction::make_dest(const nir_intrinsic_instr* ir) { GPRVector::Values v; diff --git a/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.h b/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.h index 699075d744b..98479da30b2 100644 --- a/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.h +++ b/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.h @@ -26,6 +26,7 @@ private: bool emit_load_ssbo(const nir_intrinsic_instr* instr); bool emit_store_ssbo(const nir_intrinsic_instr* instr); + bool emit_image_size(const nir_intrinsic_instr *intrin); bool emit_image_load(const nir_intrinsic_instr *intrin); bool emit_image_store(const nir_intrinsic_instr *intrin); bool emit_ssbo_atomic_op(const nir_intrinsic_instr *intrin);