r600/sfn: handle querying SSBO size
Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6025>
This commit is contained in:
@@ -98,6 +98,8 @@ bool EmitSSBOInstruction::do_emit(nir_instr* instr)
|
||||
return emit_image_load(intr);
|
||||
case nir_intrinsic_image_size:
|
||||
return emit_image_size(intr);
|
||||
case nir_intrinsic_get_buffer_size:
|
||||
return emit_buffer_size(intr);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -586,6 +588,32 @@ bool EmitSSBOInstruction::emit_image_size(const nir_intrinsic_instr *intrin)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EmitSSBOInstruction::emit_buffer_size(const nir_intrinsic_instr *intr)
|
||||
{
|
||||
std::array<PValue,4> dst_elms;
|
||||
|
||||
|
||||
for (uint16_t i = 0; i < 4; ++i) {
|
||||
dst_elms[i] = from_nir(intr->dest, (i < intr->dest.ssa.num_components) ? i : 7);
|
||||
}
|
||||
|
||||
GPRVector dst(dst_elms);
|
||||
GPRVector src(0,{4,4,4,4});
|
||||
|
||||
auto const_offset = nir_src_as_const_value(intr->src[0]);
|
||||
auto dyn_offset = PValue();
|
||||
int res_id = R600_IMAGE_REAL_RESOURCE_OFFSET;
|
||||
if (const_offset)
|
||||
res_id += const_offset[0].u32;
|
||||
else
|
||||
assert(0 && "dynamic buffer offset not supported in buffer_size");
|
||||
|
||||
emit_instruction(new FetchInstruction(dst, PValue(new GPRValue(0, 7)),
|
||||
res_id, bim_none));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GPRVector EmitSSBOInstruction::make_dest(const nir_intrinsic_instr* ir)
|
||||
{
|
||||
GPRVector::Values v;
|
||||
|
@@ -32,6 +32,7 @@ private:
|
||||
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);
|
||||
bool emit_buffer_size(const nir_intrinsic_instr *intrin);
|
||||
|
||||
bool fetch_return_value(const nir_intrinsic_instr *intrin);
|
||||
|
||||
|
Reference in New Issue
Block a user