2 * Copyright © 2014 Intel Corporation
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:
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
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
24 * Connor Abbott (cwabbott0@gmail.com)
29 * This header file defines all the available intrinsics in one place. It
30 * expands to a list of macros of the form:
32 * INTRINSIC(name, num_srcs, src_components, has_dest, dest_components,
33 * num_variables, num_indices, idx0, idx1, idx2, flags)
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
42 #define ARR(...) { __VA_ARGS__ }
44 INTRINSIC(nop
, 0, ARR(0), false, 0, 0, 0, xx
, xx
, xx
,
45 NIR_INTRINSIC_CAN_ELIMINATE
)
47 INTRINSIC(load_var
, 0, ARR(0), true, 0, 1, 0, xx
, xx
, xx
, NIR_INTRINSIC_CAN_ELIMINATE
)
48 INTRINSIC(store_var
, 1, ARR(0), false, 0, 1, 1, WRMASK
, xx
, xx
, 0)
49 INTRINSIC(copy_var
, 0, ARR(0), false, 0, 2, 0, xx
, xx
, xx
, 0)
52 * Interpolation of input. The interp_var_at* intrinsics are similar to the
53 * load_var intrinsic acting on a shader input except that they interpolate
54 * the input differently. The at_sample and at_offset intrinsics take an
55 * additional source that is an integer sample id or a vec2 position offset
59 INTRINSIC(interp_var_at_centroid
, 0, ARR(0), true, 0, 1, 0, xx
, xx
, xx
,
60 NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
61 INTRINSIC(interp_var_at_sample
, 1, ARR(1), true, 0, 1, 0, xx
, xx
, xx
,
62 NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
63 INTRINSIC(interp_var_at_offset
, 1, ARR(2), true, 0, 1, 0, xx
, xx
, xx
,
64 NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
67 * Ask the driver for the size of a given buffer. It takes the buffer index
70 INTRINSIC(get_buffer_size
, 1, ARR(1), true, 1, 0, 0, xx
, xx
, xx
,
71 NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
74 * a barrier is an intrinsic with no inputs/outputs but which can't be moved
75 * around/optimized in general
77 #define BARRIER(name) INTRINSIC(name, 0, ARR(0), false, 0, 0, 0, xx, xx, xx, 0)
83 * Memory barrier with semantics analogous to the memoryBarrier() GLSL
86 BARRIER(memory_barrier
)
89 * Shader clock intrinsic with semantics analogous to the clock2x32ARB()
91 * The latter can be used as code motion barrier, which is currently not
94 INTRINSIC(shader_clock
, 0, ARR(0), true, 2, 0, 0, xx
, xx
, xx
, NIR_INTRINSIC_CAN_ELIMINATE
)
97 * Memory barrier with semantics analogous to the compute shader
98 * groupMemoryBarrier(), memoryBarrierAtomicCounter(), memoryBarrierBuffer(),
99 * memoryBarrierImage() and memoryBarrierShared() GLSL intrinsics.
101 BARRIER(group_memory_barrier
)
102 BARRIER(memory_barrier_atomic_counter
)
103 BARRIER(memory_barrier_buffer
)
104 BARRIER(memory_barrier_image
)
105 BARRIER(memory_barrier_shared
)
107 /** A conditional discard, with a single boolean source. */
108 INTRINSIC(discard_if
, 1, ARR(1), false, 0, 0, 0, xx
, xx
, xx
, 0)
111 * Basic Geometry Shader intrinsics.
113 * emit_vertex implements GLSL's EmitStreamVertex() built-in. It takes a single
114 * index, which is the stream ID to write to.
116 * end_primitive implements GLSL's EndPrimitive() built-in.
118 INTRINSIC(emit_vertex
, 0, ARR(0), false, 0, 0, 1, STREAM_ID
, xx
, xx
, 0)
119 INTRINSIC(end_primitive
, 0, ARR(0), false, 0, 0, 1, STREAM_ID
, xx
, xx
, 0)
122 * Geometry Shader intrinsics with a vertex count.
124 * Alternatively, drivers may implement these intrinsics, and use
125 * nir_lower_gs_intrinsics() to convert from the basic intrinsics.
127 * These maintain a count of the number of vertices emitted, as an additional
128 * unsigned integer source.
130 INTRINSIC(emit_vertex_with_counter
, 1, ARR(1), false, 0, 0, 1, STREAM_ID
, xx
, xx
, 0)
131 INTRINSIC(end_primitive_with_counter
, 1, ARR(1), false, 0, 0, 1, STREAM_ID
, xx
, xx
, 0)
132 INTRINSIC(set_vertex_count
, 1, ARR(1), false, 0, 0, 0, xx
, xx
, xx
, 0)
137 * The *_var variants take an atomic_uint nir_variable, while the other,
138 * lowered, variants take a constant buffer index and register offset.
141 #define ATOMIC(name, flags) \
142 INTRINSIC(name##_var, 0, ARR(0), true, 1, 1, 0, xx, xx, xx, flags) \
143 INTRINSIC(name, 1, ARR(1), true, 1, 0, 1, BASE, xx, xx, flags)
144 #define ATOMIC2(name) \
145 INTRINSIC(name##_var, 1, ARR(1), true, 1, 1, 0, xx, xx, xx, 0) \
146 INTRINSIC(name, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
147 #define ATOMIC3(name) \
148 INTRINSIC(name##_var, 2, ARR(1, 1), true, 1, 1, 0, xx, xx, xx, 0) \
149 INTRINSIC(name, 3, ARR(1, 1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
151 ATOMIC(atomic_counter_inc
, 0)
152 ATOMIC(atomic_counter_dec
, 0)
153 ATOMIC(atomic_counter_read
, NIR_INTRINSIC_CAN_ELIMINATE
)
154 ATOMIC2(atomic_counter_add
)
155 ATOMIC2(atomic_counter_min
)
156 ATOMIC2(atomic_counter_max
)
157 ATOMIC2(atomic_counter_and
)
158 ATOMIC2(atomic_counter_or
)
159 ATOMIC2(atomic_counter_xor
)
160 ATOMIC2(atomic_counter_exchange
)
161 ATOMIC3(atomic_counter_comp_swap
)
164 * Image load, store and atomic intrinsics.
166 * All image intrinsics take an image target passed as a nir_variable. Image
167 * variables contain a number of memory and layout qualifiers that influence
168 * the semantics of the intrinsic.
170 * All image intrinsics take a four-coordinate vector and a sample index as
171 * first two sources, determining the location within the image that will be
172 * accessed by the intrinsic. Components not applicable to the image target
173 * in use are undefined. Image store takes an additional four-component
174 * argument with the value to be written, and image atomic operations take
175 * either one or two additional scalar arguments with the same meaning as in
176 * the ARB_shader_image_load_store specification.
178 INTRINSIC(image_load
, 2, ARR(4, 1), true, 4, 1, 0, xx
, xx
, xx
,
179 NIR_INTRINSIC_CAN_ELIMINATE
)
180 INTRINSIC(image_store
, 3, ARR(4, 1, 4), false, 0, 1, 0, xx
, xx
, xx
, 0)
181 INTRINSIC(image_atomic_add
, 3, ARR(4, 1, 1), true, 1, 1, 0, xx
, xx
, xx
, 0)
182 INTRINSIC(image_atomic_min
, 3, ARR(4, 1, 1), true, 1, 1, 0, xx
, xx
, xx
, 0)
183 INTRINSIC(image_atomic_max
, 3, ARR(4, 1, 1), true, 1, 1, 0, xx
, xx
, xx
, 0)
184 INTRINSIC(image_atomic_and
, 3, ARR(4, 1, 1), true, 1, 1, 0, xx
, xx
, xx
, 0)
185 INTRINSIC(image_atomic_or
, 3, ARR(4, 1, 1), true, 1, 1, 0, xx
, xx
, xx
, 0)
186 INTRINSIC(image_atomic_xor
, 3, ARR(4, 1, 1), true, 1, 1, 0, xx
, xx
, xx
, 0)
187 INTRINSIC(image_atomic_exchange
, 3, ARR(4, 1, 1), true, 1, 1, 0, xx
, xx
, xx
, 0)
188 INTRINSIC(image_atomic_comp_swap
, 4, ARR(4, 1, 1, 1), true, 1, 1, 0, xx
, xx
, xx
, 0)
189 INTRINSIC(image_size
, 0, ARR(0), true, 0, 1, 0, xx
, xx
, xx
,
190 NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
191 INTRINSIC(image_samples
, 0, ARR(0), true, 1, 1, 0, xx
, xx
, xx
,
192 NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
195 * Vulkan descriptor set intrinsic
197 * The Vulkan API uses a different binding model from GL. In the Vulkan
198 * API, all external resources are represented by a tuple:
200 * (descriptor set, binding, array index)
202 * where the array index is the only thing allowed to be indirect. The
203 * vulkan_surface_index intrinsic takes the descriptor set and binding as
204 * its first two indices and the array index as its source. The third
205 * index is a nir_variable_mode in case that's useful to the backend.
207 * The intended usage is that the shader will call vulkan_surface_index to
208 * get an index and then pass that as the buffer index ubo/ssbo calls.
210 INTRINSIC(vulkan_resource_index
, 1, ARR(1), true, 1, 0, 2,
211 DESC_SET
, BINDING
, xx
,
212 NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
215 * variable atomic intrinsics
217 * All of these variable atomic memory operations read a value from memory,
218 * compute a new value using one of the operations below, write the new value
219 * to memory, and return the original value read.
221 * All operations take 1 source except CompSwap that takes 2. These sources
224 * 0: The data parameter to the atomic function (i.e. the value to add
225 * in shared_atomic_add, etc).
226 * 1: For CompSwap only: the second data parameter.
228 * All operations take 1 variable deref.
230 INTRINSIC(var_atomic_add
, 1, ARR(1), true, 1, 1, 0, xx
, xx
, xx
, 0)
231 INTRINSIC(var_atomic_imin
, 1, ARR(1), true, 1, 1, 0, xx
, xx
, xx
, 0)
232 INTRINSIC(var_atomic_umin
, 1, ARR(1), true, 1, 1, 0, xx
, xx
, xx
, 0)
233 INTRINSIC(var_atomic_imax
, 1, ARR(1), true, 1, 1, 0, xx
, xx
, xx
, 0)
234 INTRINSIC(var_atomic_umax
, 1, ARR(1), true, 1, 1, 0, xx
, xx
, xx
, 0)
235 INTRINSIC(var_atomic_and
, 1, ARR(1), true, 1, 1, 0, xx
, xx
, xx
, 0)
236 INTRINSIC(var_atomic_or
, 1, ARR(1), true, 1, 1, 0, xx
, xx
, xx
, 0)
237 INTRINSIC(var_atomic_xor
, 1, ARR(1), true, 1, 1, 0, xx
, xx
, xx
, 0)
238 INTRINSIC(var_atomic_exchange
, 1, ARR(1), true, 1, 1, 0, xx
, xx
, xx
, 0)
239 INTRINSIC(var_atomic_comp_swap
, 2, ARR(1, 1), true, 1, 1, 0, xx
, xx
, xx
, 0)
242 * SSBO atomic intrinsics
244 * All of the SSBO atomic memory operations read a value from memory,
245 * compute a new value using one of the operations below, write the new
246 * value to memory, and return the original value read.
248 * All operations take 3 sources except CompSwap that takes 4. These
251 * 0: The SSBO buffer index.
252 * 1: The offset into the SSBO buffer of the variable that the atomic
253 * operation will operate on.
254 * 2: The data parameter to the atomic function (i.e. the value to add
255 * in ssbo_atomic_add, etc).
256 * 3: For CompSwap only: the second data parameter.
258 INTRINSIC(ssbo_atomic_add
, 3, ARR(1, 1, 1), true, 1, 0, 0, xx
, xx
, xx
, 0)
259 INTRINSIC(ssbo_atomic_imin
, 3, ARR(1, 1, 1), true, 1, 0, 0, xx
, xx
, xx
, 0)
260 INTRINSIC(ssbo_atomic_umin
, 3, ARR(1, 1, 1), true, 1, 0, 0, xx
, xx
, xx
, 0)
261 INTRINSIC(ssbo_atomic_imax
, 3, ARR(1, 1, 1), true, 1, 0, 0, xx
, xx
, xx
, 0)
262 INTRINSIC(ssbo_atomic_umax
, 3, ARR(1, 1, 1), true, 1, 0, 0, xx
, xx
, xx
, 0)
263 INTRINSIC(ssbo_atomic_and
, 3, ARR(1, 1, 1), true, 1, 0, 0, xx
, xx
, xx
, 0)
264 INTRINSIC(ssbo_atomic_or
, 3, ARR(1, 1, 1), true, 1, 0, 0, xx
, xx
, xx
, 0)
265 INTRINSIC(ssbo_atomic_xor
, 3, ARR(1, 1, 1), true, 1, 0, 0, xx
, xx
, xx
, 0)
266 INTRINSIC(ssbo_atomic_exchange
, 3, ARR(1, 1, 1), true, 1, 0, 0, xx
, xx
, xx
, 0)
267 INTRINSIC(ssbo_atomic_comp_swap
, 4, ARR(1, 1, 1, 1), true, 1, 0, 0, xx
, xx
, xx
, 0)
270 * CS shared variable atomic intrinsics
272 * All of the shared variable atomic memory operations read a value from
273 * memory, compute a new value using one of the operations below, write the
274 * new value to memory, and return the original value read.
276 * All operations take 2 sources except CompSwap that takes 3. These
279 * 0: The offset into the shared variable storage region that the atomic
280 * operation will operate on.
281 * 1: The data parameter to the atomic function (i.e. the value to add
282 * in shared_atomic_add, etc).
283 * 2: For CompSwap only: the second data parameter.
285 INTRINSIC(shared_atomic_add
, 2, ARR(1, 1), true, 1, 0, 1, BASE
, xx
, xx
, 0)
286 INTRINSIC(shared_atomic_imin
, 2, ARR(1, 1), true, 1, 0, 1, BASE
, xx
, xx
, 0)
287 INTRINSIC(shared_atomic_umin
, 2, ARR(1, 1), true, 1, 0, 1, BASE
, xx
, xx
, 0)
288 INTRINSIC(shared_atomic_imax
, 2, ARR(1, 1), true, 1, 0, 1, BASE
, xx
, xx
, 0)
289 INTRINSIC(shared_atomic_umax
, 2, ARR(1, 1), true, 1, 0, 1, BASE
, xx
, xx
, 0)
290 INTRINSIC(shared_atomic_and
, 2, ARR(1, 1), true, 1, 0, 1, BASE
, xx
, xx
, 0)
291 INTRINSIC(shared_atomic_or
, 2, ARR(1, 1), true, 1, 0, 1, BASE
, xx
, xx
, 0)
292 INTRINSIC(shared_atomic_xor
, 2, ARR(1, 1), true, 1, 0, 1, BASE
, xx
, xx
, 0)
293 INTRINSIC(shared_atomic_exchange
, 2, ARR(1, 1), true, 1, 0, 1, BASE
, xx
, xx
, 0)
294 INTRINSIC(shared_atomic_comp_swap
, 3, ARR(1, 1, 1), true, 1, 0, 1, BASE
, xx
, xx
, 0)
296 /* Used by nir_builder.h to generate loader helpers for the system values. */
297 #ifndef DEFINE_SYSTEM_VALUE
298 #define DEFINE_SYSTEM_VALUE(name)
301 #define SYSTEM_VALUE(name, components, num_indices, idx0, idx1, idx2) \
302 DEFINE_SYSTEM_VALUE(name) \
303 INTRINSIC(load_##name, 0, ARR(0), true, components, 0, num_indices, \
305 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
307 SYSTEM_VALUE(front_face
, 1, 0, xx
, xx
, xx
)
308 SYSTEM_VALUE(vertex_id
, 1, 0, xx
, xx
, xx
)
309 SYSTEM_VALUE(vertex_id_zero_base
, 1, 0, xx
, xx
, xx
)
310 SYSTEM_VALUE(base_vertex
, 1, 0, xx
, xx
, xx
)
311 SYSTEM_VALUE(instance_id
, 1, 0, xx
, xx
, xx
)
312 SYSTEM_VALUE(base_instance
, 1, 0, xx
, xx
, xx
)
313 SYSTEM_VALUE(draw_id
, 1, 0, xx
, xx
, xx
)
314 SYSTEM_VALUE(sample_id
, 1, 0, xx
, xx
, xx
)
315 SYSTEM_VALUE(sample_pos
, 2, 0, xx
, xx
, xx
)
316 SYSTEM_VALUE(sample_mask_in
, 1, 0, xx
, xx
, xx
)
317 SYSTEM_VALUE(primitive_id
, 1, 0, xx
, xx
, xx
)
318 SYSTEM_VALUE(invocation_id
, 1, 0, xx
, xx
, xx
)
319 SYSTEM_VALUE(tess_coord
, 3, 0, xx
, xx
, xx
)
320 SYSTEM_VALUE(tess_level_outer
, 4, 0, xx
, xx
, xx
)
321 SYSTEM_VALUE(tess_level_inner
, 2, 0, xx
, xx
, xx
)
322 SYSTEM_VALUE(patch_vertices_in
, 1, 0, xx
, xx
, xx
)
323 SYSTEM_VALUE(local_invocation_id
, 3, 0, xx
, xx
, xx
)
324 SYSTEM_VALUE(local_invocation_index
, 1, 0, xx
, xx
, xx
)
325 SYSTEM_VALUE(work_group_id
, 3, 0, xx
, xx
, xx
)
326 SYSTEM_VALUE(user_clip_plane
, 4, 1, UCP_ID
, xx
, xx
)
327 SYSTEM_VALUE(num_work_groups
, 3, 0, xx
, xx
, xx
)
328 SYSTEM_VALUE(helper_invocation
, 1, 0, xx
, xx
, xx
)
329 SYSTEM_VALUE(channel_num
, 1, 0, xx
, xx
, xx
)
330 SYSTEM_VALUE(alpha_ref_float
, 1, 0, xx
, xx
, xx
)
331 SYSTEM_VALUE(layer_id
, 1, 0, xx
, xx
, xx
)
332 SYSTEM_VALUE(view_index
, 1, 0, xx
, xx
, xx
)
334 /* Blend constant color values. Float values are clamped. */
335 SYSTEM_VALUE(blend_const_color_r_float
, 1, 0, xx
, xx
, xx
)
336 SYSTEM_VALUE(blend_const_color_g_float
, 1, 0, xx
, xx
, xx
)
337 SYSTEM_VALUE(blend_const_color_b_float
, 1, 0, xx
, xx
, xx
)
338 SYSTEM_VALUE(blend_const_color_a_float
, 1, 0, xx
, xx
, xx
)
339 SYSTEM_VALUE(blend_const_color_rgba8888_unorm
, 1, 0, xx
, xx
, xx
)
340 SYSTEM_VALUE(blend_const_color_aaaa8888_unorm
, 1, 0, xx
, xx
, xx
)
343 * Barycentric coordinate intrinsics.
345 * These set up the barycentric coordinates for a particular interpolation.
346 * The first three are for the simple cases: pixel, centroid, or per-sample
347 * (at gl_SampleID). The next two handle interpolating at a specified
348 * sample location, or interpolating with a vec2 offset,
350 * The interp_mode index should be either the INTERP_MODE_SMOOTH or
351 * INTERP_MODE_NOPERSPECTIVE enum values.
353 * The vec2 value produced by these intrinsics is intended for use as the
354 * barycoord source of a load_interpolated_input intrinsic.
357 #define BARYCENTRIC(name, sources, source_components) \
358 INTRINSIC(load_barycentric_##name, sources, ARR(source_components), \
359 true, 2, 0, 1, INTERP_MODE, xx, xx, \
360 NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
362 /* no sources. const_index[] = { interp_mode } */
363 BARYCENTRIC(pixel
, 0, 0)
364 BARYCENTRIC(centroid
, 0, 0)
365 BARYCENTRIC(sample
, 0, 0)
366 /* src[] = { sample_id }. const_index[] = { interp_mode } */
367 BARYCENTRIC(at_sample
, 1, 1)
368 /* src[] = { offset.xy }. const_index[] = { interp_mode } */
369 BARYCENTRIC(at_offset
, 1, 2)
372 * Load operations pull data from some piece of GPU memory. All load
373 * operations operate in terms of offsets into some piece of theoretical
374 * memory. Loads from externally visible memory (UBO and SSBO) simply take a
375 * byte offset as a source. Loads from opaque memory (uniforms, inputs, etc.)
376 * take a base+offset pair where the base (const_index[0]) gives the location
377 * of the start of the variable being loaded and and the offset source is a
378 * offset into that variable.
380 * Uniform load operations have a second "range" index that specifies the
381 * range (starting at base) of the data from which we are loading. If
382 * const_index[1] == 0, then the range is unknown.
384 * Some load operations such as UBO/SSBO load and per_vertex loads take an
385 * additional source to specify which UBO/SSBO/vertex to load from.
387 * The exact address type depends on the lowering pass that generates the
388 * load/store intrinsics. Typically, this is vec4 units for things such as
389 * varying slots and float units for fragment shader inputs. UBO and SSBO
390 * offsets are always in bytes.
393 #define LOAD(name, srcs, num_indices, idx0, idx1, idx2, flags) \
394 INTRINSIC(load_##name, srcs, ARR(1, 1, 1, 1), true, 0, 0, num_indices, idx0, idx1, idx2, flags)
396 /* src[] = { offset }. const_index[] = { base, range } */
397 LOAD(uniform
, 1, 2, BASE
, RANGE
, xx
, NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
398 /* src[] = { buffer_index, offset }. No const_index */
399 LOAD(ubo
, 2, 0, xx
, xx
, xx
, NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
400 /* src[] = { offset }. const_index[] = { base, component } */
401 LOAD(input
, 1, 2, BASE
, COMPONENT
, xx
, NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
402 /* src[] = { vertex, offset }. const_index[] = { base, component } */
403 LOAD(per_vertex_input
, 2, 2, BASE
, COMPONENT
, xx
, NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
404 /* src[] = { barycoord, offset }. const_index[] = { base, component } */
405 INTRINSIC(load_interpolated_input
, 2, ARR(2, 1), true, 0, 0,
406 2, BASE
, COMPONENT
, xx
,
407 NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
409 /* src[] = { buffer_index, offset }. No const_index */
410 LOAD(ssbo
, 2, 0, xx
, xx
, xx
, NIR_INTRINSIC_CAN_ELIMINATE
)
411 /* src[] = { offset }. const_index[] = { base, component } */
412 LOAD(output
, 1, 1, BASE
, COMPONENT
, xx
, NIR_INTRINSIC_CAN_ELIMINATE
)
413 /* src[] = { vertex, offset }. const_index[] = { base, component } */
414 LOAD(per_vertex_output
, 2, 1, BASE
, COMPONENT
, xx
, NIR_INTRINSIC_CAN_ELIMINATE
)
415 /* src[] = { offset }. const_index[] = { base } */
416 LOAD(shared
, 1, 1, BASE
, xx
, xx
, NIR_INTRINSIC_CAN_ELIMINATE
)
417 /* src[] = { offset }. const_index[] = { base, range } */
418 LOAD(push_constant
, 1, 2, BASE
, RANGE
, xx
,
419 NIR_INTRINSIC_CAN_ELIMINATE
| NIR_INTRINSIC_CAN_REORDER
)
422 * Stores work the same way as loads, except now the first source is the value
423 * to store and the second (and possibly third) source specify where to store
424 * the value. SSBO and shared memory stores also have a write mask as
428 #define STORE(name, srcs, num_indices, idx0, idx1, idx2, flags) \
429 INTRINSIC(store_##name, srcs, ARR(0, 1, 1, 1), false, 0, 0, num_indices, idx0, idx1, idx2, flags)
431 /* src[] = { value, offset }. const_index[] = { base, write_mask, component } */
432 STORE(output
, 2, 3, BASE
, WRMASK
, COMPONENT
, 0)
433 /* src[] = { value, vertex, offset }.
434 * const_index[] = { base, write_mask, component }
436 STORE(per_vertex_output
, 3, 3, BASE
, WRMASK
, COMPONENT
, 0)
437 /* src[] = { value, block_index, offset }. const_index[] = { write_mask } */
438 STORE(ssbo
, 3, 1, WRMASK
, xx
, xx
, 0)
439 /* src[] = { value, offset }. const_index[] = { base, write_mask } */
440 STORE(shared
, 2, 2, BASE
, WRMASK
, xx
, 0)
442 LAST_INTRINSIC(store_shared
)
444 #undef DEFINE_SYSTEM_VALUE
446 #undef LAST_INTRINSIC