mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 08:50:09 +01:00
ac/llvm: implement nir_export_amd
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20691>
This commit is contained in:
parent
5f24d58549
commit
5fe4dd3d68
2 changed files with 28 additions and 0 deletions
|
|
@ -50,6 +50,12 @@ enum
|
|||
AC_EXP_PARAM_UNDEFINED = 255, /* deprecated, use AC_EXP_PARAM_DEFAULT_VAL_0000 instead */
|
||||
};
|
||||
|
||||
enum {
|
||||
AC_EXP_FLAG_COMPRESSED = (1 << 0),
|
||||
AC_EXP_FLAG_DONE = (1 << 1),
|
||||
AC_EXP_FLAG_VALID_MASK = (1 << 2),
|
||||
};
|
||||
|
||||
/* Maps I/O semantics to the actual location used by the lowering pass. */
|
||||
typedef unsigned (*ac_nir_map_io_driver_location)(unsigned semantic);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "ac_llvm_util.h"
|
||||
#include "ac_shader_abi.h"
|
||||
#include "ac_shader_util.h"
|
||||
#include "ac_nir.h"
|
||||
#include "nir/nir.h"
|
||||
#include "nir/nir_deref.h"
|
||||
#include "sid.h"
|
||||
|
|
@ -4299,6 +4300,27 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
|
|||
result = ac_build_gather_values(&ctx->ac, global_count, instr->num_components);
|
||||
break;
|
||||
}
|
||||
case nir_intrinsic_export_amd: {
|
||||
unsigned flags = nir_intrinsic_flags(instr);
|
||||
unsigned target = nir_intrinsic_base(instr);
|
||||
unsigned write_mask = nir_intrinsic_write_mask(instr);
|
||||
|
||||
struct ac_export_args args = {
|
||||
.target = target,
|
||||
.enabled_channels = write_mask,
|
||||
.compr = flags & AC_EXP_FLAG_COMPRESSED,
|
||||
.done = flags & AC_EXP_FLAG_DONE,
|
||||
.valid_mask = flags & AC_EXP_FLAG_VALID_MASK,
|
||||
};
|
||||
|
||||
LLVMValueRef value = get_src(ctx, instr->src[0]);
|
||||
int num_components = ac_get_llvm_num_components(value);
|
||||
for (int i = 0; i < num_components; i++)
|
||||
args.out[i] = ac_llvm_extract_elem(&ctx->ac, value, i);
|
||||
|
||||
ac_build_export(&ctx->ac, &args);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fprintf(stderr, "Unknown intrinsic: ");
|
||||
nir_print_instr(&instr->instr, stderr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue