~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/imagination/vulkan/pvr_formats.h

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
   PVR_PBE_ACCUM_FORMAT_U24,
58
58
};
59
59
 
 
60
/**
 
61
 * Pixel related shader selector. The logic selecting the shader has to take
 
62
 * into account the pixel related properties (controlling the conversion path in
 
63
 * the shader) and the geometry related properties (controlling the sample
 
64
 * position calcs). These two can be orthogonal.
 
65
 *
 
66
 * integer format conversions, bit depth : 8, 16, 32 per ch formats : signed,
 
67
 * unsigned. Strategy: convert everything to U32 or S32 then USC pack. PBE just
 
68
 * pass through.
 
69
 *
 
70
 * fixed point format conversions, bit depth 565, 1555, 555 etc. Strategy:
 
71
 * fcnorm to 4 F32, then USC pack to F16F16. PBE converts to destination
 
72
 *
 
73
 * float/fixed format conversions
 
74
 * strategy: fcnorm, then pack to f16 _when_ destination is not f32.
 
75
 *      fmt | unorm | flt |
 
76
 *        8 |     x |     |
 
77
 *       16 |     x |   x |
 
78
 *       32 |     x |   x |
 
79
 *
 
80
 *
 
81
 * non-merge type DS blit table
 
82
 * **********************************************
 
83
 * *        *  S8    D16   D24S8  D32    D32S8  *
 
84
 * **********************************************
 
85
 * * S8     *  cpy   i     i      i      i      *
 
86
 * * D16    *  i     cpy   i      -      i      *
 
87
 * * D24S8  *  swiz  -     cpy    (1)    -      *
 
88
 * * D32    *  i     -     i      cpy    i      *
 
89
 * * D32S8  *  (2)   -     -      cpy    cpy    *
 
90
 * **********************************************
 
91
 *
 
92
 * merge with stencil pick type DS blit table
 
93
 * **********************************************
 
94
 * *        *  S8    D16   D24S8  D32    D32S8  *
 
95
 * **********************************************
 
96
 * * S8     *  i     i     (1)    i      (2)    *
 
97
 * * D16    *  i     i     i      i      i      *
 
98
 * * D24S8  *  i     i     (3)    i      (4)    *
 
99
 * * D32    *  i     i     i      i      i      *
 
100
 * * D32S8  *  i     i     (5)    i      (6)    *
 
101
 * **********************************************
 
102
 *
 
103
 * merge with depth pick type DS blit table
 
104
 * **********************************************
 
105
 * *        *  S8    D16   D24S8  D32    D32S8  *
 
106
 * **********************************************
 
107
 * * S8     *  i     i     i      i      i      *
 
108
 * * D16    *  -     -     -      -      -      *
 
109
 * * D24S8  *  -     -     (s)    -      -      *
 
110
 * * D32    *  -     -     (1)    -      (2)    *
 
111
 * * D32S8  *  -     -     -      -      (s)    *
 
112
 * **********************************************
 
113
 *
 
114
 * D formats are unpacked into a single register according to their format
 
115
 * S formats are unpacked into a single register in U8
 
116
 * D24S8 is in a single 32 bit register (as the PBE can't read it from
 
117
 * unpacked.)
 
118
 *
 
119
 * Swizzles are applied on the TPU not the PBE because of potential
 
120
 * accumulation i.e. a non-iterated shader doesn't know if it writes the output
 
121
 * buffer for PBE emit or a second pass blend.
 
122
 */
 
123
enum pvr_transfer_pbe_pixel_src {
 
124
   PVR_TRANSFER_PBE_PIXEL_SRC_UU8888 = 0,
 
125
   PVR_TRANSFER_PBE_PIXEL_SRC_US8888 = 1,
 
126
   PVR_TRANSFER_PBE_PIXEL_SRC_UU16U16 = 2,
 
127
   PVR_TRANSFER_PBE_PIXEL_SRC_US16S16 = 3,
 
128
   PVR_TRANSFER_PBE_PIXEL_SRC_SU8888 = 4,
 
129
   PVR_TRANSFER_PBE_PIXEL_SRC_SS8888 = 5,
 
130
   PVR_TRANSFER_PBE_PIXEL_SRC_SU16U16 = 6,
 
131
   PVR_TRANSFER_PBE_PIXEL_SRC_SS16S16 = 7,
 
132
 
 
133
   PVR_TRANSFER_PBE_PIXEL_SRC_UU1010102 = 8,
 
134
   PVR_TRANSFER_PBE_PIXEL_SRC_SU1010102 = 9,
 
135
   PVR_TRANSFER_PBE_PIXEL_SRC_RBSWAP_UU1010102 = 10,
 
136
   PVR_TRANSFER_PBE_PIXEL_SRC_RBSWAP_SU1010102 = 11,
 
137
 
 
138
   PVR_TRANSFER_PBE_PIXEL_SRC_SU32U32 = 12,
 
139
   PVR_TRANSFER_PBE_PIXEL_SRC_S4XU32 = 13,
 
140
   PVR_TRANSFER_PBE_PIXEL_SRC_US32S32 = 14,
 
141
   PVR_TRANSFER_PBE_PIXEL_SRC_U4XS32 = 15,
 
142
 
 
143
   PVR_TRANSFER_PBE_PIXEL_SRC_F16F16 = 16,
 
144
   PVR_TRANSFER_PBE_PIXEL_SRC_U16NORM = 17,
 
145
   PVR_TRANSFER_PBE_PIXEL_SRC_S16NORM = 18,
 
146
 
 
147
   PVR_TRANSFER_PBE_PIXEL_SRC_F32X4 = 19,
 
148
   PVR_TRANSFER_PBE_PIXEL_SRC_F32X2 = 20,
 
149
   PVR_TRANSFER_PBE_PIXEL_SRC_F32 = 21,
 
150
 
 
151
   PVR_TRANSFER_PBE_PIXEL_SRC_RAW32 = 22,
 
152
   PVR_TRANSFER_PBE_PIXEL_SRC_RAW64 = 23,
 
153
   PVR_TRANSFER_PBE_PIXEL_SRC_RAW128 = 24,
 
154
 
 
155
   /* f16 to U8 conversion in shader. */
 
156
   PVR_TRANSFER_PBE_PIXEL_SRC_F16_U8 = 25,
 
157
 
 
158
   PVR_TRANSFER_PBE_PIXEL_SRC_SWAP_LMSB = 26,
 
159
   PVR_TRANSFER_PBE_PIXEL_SRC_MOV_BY45 = 27,
 
160
 
 
161
   PVR_TRANSFER_PBE_PIXEL_SRC_D24S8 = 28,
 
162
   PVR_TRANSFER_PBE_PIXEL_SRC_S8D24 = 29,
 
163
   PVR_TRANSFER_PBE_PIXEL_SRC_D32S8 = 30,
 
164
 
 
165
   /* D: D32_S8 */
 
166
   PVR_TRANSFER_PBE_PIXEL_SRC_SMRG_S8_D32S8 = 31,
 
167
   PVR_TRANSFER_PBE_PIXEL_SRC_SMRG_D24S8_D32S8 = 32,
 
168
   PVR_TRANSFER_PBE_PIXEL_SRC_SMRG_D32S8_D32S8 = 33,
 
169
   PVR_TRANSFER_PBE_PIXEL_SRC_DMRG_D32S8_D32S8 = 34,
 
170
 
 
171
   /* D: D32 */
 
172
   PVR_TRANSFER_PBE_PIXEL_SRC_CONV_D24_D32 = 35,
 
173
   PVR_TRANSFER_PBE_PIXEL_SRC_CONV_D32U_D32F = 36,
 
174
 
 
175
   /* D : D24_S8 */
 
176
   PVR_TRANSFER_PBE_PIXEL_SRC_SMRG_S8_D24S8 = 37,
 
177
   PVR_TRANSFER_PBE_PIXEL_SRC_SMRG_D24S8_D24S8 = 38,
 
178
   PVR_TRANSFER_PBE_PIXEL_SRC_DMRG_D24S8_D24S8 = 39,
 
179
   PVR_TRANSFER_PBE_PIXEL_SRC_CONV_D32_D24S8 = 40,
 
180
   PVR_TRANSFER_PBE_PIXEL_SRC_DMRG_D32_D24S8 = 41,
 
181
   PVR_TRANSFER_PBE_PIXEL_SRC_DMRG_D32U_D24S8 = 42,
 
182
 
 
183
   /* ob0 holds Y and ob0 holds U or V. */
 
184
   PVR_TRANSFER_PBE_PIXEL_SRC_YUV_PACKED = 43,
 
185
 
 
186
   /* ob0 holds Y, ob1 holds U, ob2 holds V. */
 
187
   PVR_TRANSFER_PBE_PIXEL_SRC_Y_U_V = 44,
 
188
 
 
189
   PVR_TRANSFER_PBE_PIXEL_SRC_MASK16 = 45,
 
190
   PVR_TRANSFER_PBE_PIXEL_SRC_MASK32 = 46,
 
191
   PVR_TRANSFER_PBE_PIXEL_SRC_MASK48 = 47,
 
192
   PVR_TRANSFER_PBE_PIXEL_SRC_MASK64 = 48,
 
193
   PVR_TRANSFER_PBE_PIXEL_SRC_MASK96 = 49,
 
194
   PVR_TRANSFER_PBE_PIXEL_SRC_MASK128 = 50,
 
195
 
 
196
   PVR_TRANSFER_PBE_PIXEL_SRC_CONV_S8D24_D24S8 = 51,
 
197
 
 
198
   /* ob0 holds Y and ob0 holds V or U. */
 
199
   PVR_TRANSFER_PBE_PIXEL_SRC_YVU_PACKED = 52,
 
200
 
 
201
   /* ob0 holds Y, ob1 holds UV interleaved. */
 
202
   PVR_TRANSFER_PBE_PIXEL_SRC_Y_UV_INTERLEAVED = 53,
 
203
 
 
204
   /* FIXME: This changes for other BVNC's which may change the hashing logic
 
205
    * in pvr_hash_shader.
 
206
    */
 
207
   PVR_TRANSFER_PBE_PIXEL_SRC_NUM = 54,
 
208
};
 
209
 
60
210
const uint8_t *pvr_get_format_swizzle(VkFormat vk_format);
61
211
uint32_t pvr_get_tex_format(VkFormat vk_format);
62
212
uint32_t pvr_get_tex_format_aspect(VkFormat vk_format,
70
220
                            VkClearColorValue value,
71
221
                            uint32_t packed_out[static const 4]);
72
222
 
 
223
uint32_t pvr_pbe_pixel_num_loads(enum pvr_transfer_pbe_pixel_src pbe_format);
 
224
 
73
225
#endif /* PVR_FORMATS_H */