mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
agx: Implement load_global(_constant)
Found in compute shaders, maps to a subset of device_load, and will be used for some lowerings soon. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18525>
This commit is contained in:
parent
965cc62bdd
commit
bc4f418cb4
1 changed files with 20 additions and 0 deletions
|
|
@ -507,6 +507,21 @@ agx_format_for_bits(unsigned bits)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
agx_emit_load_global(agx_builder *b, agx_index *dests, nir_intrinsic_instr *instr)
|
||||
{
|
||||
agx_index addr = agx_src_index(&instr->src[0]);
|
||||
agx_index offset = agx_immediate(0);
|
||||
enum agx_format fmt = agx_format_for_bits(nir_dest_bit_size(instr->dest));
|
||||
|
||||
agx_index vec = agx_vec_for_intr(b->shader, instr);
|
||||
agx_device_load_to(b, vec, addr, offset, fmt,
|
||||
BITFIELD_MASK(nir_dest_num_components(instr->dest)), 0);
|
||||
agx_wait(b, 0);
|
||||
|
||||
agx_emit_split(b, dests, vec, 4);
|
||||
}
|
||||
|
||||
static agx_instr *
|
||||
agx_emit_load_ubo(agx_builder *b, agx_index dst, nir_intrinsic_instr *instr)
|
||||
{
|
||||
|
|
@ -622,6 +637,11 @@ agx_emit_intrinsic(agx_builder *b, nir_intrinsic_instr *instr)
|
|||
|
||||
break;
|
||||
|
||||
case nir_intrinsic_load_global:
|
||||
case nir_intrinsic_load_global_constant:
|
||||
agx_emit_load_global(b, dests, instr);
|
||||
break;
|
||||
|
||||
case nir_intrinsic_store_output:
|
||||
if (stage == MESA_SHADER_FRAGMENT)
|
||||
return agx_emit_fragment_out(b, instr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue