4cb04373e00d450a23fe83798de2fb3764e422f1
[mesa.git] / src / compiler / nir / nir_intrinsics.h
1 /*
2 * Copyright © 2014 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 * Authors:
24 * Connor Abbott (cwabbott0@gmail.com)
25 *
26 */
27
28 /**
29 * This header file defines all the available intrinsics in one place. It
30 * expands to a list of macros of the form:
31 *
32 * INTRINSIC(name, num_srcs, src_components, has_dest, dest_components,
33 * num_variables, num_indices, idx0, idx1, idx2, flags)
34 *
35 * Which should correspond one-to-one with the nir_intrinsic_info structure. It
36 * is included in both ir.h to create the nir_intrinsic enum (with members of
37 * the form nir_intrinsic_(name)) and and in opcodes.c to create
38 * nir_intrinsic_infos, which is a const array of nir_intrinsic_info structures
39 * for each intrinsic.
40 */
41
42 #define ARR(...) { __VA_ARGS__ }
43
44 INTRINSIC(load_var, 0, ARR(0), true, 0, 1, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
45 INTRINSIC(store_var, 1, ARR(0), false, 0, 1, 1, WRMASK, xx, xx, 0)
46 INTRINSIC(copy_var, 0, ARR(0), false, 0, 2, 0, xx, xx, xx, 0)
47
48 /*
49 * Interpolation of input. The interp_var_at* intrinsics are similar to the
50 * load_var intrinsic acting on a shader input except that they interpolate
51 * the input differently. The at_sample and at_offset intrinsics take an
52 * additional source that is an integer sample id or a vec2 position offset
53 * respectively.
54 */
55
56 INTRINSIC(interp_var_at_centroid, 0, ARR(0), true, 0, 1, 0, xx, xx, xx,
57 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
58 INTRINSIC(interp_var_at_sample, 1, ARR(1), true, 0, 1, 0, xx, xx, xx,
59 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
60 INTRINSIC(interp_var_at_offset, 1, ARR(2), true, 0, 1, 0, xx, xx, xx,
61 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
62
63 /*
64 * Ask the driver for the size of a given buffer. It takes the buffer index
65 * as source.
66 */
67 INTRINSIC(get_buffer_size, 1, ARR(1), true, 1, 0, 0, xx, xx, xx,
68 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
69
70 /*
71 * a barrier is an intrinsic with no inputs/outputs but which can't be moved
72 * around/optimized in general
73 */
74 #define BARRIER(name) INTRINSIC(name, 0, ARR(0), false, 0, 0, 0, xx, xx, xx, 0)
75
76 BARRIER(barrier)
77 BARRIER(discard)
78
79 /*
80 * Memory barrier with semantics analogous to the memoryBarrier() GLSL
81 * intrinsic.
82 */
83 BARRIER(memory_barrier)
84
85 /*
86 * Shader clock intrinsic with semantics analogous to the clock2x32ARB()
87 * GLSL intrinsic.
88 * The latter can be used as code motion barrier, which is currently not
89 * feasible with NIR.
90 */
91 INTRINSIC(shader_clock, 0, ARR(0), true, 1, 0, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
92
93 /*
94 * Memory barrier with semantics analogous to the compute shader
95 * groupMemoryBarrier(), memoryBarrierAtomicCounter(), memoryBarrierBuffer(),
96 * memoryBarrierImage() and memoryBarrierShared() GLSL intrinsics.
97 */
98 BARRIER(group_memory_barrier)
99 BARRIER(memory_barrier_atomic_counter)
100 BARRIER(memory_barrier_buffer)
101 BARRIER(memory_barrier_image)
102 BARRIER(memory_barrier_shared)
103
104 /** A conditional discard, with a single boolean source. */
105 INTRINSIC(discard_if, 1, ARR(1), false, 0, 0, 0, xx, xx, xx, 0)
106
107 /**
108 * Basic Geometry Shader intrinsics.
109 *
110 * emit_vertex implements GLSL's EmitStreamVertex() built-in. It takes a single
111 * index, which is the stream ID to write to.
112 *
113 * end_primitive implements GLSL's EndPrimitive() built-in.
114 */
115 INTRINSIC(emit_vertex, 0, ARR(0), false, 0, 0, 1, STREAM_ID, xx, xx, 0)
116 INTRINSIC(end_primitive, 0, ARR(0), false, 0, 0, 1, STREAM_ID, xx, xx, 0)
117
118 /**
119 * Geometry Shader intrinsics with a vertex count.
120 *
121 * Alternatively, drivers may implement these intrinsics, and use
122 * nir_lower_gs_intrinsics() to convert from the basic intrinsics.
123 *
124 * These maintain a count of the number of vertices emitted, as an additional
125 * unsigned integer source.
126 */
127 INTRINSIC(emit_vertex_with_counter, 1, ARR(1), false, 0, 0, 1, STREAM_ID, xx, xx, 0)
128 INTRINSIC(end_primitive_with_counter, 1, ARR(1), false, 0, 0, 1, STREAM_ID, xx, xx, 0)
129 INTRINSIC(set_vertex_count, 1, ARR(1), false, 0, 0, 0, xx, xx, xx, 0)
130
131 /*
132 * Atomic counters
133 *
134 * The *_var variants take an atomic_uint nir_variable, while the other,
135 * lowered, variants take a constant buffer index and register offset.
136 */
137
138 #define ATOMIC(name, flags) \
139 INTRINSIC(atomic_counter_##name##_var, 0, ARR(0), true, 1, 1, 0, xx, xx, xx, flags) \
140 INTRINSIC(atomic_counter_##name, 1, ARR(1), true, 1, 0, 1, BASE, xx, xx, flags)
141
142 ATOMIC(inc, 0)
143 ATOMIC(dec, 0)
144 ATOMIC(read, NIR_INTRINSIC_CAN_ELIMINATE)
145
146 /*
147 * Image load, store and atomic intrinsics.
148 *
149 * All image intrinsics take an image target passed as a nir_variable. Image
150 * variables contain a number of memory and layout qualifiers that influence
151 * the semantics of the intrinsic.
152 *
153 * All image intrinsics take a four-coordinate vector and a sample index as
154 * first two sources, determining the location within the image that will be
155 * accessed by the intrinsic. Components not applicable to the image target
156 * in use are undefined. Image store takes an additional four-component
157 * argument with the value to be written, and image atomic operations take
158 * either one or two additional scalar arguments with the same meaning as in
159 * the ARB_shader_image_load_store specification.
160 */
161 INTRINSIC(image_load, 2, ARR(4, 1), true, 4, 1, 0, xx, xx, xx,
162 NIR_INTRINSIC_CAN_ELIMINATE)
163 INTRINSIC(image_store, 3, ARR(4, 1, 4), false, 0, 1, 0, xx, xx, xx, 0)
164 INTRINSIC(image_atomic_add, 3, ARR(4, 1, 1), true, 1, 1, 0, xx, xx, xx, 0)
165 INTRINSIC(image_atomic_min, 3, ARR(4, 1, 1), true, 1, 1, 0, xx, xx, xx, 0)
166 INTRINSIC(image_atomic_max, 3, ARR(4, 1, 1), true, 1, 1, 0, xx, xx, xx, 0)
167 INTRINSIC(image_atomic_and, 3, ARR(4, 1, 1), true, 1, 1, 0, xx, xx, xx, 0)
168 INTRINSIC(image_atomic_or, 3, ARR(4, 1, 1), true, 1, 1, 0, xx, xx, xx, 0)
169 INTRINSIC(image_atomic_xor, 3, ARR(4, 1, 1), true, 1, 1, 0, xx, xx, xx, 0)
170 INTRINSIC(image_atomic_exchange, 3, ARR(4, 1, 1), true, 1, 1, 0, xx, xx, xx, 0)
171 INTRINSIC(image_atomic_comp_swap, 4, ARR(4, 1, 1, 1), true, 1, 1, 0, xx, xx, xx, 0)
172 INTRINSIC(image_size, 0, ARR(0), true, 4, 1, 0, xx, xx, xx,
173 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
174 INTRINSIC(image_samples, 0, ARR(0), true, 1, 1, 0, xx, xx, xx,
175 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
176
177 /*
178 * Vulkan descriptor set intrinsic
179 *
180 * The Vulkan API uses a different binding model from GL. In the Vulkan
181 * API, all external resources are represented by a tuple:
182 *
183 * (descriptor set, binding, array index)
184 *
185 * where the array index is the only thing allowed to be indirect. The
186 * vulkan_surface_index intrinsic takes the descriptor set and binding as
187 * its first two indices and the array index as its source. The third
188 * index is a nir_variable_mode in case that's useful to the backend.
189 *
190 * The intended usage is that the shader will call vulkan_surface_index to
191 * get an index and then pass that as the buffer index ubo/ssbo calls.
192 */
193 INTRINSIC(vulkan_resource_index, 1, ARR(1), true, 1, 0, 2,
194 DESC_SET, BINDING, xx,
195 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
196
197 /*
198 * variable atomic intrinsics
199 *
200 * All of these variable atomic memory operations read a value from memory,
201 * compute a new value using one of the operations below, write the new value
202 * to memory, and return the original value read.
203 *
204 * All operations take 1 source except CompSwap that takes 2. These sources
205 * represent:
206 *
207 * 0: The data parameter to the atomic function (i.e. the value to add
208 * in shared_atomic_add, etc).
209 * 1: For CompSwap only: the second data parameter.
210 *
211 * All operations take 1 variable deref.
212 */
213 INTRINSIC(var_atomic_add, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, 0)
214 INTRINSIC(var_atomic_imin, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, 0)
215 INTRINSIC(var_atomic_umin, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, 0)
216 INTRINSIC(var_atomic_imax, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, 0)
217 INTRINSIC(var_atomic_umax, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, 0)
218 INTRINSIC(var_atomic_and, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, 0)
219 INTRINSIC(var_atomic_or, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, 0)
220 INTRINSIC(var_atomic_xor, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, 0)
221 INTRINSIC(var_atomic_exchange, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, 0)
222 INTRINSIC(var_atomic_comp_swap, 2, ARR(1, 1), true, 1, 1, 0, xx, xx, xx, 0)
223
224 /*
225 * SSBO atomic intrinsics
226 *
227 * All of the SSBO atomic memory operations read a value from memory,
228 * compute a new value using one of the operations below, write the new
229 * value to memory, and return the original value read.
230 *
231 * All operations take 3 sources except CompSwap that takes 4. These
232 * sources represent:
233 *
234 * 0: The SSBO buffer index.
235 * 1: The offset into the SSBO buffer of the variable that the atomic
236 * operation will operate on.
237 * 2: The data parameter to the atomic function (i.e. the value to add
238 * in ssbo_atomic_add, etc).
239 * 3: For CompSwap only: the second data parameter.
240 */
241 INTRINSIC(ssbo_atomic_add, 3, ARR(1, 1, 1), true, 1, 0, 0, xx, xx, xx, 0)
242 INTRINSIC(ssbo_atomic_imin, 3, ARR(1, 1, 1), true, 1, 0, 0, xx, xx, xx, 0)
243 INTRINSIC(ssbo_atomic_umin, 3, ARR(1, 1, 1), true, 1, 0, 0, xx, xx, xx, 0)
244 INTRINSIC(ssbo_atomic_imax, 3, ARR(1, 1, 1), true, 1, 0, 0, xx, xx, xx, 0)
245 INTRINSIC(ssbo_atomic_umax, 3, ARR(1, 1, 1), true, 1, 0, 0, xx, xx, xx, 0)
246 INTRINSIC(ssbo_atomic_and, 3, ARR(1, 1, 1), true, 1, 0, 0, xx, xx, xx, 0)
247 INTRINSIC(ssbo_atomic_or, 3, ARR(1, 1, 1), true, 1, 0, 0, xx, xx, xx, 0)
248 INTRINSIC(ssbo_atomic_xor, 3, ARR(1, 1, 1), true, 1, 0, 0, xx, xx, xx, 0)
249 INTRINSIC(ssbo_atomic_exchange, 3, ARR(1, 1, 1), true, 1, 0, 0, xx, xx, xx, 0)
250 INTRINSIC(ssbo_atomic_comp_swap, 4, ARR(1, 1, 1, 1), true, 1, 0, 0, xx, xx, xx, 0)
251
252 /*
253 * CS shared variable atomic intrinsics
254 *
255 * All of the shared variable atomic memory operations read a value from
256 * memory, compute a new value using one of the operations below, write the
257 * new value to memory, and return the original value read.
258 *
259 * All operations take 2 sources except CompSwap that takes 3. These
260 * sources represent:
261 *
262 * 0: The offset into the shared variable storage region that the atomic
263 * operation will operate on.
264 * 1: The data parameter to the atomic function (i.e. the value to add
265 * in shared_atomic_add, etc).
266 * 2: For CompSwap only: the second data parameter.
267 */
268 INTRINSIC(shared_atomic_add, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
269 INTRINSIC(shared_atomic_imin, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
270 INTRINSIC(shared_atomic_umin, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
271 INTRINSIC(shared_atomic_imax, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
272 INTRINSIC(shared_atomic_umax, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
273 INTRINSIC(shared_atomic_and, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
274 INTRINSIC(shared_atomic_or, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
275 INTRINSIC(shared_atomic_xor, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
276 INTRINSIC(shared_atomic_exchange, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
277 INTRINSIC(shared_atomic_comp_swap, 3, ARR(1, 1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
278
279 /* Used by nir_builder.h to generate loader helpers for the system values. */
280 #ifndef DEFINE_SYSTEM_VALUE
281 #define DEFINE_SYSTEM_VALUE(name)
282 #endif
283
284 #define SYSTEM_VALUE(name, components, num_indices, idx0, idx1, idx2) \
285 DEFINE_SYSTEM_VALUE(name) \
286 INTRINSIC(load_##name, 0, ARR(0), true, components, 0, num_indices, \
287 idx0, idx1, idx2, \
288 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
289
290 SYSTEM_VALUE(front_face, 1, 0, xx, xx, xx)
291 SYSTEM_VALUE(vertex_id, 1, 0, xx, xx, xx)
292 SYSTEM_VALUE(vertex_id_zero_base, 1, 0, xx, xx, xx)
293 SYSTEM_VALUE(base_vertex, 1, 0, xx, xx, xx)
294 SYSTEM_VALUE(instance_id, 1, 0, xx, xx, xx)
295 SYSTEM_VALUE(base_instance, 1, 0, xx, xx, xx)
296 SYSTEM_VALUE(draw_id, 1, 0, xx, xx, xx)
297 SYSTEM_VALUE(sample_id, 1, 0, xx, xx, xx)
298 SYSTEM_VALUE(sample_pos, 2, 0, xx, xx, xx)
299 SYSTEM_VALUE(sample_mask_in, 1, 0, xx, xx, xx)
300 SYSTEM_VALUE(primitive_id, 1, 0, xx, xx, xx)
301 SYSTEM_VALUE(invocation_id, 1, 0, xx, xx, xx)
302 SYSTEM_VALUE(tess_coord, 3, 0, xx, xx, xx)
303 SYSTEM_VALUE(tess_level_outer, 4, 0, xx, xx, xx)
304 SYSTEM_VALUE(tess_level_inner, 2, 0, xx, xx, xx)
305 SYSTEM_VALUE(patch_vertices_in, 1, 0, xx, xx, xx)
306 SYSTEM_VALUE(local_invocation_id, 3, 0, xx, xx, xx)
307 SYSTEM_VALUE(local_invocation_index, 1, 0, xx, xx, xx)
308 SYSTEM_VALUE(work_group_id, 3, 0, xx, xx, xx)
309 SYSTEM_VALUE(user_clip_plane, 4, 1, UCP_ID, xx, xx)
310 SYSTEM_VALUE(num_work_groups, 3, 0, xx, xx, xx)
311 SYSTEM_VALUE(helper_invocation, 1, 0, xx, xx, xx)
312 SYSTEM_VALUE(channel_num, 1, 0, xx, xx, xx)
313
314 /**
315 * Barycentric coordinate intrinsics.
316 *
317 * These set up the barycentric coordinates for a particular interpolation.
318 * The first three are for the simple cases: pixel, centroid, or per-sample
319 * (at gl_SampleID). The next two handle interpolating at a specified
320 * sample location, or interpolating with a vec2 offset,
321 *
322 * The interp_mode index should be either the INTERP_MODE_SMOOTH or
323 * INTERP_MODE_NOPERSPECTIVE enum values.
324 *
325 * The vec2 value produced by these intrinsics is intended for use as the
326 * barycoord source of a load_interpolated_input intrinsic.
327 */
328
329 #define BARYCENTRIC(name, sources, source_components) \
330 INTRINSIC(load_barycentric_##name, sources, ARR(source_components), \
331 true, 2, 0, 1, INTERP_MODE, xx, xx, \
332 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
333
334 /* no sources. const_index[] = { interp_mode } */
335 BARYCENTRIC(pixel, 0, 0)
336 BARYCENTRIC(centroid, 0, 0)
337 BARYCENTRIC(sample, 0, 0)
338 /* src[] = { sample_id }. const_index[] = { interp_mode } */
339 BARYCENTRIC(at_sample, 1, 1)
340 /* src[] = { offset.xy }. const_index[] = { interp_mode } */
341 BARYCENTRIC(at_offset, 1, 2)
342
343 /*
344 * Load operations pull data from some piece of GPU memory. All load
345 * operations operate in terms of offsets into some piece of theoretical
346 * memory. Loads from externally visible memory (UBO and SSBO) simply take a
347 * byte offset as a source. Loads from opaque memory (uniforms, inputs, etc.)
348 * take a base+offset pair where the base (const_index[0]) gives the location
349 * of the start of the variable being loaded and and the offset source is a
350 * offset into that variable.
351 *
352 * Uniform load operations have a second "range" index that specifies the
353 * range (starting at base) of the data from which we are loading. If
354 * const_index[1] == 0, then the range is unknown.
355 *
356 * Some load operations such as UBO/SSBO load and per_vertex loads take an
357 * additional source to specify which UBO/SSBO/vertex to load from.
358 *
359 * The exact address type depends on the lowering pass that generates the
360 * load/store intrinsics. Typically, this is vec4 units for things such as
361 * varying slots and float units for fragment shader inputs. UBO and SSBO
362 * offsets are always in bytes.
363 */
364
365 #define LOAD(name, srcs, num_indices, idx0, idx1, idx2, flags) \
366 INTRINSIC(load_##name, srcs, ARR(1, 1, 1, 1), true, 0, 0, num_indices, idx0, idx1, idx2, flags)
367
368 /* src[] = { offset }. const_index[] = { base, range } */
369 LOAD(uniform, 1, 2, BASE, RANGE, xx, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
370 /* src[] = { buffer_index, offset }. No const_index */
371 LOAD(ubo, 2, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
372 /* src[] = { offset }. const_index[] = { base, component } */
373 LOAD(input, 1, 2, BASE, COMPONENT, xx, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
374 /* src[] = { vertex, offset }. const_index[] = { base, component } */
375 LOAD(per_vertex_input, 2, 2, BASE, COMPONENT, xx, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
376 /* src[] = { barycoord, offset }. const_index[] = { base, component } */
377 LOAD(interpolated_input, 2, 2, BASE, COMPONENT, xx, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
378
379 /* src[] = { buffer_index, offset }. No const_index */
380 LOAD(ssbo, 2, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
381 /* src[] = { offset }. const_index[] = { base, component } */
382 LOAD(output, 1, 1, BASE, COMPONENT, xx, NIR_INTRINSIC_CAN_ELIMINATE)
383 /* src[] = { vertex, offset }. const_index[] = { base, component } */
384 LOAD(per_vertex_output, 2, 1, BASE, COMPONENT, xx, NIR_INTRINSIC_CAN_ELIMINATE)
385 /* src[] = { offset }. const_index[] = { base } */
386 LOAD(shared, 1, 1, BASE, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
387 /* src[] = { offset }. const_index[] = { base, range } */
388 LOAD(push_constant, 1, 2, BASE, RANGE, xx,
389 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
390
391 /*
392 * Stores work the same way as loads, except now the first source is the value
393 * to store and the second (and possibly third) source specify where to store
394 * the value. SSBO and shared memory stores also have a write mask as
395 * const_index[0].
396 */
397
398 #define STORE(name, srcs, num_indices, idx0, idx1, idx2, flags) \
399 INTRINSIC(store_##name, srcs, ARR(0, 1, 1, 1), false, 0, 0, num_indices, idx0, idx1, idx2, flags)
400
401 /* src[] = { value, offset }. const_index[] = { base, write_mask, component } */
402 STORE(output, 2, 3, BASE, WRMASK, COMPONENT, 0)
403 /* src[] = { value, vertex, offset }.
404 * const_index[] = { base, write_mask, component }
405 */
406 STORE(per_vertex_output, 3, 3, BASE, WRMASK, COMPONENT, 0)
407 /* src[] = { value, block_index, offset }. const_index[] = { write_mask } */
408 STORE(ssbo, 3, 1, WRMASK, xx, xx, 0)
409 /* src[] = { value, offset }. const_index[] = { base, write_mask } */
410 STORE(shared, 2, 2, BASE, WRMASK, xx, 0)
411
412 LAST_INTRINSIC(store_shared)
413
414 #undef DEFINE_SYSTEM_VALUE
415 #undef INTRINSIC
416 #undef LAST_INTRINSIC