agx: Implement load_output
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10720>
This commit is contained in:
@@ -184,6 +184,28 @@ agx_emit_fragment_out(agx_builder *b, nir_intrinsic_instr *instr)
|
|||||||
b->shader->key->fs.tib_formats[rt]);
|
b->shader->key->fs.tib_formats[rt]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static agx_instr *
|
||||||
|
agx_emit_load_tile(agx_builder *b, nir_intrinsic_instr *instr)
|
||||||
|
{
|
||||||
|
const nir_variable *var =
|
||||||
|
nir_find_variable_with_driver_location(b->shader->nir,
|
||||||
|
nir_var_shader_out, nir_intrinsic_base(instr));
|
||||||
|
assert(var);
|
||||||
|
|
||||||
|
unsigned loc = var->data.location;
|
||||||
|
assert(var->data.index == 0 && "todo: dual-source blending");
|
||||||
|
assert(loc == FRAG_RESULT_DATA0 && "todo: MRT");
|
||||||
|
unsigned rt = (loc - FRAG_RESULT_DATA0);
|
||||||
|
|
||||||
|
/* TODO: Reverse-engineer interactions with MRT */
|
||||||
|
agx_writeout(b, 0xC200);
|
||||||
|
agx_writeout(b, 0x0008);
|
||||||
|
b->shader->did_writeout = true;
|
||||||
|
|
||||||
|
return agx_ld_tile_to(b, agx_dest_index(&instr->dest),
|
||||||
|
b->shader->key->fs.tib_formats[rt]);
|
||||||
|
}
|
||||||
|
|
||||||
static enum agx_format
|
static enum agx_format
|
||||||
agx_format_for_bits(unsigned bits)
|
agx_format_for_bits(unsigned bits)
|
||||||
{
|
{
|
||||||
@@ -280,6 +302,10 @@ agx_emit_intrinsic(agx_builder *b, nir_intrinsic_instr *instr)
|
|||||||
else
|
else
|
||||||
unreachable("Unsupported shader stage");
|
unreachable("Unsupported shader stage");
|
||||||
|
|
||||||
|
case nir_intrinsic_load_output:
|
||||||
|
assert(stage == MESA_SHADER_FRAGMENT);
|
||||||
|
return agx_emit_load_tile(b, instr);
|
||||||
|
|
||||||
case nir_intrinsic_load_ubo:
|
case nir_intrinsic_load_ubo:
|
||||||
case nir_intrinsic_load_kernel_input:
|
case nir_intrinsic_load_kernel_input:
|
||||||
return agx_emit_load_ubo(b, instr);
|
return agx_emit_load_ubo(b, instr);
|
||||||
|
Reference in New Issue
Block a user