| 1 |
/* |
| 2 |
* Copyright © 2025 Imagination Technologies Ltd. |
| 3 |
* SPDX-License-Identifier: MIT |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef PCO_LIBCL_H |
| 7 |
#define PCO_LIBCL_H |
| 8 |
|
| 9 |
#include "common/pvr_iface.h" |
| 10 |
#include "compiler/libcl/libcl.h" |
| 11 |
#include "compiler/shader_enums.h" |
| 12 |
#include "pco/pco_common.h" |
| 13 |
#include "pp_macros.h" |
| 14 |
|
| 15 |
#define OVERLOADABLE __attribute__((overloadable)) |
| 16 |
|
| 17 |
void nir_mutex_pco(enum pco_mutex_id mutex_id, enum pco_mutex_op mutex_op); |
| 18 |
uint32_t nir_load_instance_num_pco(void); |
| 19 |
|
| 20 |
uint32_t nir_load_ssbo(uint2 buffer_index, |
| 21 |
uint offset, |
| 22 |
enum gl_access_qualifier access, |
| 23 |
uint align_mul, |
| 24 |
uint align_offset, |
| 25 |
uint offset_shift); |
| 26 |
|
| 27 |
void nir_store_ssbo(uint32_t value, |
| 28 |
uint2 block_index, |
| 29 |
uint offset, |
| 30 |
uint write_mask, |
| 31 |
enum gl_access_qualifier access, |
| 32 |
uint align_mul, |
| 33 |
uint align_offset, |
| 34 |
uint offset_shift); |
| 35 |
|
| 36 |
uint32_t |
| 37 |
nir_load_shared(uint offset, uint base, uint access, uint align_mul, uint align_offset); |
| 38 |
|
| 39 |
void nir_store_shared(uint32_t value, |
| 40 |
uint offset, |
| 41 |
uint base, |
| 42 |
uint access, |
| 43 |
uint write_mask, |
| 44 |
uint align_mul, |
| 45 |
uint align_offset); |
| 46 |
|
| 47 |
void OVERLOADABLE nir_uvsw_write_pco(uint offset, uint data); |
| 48 |
void OVERLOADABLE nir_uvsw_write_pco(uint offset, uint2 data); |
| 49 |
void OVERLOADABLE nir_uvsw_write_pco(uint offset, uint3 data); |
| 50 |
void OVERLOADABLE nir_uvsw_write_pco(uint offset, uint4 data); |
| 51 |
|
| 52 |
void OVERLOADABLE nir_uvsw_write_pco(uint offset, float data); |
| 53 |
void OVERLOADABLE nir_uvsw_write_pco(uint offset, float2 data); |
| 54 |
void OVERLOADABLE nir_uvsw_write_pco(uint offset, float3 data); |
| 55 |
void OVERLOADABLE nir_uvsw_write_pco(uint offset, float4 data); |
| 56 |
|
| 57 |
uint nir_load_vtxin_pco__1(uint offset); |
| 58 |
uint2 nir_load_vtxin_pco__2(uint offset); |
| 59 |
uint3 nir_load_vtxin_pco__3(uint offset); |
| 60 |
uint4 nir_load_vtxin_pco__4(uint offset); |
| 61 |
|
| 62 |
#define nir_load_vtxin_pco(n, ...) CAT2(nir_load_vtxin_pco__, n)(__VA_ARGS__) |
| 63 |
|
| 64 |
uint nir_load_coeff_pco__1(uint offset); |
| 65 |
uint2 nir_load_coeff_pco__2(uint offset); |
| 66 |
uint3 nir_load_coeff_pco__3(uint offset); |
| 67 |
uint4 nir_load_coeff_pco__4(uint offset); |
| 68 |
|
| 69 |
#define nir_load_coeff_pco(n, ...) CAT2(nir_load_coeff_pco__, n)(__VA_ARGS__) |
| 70 |
|
| 71 |
uint nir_load_preamble__1(uint base, uint preamble_class); |
| 72 |
uint4 nir_load_preamble__4(uint base, uint preamble_class); |
| 73 |
|
| 74 |
#define nir_load_preamble(n, ...) CAT2(nir_load_preamble__, n)(__VA_ARGS__) |
| 75 |
|
| 76 |
void nir_store_preamble_dynamic(uint data, uint offset, uint preamble_class); |
| 77 |
|
| 78 |
uint nir_dma_ld_pco__1(uint2 addr); |
| 79 |
uint2 nir_dma_ld_pco__2(uint2 addr); |
| 80 |
uint3 nir_dma_ld_pco__3(uint2 addr); |
| 81 |
uint4 nir_dma_ld_pco__4(uint2 addr); |
| 82 |
uint16 nir_dma_ld_pco__16(uint2 addr); |
| 83 |
|
| 84 |
#define nir_dma_ld_pco(n, ...) CAT2(nir_dma_ld_pco__, n)(__VA_ARGS__) |
| 85 |
|
| 86 |
void nir_dma_st_pco__1(uint3 addr_data, uint flags); |
| 87 |
void nir_dma_st_pco__2(uint4 addr_data, uint flags); |
| 88 |
|
| 89 |
#define SELECT_ARGS_ST(flags, addr, ...) \ |
| 90 |
((CAT2(uint, NUM_ARGS_PLUS_2(__VA_ARGS__)))(addr, __VA_ARGS__), flags) |
| 91 |
|
| 92 |
/* clang-format off */ |
| 93 |
#define nir_dma_st_pco(flags, addr, ...) SELECT_NAME(nir_dma_st_pco, __, __VA_ARGS__)SELECT_ARGS_ST(flags, addr, __VA_ARGS__) |
| 94 |
/* clang-format on */ |
| 95 |
|
| 96 |
void nir_dma_st_shregs_pco(uint2 addr, |
| 97 |
uint burst_len, |
| 98 |
uint shreg_offset, |
| 99 |
uint flags); |
| 100 |
|
| 101 |
void nir_dma_ld_shregs_pco(uint2 addr, uint burst_len, uint shreg_offset); |
| 102 |
|
| 103 |
void nir_dma_idf_pco(uint2 addr); |
| 104 |
|
| 105 |
uint2 nir_uadd64_32(uint lo, uint hi, uint offset); |
| 106 |
uint nir_imad(uint a, uint b, uint c); |
| 107 |
uint2 nir_umad64_32(uint a, uint b, uint lo, uint hi); |
| 108 |
|
| 109 |
uint nir_load_shared_reg_alloc_size_pco(void); |
| 110 |
|
| 111 |
uint nir_smp_pco(uint16 data, |
| 112 |
uint4 tex_state, |
| 113 |
uint4 smp_state, |
| 114 |
uint smp_flags, |
| 115 |
uint range); |
| 116 |
|
| 117 |
uint nir_umax(uint a, uint b); |
| 118 |
#endif /* PCO_LIBCL_H */ |