1 /* 2 * Copyright © 2024 Imagination Technologies Ltd. 3 * 4 * SPDX-License-Identifier: MIT 5 */ 6 7 #ifndef PCO_DATA_H 8 #define PCO_DATA_H 9 10 /** 11 * \file pco_data.h 12 * 13 * \brief PCO shader-specific data/compiler-driver interface. 14 */ 15 16 #include "compiler/shader_enums.h" 17 #include "util/format/u_format.h" 18 19 #include <stdbool.h> 20 21 /** Generic range struct. */ 22 typedef struct _pco_range { 23 unsigned start; 24 unsigned count; 25 } pco_range; 26 27 /** PCO vertex shader-specific data. */ 28 typedef struct _pco_vs_data { 29 /** Attributes/input mappings. */ 30 pco_range attribs[VERT_ATTRIB_MAX]; 31 32 enum pipe_format attrib_formats[VERT_ATTRIB_MAX]; 33 34 /** Varyings/output mappings. */ 35 pco_range varyings[VARYING_SLOT_MAX]; 36 37 unsigned f32_smooth; /** Number of F32 linear varyings. */ 38 unsigned f32_flat; /** Number of F32 flat varyings. */ 39 unsigned f32_npc; /** Number of F32 NPC varyings. */ 40 41 unsigned f16_smooth; /** Number of F16 linear varyings. */ 42 unsigned f16_flat; /** Number of F16 flat varyings. */ 43 unsigned f16_npc; /** Number of F16 NPC varyings. */ 44 45 unsigned vtxouts; /** How many vertex outputs are written to. */ 46 } pco_vs_data; 47 48 /** PCO fragment shader-specific data. */ 49 typedef struct _pco_fs_data { 50 /** Varyings/input mappings. */ 51 pco_range varyings[VARYING_SLOT_MAX]; 52 53 /** Results/output mappings. */ 54 pco_range outputs[FRAG_RESULT_MAX]; 55 56 /** If outputs are to be placed in pixout regs. */ 57 bool output_reg[FRAG_RESULT_MAX]; 58 59 /** Fragment output formats. */ 60 enum pipe_format output_formats[FRAG_RESULT_MAX]; 61 62 struct { 63 bool w; /** Whether the shader uses pos.w. */ 64 bool z; /** Whether the shader uses pos.z */ 65 bool pntc; /** Whether the shader uses point coord. */ 66 bool phase_change; /** Whether the shader does a phase change. */ 67 } uses; 68 } pco_fs_data; 69 70 /** PCO compute shader-specific data. */ 71 typedef struct _pco_cs_data { 72 /**/ 73 } pco_cs_data; 74 75 /** PCO common data. */ 76 typedef struct _pco_common_data { 77 /** System value mappings. */ 78 pco_range sys_vals[SYSTEM_VALUE_MAX]; 79 80 unsigned temps; /** Number of allocated temp registers. */ 81 unsigned vtxins; /** Number of allocated vertex input registers. */ 82 unsigned interns; /** Number of allocated internal registers. */ 83 84 unsigned coeffs; /** Number of allocated coefficient registers. */ 85 unsigned shareds; /** Number of allocated shared registers. */ 86 87 unsigned entry_offset; /** Offset of the shader entrypoint. */ 88 89 struct { 90 bool atomics; /** Whether the shader uses atomics. */ 91 bool barriers; /** Whether the shader uses barriers. */ 92 bool side_effects; /** Whether the shader has side effects. */ 93 bool empty; /** Whether the shader is empty. */ 94 } uses; 95 } pco_common_data; 96 97 /** PCO shader data. */ 98 typedef struct _pco_data { 99 union { 100 pco_vs_data vs; 101 pco_fs_data fs; 102 pco_cs_data cs; 103 }; 104 105 pco_common_data common; 106 } pco_data; 107 108 #endif /* PCO_DATA_H */ 109