mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 06:00:14 +01:00
agx: Add simple image fencing pass
Minimum needed to pass CTS. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24258>
This commit is contained in:
parent
7ed2596fe7
commit
46bb0037ce
4 changed files with 53 additions and 0 deletions
|
|
@ -12,5 +12,6 @@ struct nir_shader;
|
|||
bool agx_nir_opt_ixor_bcsel(struct nir_shader *shader);
|
||||
bool agx_nir_lower_algebraic_late(struct nir_shader *shader);
|
||||
bool agx_nir_fuse_algebraic_late(struct nir_shader *shader);
|
||||
bool agx_nir_fence_images(struct nir_shader *shader);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
44
src/asahi/compiler/agx_nir_fence_images.c
Normal file
44
src/asahi/compiler/agx_nir_fence_images.c
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright 2023 Valve Corporation
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "compiler/nir/nir_builder.h"
|
||||
#include "agx_nir.h"
|
||||
#include "nir.h"
|
||||
#include "nir_builder_opcodes.h"
|
||||
#include "nir_intrinsics.h"
|
||||
|
||||
static bool
|
||||
pass(struct nir_builder *b, nir_instr *instr, void *data)
|
||||
{
|
||||
if (instr->type != nir_instr_type_intrinsic)
|
||||
return false;
|
||||
|
||||
b->cursor = nir_after_instr(instr);
|
||||
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
||||
switch (intr->intrinsic) {
|
||||
case nir_intrinsic_image_store:
|
||||
case nir_intrinsic_bindless_image_store:
|
||||
nir_fence_pbe_to_tex_agx(b);
|
||||
return true;
|
||||
|
||||
case nir_intrinsic_image_atomic:
|
||||
case nir_intrinsic_bindless_image_atomic:
|
||||
case nir_intrinsic_image_atomic_swap:
|
||||
case nir_intrinsic_bindless_image_atomic_swap:
|
||||
nir_fence_mem_to_tex_agx(b);
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
agx_nir_fence_images(nir_shader *s)
|
||||
{
|
||||
return nir_shader_instructions_pass(
|
||||
s, pass, nir_metadata_block_index | nir_metadata_dominance, NULL);
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
#include "compiler/nir/nir_builtin_builder.h"
|
||||
#include "agx_compiler.h"
|
||||
#include "agx_internal_formats.h"
|
||||
#include "agx_nir.h"
|
||||
#include "nir_builder_opcodes.h"
|
||||
#include "nir_intrinsics.h"
|
||||
#include "nir_intrinsics_indices.h"
|
||||
|
|
@ -772,6 +773,12 @@ agx_nir_lower_texture(nir_shader *s, bool support_lod_bias)
|
|||
};
|
||||
|
||||
NIR_PASS(progress, s, nir_lower_tex, &lower_tex_options);
|
||||
|
||||
/* Insert fences before lowering image atomics, since image atomics need
|
||||
* different fencing than other image operations.
|
||||
*/
|
||||
NIR_PASS(progress, s, agx_nir_fence_images);
|
||||
|
||||
NIR_PASS(progress, s, nir_lower_image_atomics_to_global);
|
||||
|
||||
/* Lower bias after nir_lower_tex (to get rid of txd) but before
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ libasahi_agx_files = files(
|
|||
'agx_dce.c',
|
||||
'agx_liveness.c',
|
||||
'agx_insert_waits.c',
|
||||
'agx_nir_fence_images.c',
|
||||
'agx_nir_lower_address.c',
|
||||
'agx_nir_lower_frag_sidefx.c',
|
||||
'agx_nir_lower_sample_mask.c',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue