1 /* Copyright (C) 2018 Red Hat
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a
4  * copy of this software and associated documentation files (the "Software"),
5  * to deal in the Software without restriction, including without limitation
6  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7  * and/or sell copies of the Software, and to permit persons to whom the
8  * Software is furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice (including the next
11  * paragraph) shall be included in all copies or substantial portions of the
12  * Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  */
22 
23 #ifndef _NIR_INTRINSICS_
24 #define _NIR_INTRINSICS_
25 
26 
27 
28 typedef enum {
29    nir_intrinsic_addr_mode_is,
30    nir_intrinsic_atomic_counter_add,
31    nir_intrinsic_atomic_counter_add_deref,
32    nir_intrinsic_atomic_counter_and,
33    nir_intrinsic_atomic_counter_and_deref,
34    nir_intrinsic_atomic_counter_comp_swap,
35    nir_intrinsic_atomic_counter_comp_swap_deref,
36    nir_intrinsic_atomic_counter_exchange,
37    nir_intrinsic_atomic_counter_exchange_deref,
38    nir_intrinsic_atomic_counter_inc,
39    nir_intrinsic_atomic_counter_inc_deref,
40    nir_intrinsic_atomic_counter_max,
41    nir_intrinsic_atomic_counter_max_deref,
42    nir_intrinsic_atomic_counter_min,
43    nir_intrinsic_atomic_counter_min_deref,
44    nir_intrinsic_atomic_counter_or,
45    nir_intrinsic_atomic_counter_or_deref,
46    nir_intrinsic_atomic_counter_post_dec,
47    nir_intrinsic_atomic_counter_post_dec_deref,
48    nir_intrinsic_atomic_counter_pre_dec,
49    nir_intrinsic_atomic_counter_pre_dec_deref,
50    nir_intrinsic_atomic_counter_read,
51    nir_intrinsic_atomic_counter_read_deref,
52    nir_intrinsic_atomic_counter_xor,
53    nir_intrinsic_atomic_counter_xor_deref,
54    nir_intrinsic_ballot,
55    nir_intrinsic_ballot_bit_count_exclusive,
56    nir_intrinsic_ballot_bit_count_inclusive,
57    nir_intrinsic_ballot_bit_count_reduce,
58    nir_intrinsic_ballot_bitfield_extract,
59    nir_intrinsic_ballot_find_lsb,
60    nir_intrinsic_ballot_find_msb,
61    nir_intrinsic_begin_invocation_interlock,
62    nir_intrinsic_bindless_image_atomic_add,
63    nir_intrinsic_bindless_image_atomic_and,
64    nir_intrinsic_bindless_image_atomic_comp_swap,
65    nir_intrinsic_bindless_image_atomic_dec_wrap,
66    nir_intrinsic_bindless_image_atomic_exchange,
67    nir_intrinsic_bindless_image_atomic_fadd,
68    nir_intrinsic_bindless_image_atomic_imax,
69    nir_intrinsic_bindless_image_atomic_imin,
70    nir_intrinsic_bindless_image_atomic_inc_wrap,
71    nir_intrinsic_bindless_image_atomic_or,
72    nir_intrinsic_bindless_image_atomic_umax,
73    nir_intrinsic_bindless_image_atomic_umin,
74    nir_intrinsic_bindless_image_atomic_xor,
75    nir_intrinsic_bindless_image_format,
76    nir_intrinsic_bindless_image_load,
77    nir_intrinsic_bindless_image_load_raw_intel,
78    nir_intrinsic_bindless_image_order,
79    nir_intrinsic_bindless_image_samples,
80    nir_intrinsic_bindless_image_size,
81    nir_intrinsic_bindless_image_store,
82    nir_intrinsic_bindless_image_store_raw_intel,
83    nir_intrinsic_bindless_resource_ir3,
84    nir_intrinsic_cond_end_ir3,
85    nir_intrinsic_control_barrier,
86    nir_intrinsic_convert_alu_types,
87    nir_intrinsic_copy_deref,
88    nir_intrinsic_demote,
89    nir_intrinsic_demote_if,
90    nir_intrinsic_deref_atomic_add,
91    nir_intrinsic_deref_atomic_and,
92    nir_intrinsic_deref_atomic_comp_swap,
93    nir_intrinsic_deref_atomic_exchange,
94    nir_intrinsic_deref_atomic_fadd,
95    nir_intrinsic_deref_atomic_fcomp_swap,
96    nir_intrinsic_deref_atomic_fmax,
97    nir_intrinsic_deref_atomic_fmin,
98    nir_intrinsic_deref_atomic_imax,
99    nir_intrinsic_deref_atomic_imin,
100    nir_intrinsic_deref_atomic_or,
101    nir_intrinsic_deref_atomic_umax,
102    nir_intrinsic_deref_atomic_umin,
103    nir_intrinsic_deref_atomic_xor,
104    nir_intrinsic_deref_buffer_array_length,
105    nir_intrinsic_deref_mode_is,
106    nir_intrinsic_discard,
107    nir_intrinsic_discard_if,
108    nir_intrinsic_elect,
109    nir_intrinsic_emit_vertex,
110    nir_intrinsic_emit_vertex_with_counter,
111    nir_intrinsic_end_invocation_interlock,
112    nir_intrinsic_end_patch_ir3,
113    nir_intrinsic_end_primitive,
114    nir_intrinsic_end_primitive_with_counter,
115    nir_intrinsic_exclusive_scan,
116    nir_intrinsic_execute_callable,
117    nir_intrinsic_first_invocation,
118    nir_intrinsic_get_ssbo_size,
119    nir_intrinsic_get_ubo_size,
120    nir_intrinsic_global_atomic_add,
121    nir_intrinsic_global_atomic_and,
122    nir_intrinsic_global_atomic_comp_swap,
123    nir_intrinsic_global_atomic_exchange,
124    nir_intrinsic_global_atomic_fadd,
125    nir_intrinsic_global_atomic_fcomp_swap,
126    nir_intrinsic_global_atomic_fmax,
127    nir_intrinsic_global_atomic_fmin,
128    nir_intrinsic_global_atomic_imax,
129    nir_intrinsic_global_atomic_imin,
130    nir_intrinsic_global_atomic_or,
131    nir_intrinsic_global_atomic_umax,
132    nir_intrinsic_global_atomic_umin,
133    nir_intrinsic_global_atomic_xor,
134    nir_intrinsic_group_memory_barrier,
135    nir_intrinsic_ignore_ray_intersection,
136    nir_intrinsic_image_atomic_add,
137    nir_intrinsic_image_atomic_and,
138    nir_intrinsic_image_atomic_comp_swap,
139    nir_intrinsic_image_atomic_dec_wrap,
140    nir_intrinsic_image_atomic_exchange,
141    nir_intrinsic_image_atomic_fadd,
142    nir_intrinsic_image_atomic_imax,
143    nir_intrinsic_image_atomic_imin,
144    nir_intrinsic_image_atomic_inc_wrap,
145    nir_intrinsic_image_atomic_or,
146    nir_intrinsic_image_atomic_umax,
147    nir_intrinsic_image_atomic_umin,
148    nir_intrinsic_image_atomic_xor,
149    nir_intrinsic_image_deref_atomic_add,
150    nir_intrinsic_image_deref_atomic_and,
151    nir_intrinsic_image_deref_atomic_comp_swap,
152    nir_intrinsic_image_deref_atomic_dec_wrap,
153    nir_intrinsic_image_deref_atomic_exchange,
154    nir_intrinsic_image_deref_atomic_fadd,
155    nir_intrinsic_image_deref_atomic_imax,
156    nir_intrinsic_image_deref_atomic_imin,
157    nir_intrinsic_image_deref_atomic_inc_wrap,
158    nir_intrinsic_image_deref_atomic_or,
159    nir_intrinsic_image_deref_atomic_umax,
160    nir_intrinsic_image_deref_atomic_umin,
161    nir_intrinsic_image_deref_atomic_xor,
162    nir_intrinsic_image_deref_format,
163    nir_intrinsic_image_deref_load,
164    nir_intrinsic_image_deref_load_param_intel,
165    nir_intrinsic_image_deref_load_raw_intel,
166    nir_intrinsic_image_deref_order,
167    nir_intrinsic_image_deref_samples,
168    nir_intrinsic_image_deref_size,
169    nir_intrinsic_image_deref_store,
170    nir_intrinsic_image_deref_store_raw_intel,
171    nir_intrinsic_image_format,
172    nir_intrinsic_image_load,
173    nir_intrinsic_image_load_raw_intel,
174    nir_intrinsic_image_order,
175    nir_intrinsic_image_samples,
176    nir_intrinsic_image_size,
177    nir_intrinsic_image_store,
178    nir_intrinsic_image_store_raw_intel,
179    nir_intrinsic_inclusive_scan,
180    nir_intrinsic_interp_deref_at_centroid,
181    nir_intrinsic_interp_deref_at_offset,
182    nir_intrinsic_interp_deref_at_sample,
183    nir_intrinsic_interp_deref_at_vertex,
184    nir_intrinsic_is_helper_invocation,
185    nir_intrinsic_last_invocation,
186    nir_intrinsic_load_aa_line_width,
187    nir_intrinsic_load_barycentric_at_offset,
188    nir_intrinsic_load_barycentric_at_sample,
189    nir_intrinsic_load_barycentric_centroid,
190    nir_intrinsic_load_barycentric_model,
191    nir_intrinsic_load_barycentric_pixel,
192    nir_intrinsic_load_barycentric_sample,
193    nir_intrinsic_load_base_global_invocation_id,
194    nir_intrinsic_load_base_instance,
195    nir_intrinsic_load_base_vertex,
196    nir_intrinsic_load_base_work_group_id,
197    nir_intrinsic_load_blend_const_color_a_float,
198    nir_intrinsic_load_blend_const_color_aaaa8888_unorm,
199    nir_intrinsic_load_blend_const_color_b_float,
200    nir_intrinsic_load_blend_const_color_g_float,
201    nir_intrinsic_load_blend_const_color_r_float,
202    nir_intrinsic_load_blend_const_color_rgba,
203    nir_intrinsic_load_blend_const_color_rgba8888_unorm,
204    nir_intrinsic_load_color0,
205    nir_intrinsic_load_color1,
206    nir_intrinsic_load_constant,
207    nir_intrinsic_load_constant_base_ptr,
208    nir_intrinsic_load_deref,
209    nir_intrinsic_load_deref_block_intel,
210    nir_intrinsic_load_draw_id,
211    nir_intrinsic_load_fb_layers_v3d,
212    nir_intrinsic_load_first_vertex,
213    nir_intrinsic_load_frag_coord,
214    nir_intrinsic_load_front_face,
215    nir_intrinsic_load_fs_input_interp_deltas,
216    nir_intrinsic_load_global,
217    nir_intrinsic_load_global_block_intel,
218    nir_intrinsic_load_global_constant,
219    nir_intrinsic_load_global_invocation_id,
220    nir_intrinsic_load_global_invocation_id_zero_base,
221    nir_intrinsic_load_global_invocation_index,
222    nir_intrinsic_load_global_ir3,
223    nir_intrinsic_load_gs_header_ir3,
224    nir_intrinsic_load_helper_invocation,
225    nir_intrinsic_load_hs_patch_stride_ir3,
226    nir_intrinsic_load_input,
227    nir_intrinsic_load_input_vertex,
228    nir_intrinsic_load_instance_id,
229    nir_intrinsic_load_interpolated_input,
230    nir_intrinsic_load_invocation_id,
231    nir_intrinsic_load_is_indexed_draw,
232    nir_intrinsic_load_kernel_input,
233    nir_intrinsic_load_layer_id,
234    nir_intrinsic_load_line_coord,
235    nir_intrinsic_load_line_width,
236    nir_intrinsic_load_local_group_size,
237    nir_intrinsic_load_local_invocation_id,
238    nir_intrinsic_load_local_invocation_index,
239    nir_intrinsic_load_local_shared_r600,
240    nir_intrinsic_load_num_subgroups,
241    nir_intrinsic_load_num_work_groups,
242    nir_intrinsic_load_output,
243    nir_intrinsic_load_param,
244    nir_intrinsic_load_patch_vertices_in,
245    nir_intrinsic_load_per_vertex_input,
246    nir_intrinsic_load_per_vertex_output,
247    nir_intrinsic_load_point_coord,
248    nir_intrinsic_load_primitive_id,
249    nir_intrinsic_load_primitive_location_ir3,
250    nir_intrinsic_load_push_constant,
251    nir_intrinsic_load_raw_output_pan,
252    nir_intrinsic_load_ray_flags,
253    nir_intrinsic_load_ray_geometry_index,
254    nir_intrinsic_load_ray_hit_kind,
255    nir_intrinsic_load_ray_instance_custom_index,
256    nir_intrinsic_load_ray_launch_id,
257    nir_intrinsic_load_ray_launch_size,
258    nir_intrinsic_load_ray_object_direction,
259    nir_intrinsic_load_ray_object_origin,
260    nir_intrinsic_load_ray_object_to_world,
261    nir_intrinsic_load_ray_t_max,
262    nir_intrinsic_load_ray_t_min,
263    nir_intrinsic_load_ray_world_direction,
264    nir_intrinsic_load_ray_world_origin,
265    nir_intrinsic_load_ray_world_to_object,
266    nir_intrinsic_load_reloc_const_intel,
267    nir_intrinsic_load_sample_id,
268    nir_intrinsic_load_sample_id_no_per_sample,
269    nir_intrinsic_load_sample_mask_in,
270    nir_intrinsic_load_sample_pos,
271    nir_intrinsic_load_sample_pos_from_id,
272    nir_intrinsic_load_sampler_lod_parameters_pan,
273    nir_intrinsic_load_scratch,
274    nir_intrinsic_load_scratch_base_ptr,
275    nir_intrinsic_load_shader_record_ptr,
276    nir_intrinsic_load_shared,
277    nir_intrinsic_load_shared_base_ptr,
278    nir_intrinsic_load_shared_block_intel,
279    nir_intrinsic_load_shared_ir3,
280    nir_intrinsic_load_simd_width_intel,
281    nir_intrinsic_load_size_ir3,
282    nir_intrinsic_load_ssbo,
283    nir_intrinsic_load_ssbo_address,
284    nir_intrinsic_load_ssbo_block_intel,
285    nir_intrinsic_load_ssbo_ir3,
286    nir_intrinsic_load_subgroup_eq_mask,
287    nir_intrinsic_load_subgroup_ge_mask,
288    nir_intrinsic_load_subgroup_gt_mask,
289    nir_intrinsic_load_subgroup_id,
290    nir_intrinsic_load_subgroup_invocation,
291    nir_intrinsic_load_subgroup_le_mask,
292    nir_intrinsic_load_subgroup_lt_mask,
293    nir_intrinsic_load_subgroup_size,
294    nir_intrinsic_load_tcs_header_ir3,
295    nir_intrinsic_load_tcs_in_param_base_r600,
296    nir_intrinsic_load_tcs_out_param_base_r600,
297    nir_intrinsic_load_tcs_rel_patch_id_r600,
298    nir_intrinsic_load_tcs_tess_factor_base_r600,
299    nir_intrinsic_load_tess_coord,
300    nir_intrinsic_load_tess_factor_base_ir3,
301    nir_intrinsic_load_tess_level_inner,
302    nir_intrinsic_load_tess_level_inner_default,
303    nir_intrinsic_load_tess_level_outer,
304    nir_intrinsic_load_tess_level_outer_default,
305    nir_intrinsic_load_tess_param_base_ir3,
306    nir_intrinsic_load_tlb_color_v3d,
307    nir_intrinsic_load_ubo,
308    nir_intrinsic_load_ubo_vec4,
309    nir_intrinsic_load_uniform,
310    nir_intrinsic_load_user_clip_plane,
311    nir_intrinsic_load_user_data_amd,
312    nir_intrinsic_load_vertex_id,
313    nir_intrinsic_load_vertex_id_zero_base,
314    nir_intrinsic_load_view_index,
315    nir_intrinsic_load_viewport_offset,
316    nir_intrinsic_load_viewport_scale,
317    nir_intrinsic_load_viewport_x_scale,
318    nir_intrinsic_load_viewport_y_scale,
319    nir_intrinsic_load_viewport_z_offset,
320    nir_intrinsic_load_viewport_z_scale,
321    nir_intrinsic_load_vs_primitive_stride_ir3,
322    nir_intrinsic_load_vs_vertex_stride_ir3,
323    nir_intrinsic_load_vulkan_descriptor,
324    nir_intrinsic_load_work_dim,
325    nir_intrinsic_load_work_group_id,
326    nir_intrinsic_load_work_group_id_zero_base,
327    nir_intrinsic_masked_swizzle_amd,
328    nir_intrinsic_mbcnt_amd,
329    nir_intrinsic_memcpy_deref,
330    nir_intrinsic_memory_barrier,
331    nir_intrinsic_memory_barrier_atomic_counter,
332    nir_intrinsic_memory_barrier_buffer,
333    nir_intrinsic_memory_barrier_image,
334    nir_intrinsic_memory_barrier_shared,
335    nir_intrinsic_memory_barrier_tcs_patch,
336    nir_intrinsic_nop,
337    nir_intrinsic_quad_broadcast,
338    nir_intrinsic_quad_swap_diagonal,
339    nir_intrinsic_quad_swap_horizontal,
340    nir_intrinsic_quad_swap_vertical,
341    nir_intrinsic_quad_swizzle_amd,
342    nir_intrinsic_read_first_invocation,
343    nir_intrinsic_read_invocation,
344    nir_intrinsic_reduce,
345    nir_intrinsic_report_ray_intersection,
346    nir_intrinsic_scoped_barrier,
347    nir_intrinsic_set_vertex_and_primitive_count,
348    nir_intrinsic_shader_clock,
349    nir_intrinsic_shared_atomic_add,
350    nir_intrinsic_shared_atomic_and,
351    nir_intrinsic_shared_atomic_comp_swap,
352    nir_intrinsic_shared_atomic_exchange,
353    nir_intrinsic_shared_atomic_fadd,
354    nir_intrinsic_shared_atomic_fcomp_swap,
355    nir_intrinsic_shared_atomic_fmax,
356    nir_intrinsic_shared_atomic_fmin,
357    nir_intrinsic_shared_atomic_imax,
358    nir_intrinsic_shared_atomic_imin,
359    nir_intrinsic_shared_atomic_or,
360    nir_intrinsic_shared_atomic_umax,
361    nir_intrinsic_shared_atomic_umin,
362    nir_intrinsic_shared_atomic_xor,
363    nir_intrinsic_shuffle,
364    nir_intrinsic_shuffle_down,
365    nir_intrinsic_shuffle_up,
366    nir_intrinsic_shuffle_xor,
367    nir_intrinsic_ssbo_atomic_add,
368    nir_intrinsic_ssbo_atomic_add_ir3,
369    nir_intrinsic_ssbo_atomic_and,
370    nir_intrinsic_ssbo_atomic_and_ir3,
371    nir_intrinsic_ssbo_atomic_comp_swap,
372    nir_intrinsic_ssbo_atomic_comp_swap_ir3,
373    nir_intrinsic_ssbo_atomic_exchange,
374    nir_intrinsic_ssbo_atomic_exchange_ir3,
375    nir_intrinsic_ssbo_atomic_fadd,
376    nir_intrinsic_ssbo_atomic_fcomp_swap,
377    nir_intrinsic_ssbo_atomic_fmax,
378    nir_intrinsic_ssbo_atomic_fmin,
379    nir_intrinsic_ssbo_atomic_imax,
380    nir_intrinsic_ssbo_atomic_imax_ir3,
381    nir_intrinsic_ssbo_atomic_imin,
382    nir_intrinsic_ssbo_atomic_imin_ir3,
383    nir_intrinsic_ssbo_atomic_or,
384    nir_intrinsic_ssbo_atomic_or_ir3,
385    nir_intrinsic_ssbo_atomic_umax,
386    nir_intrinsic_ssbo_atomic_umax_ir3,
387    nir_intrinsic_ssbo_atomic_umin,
388    nir_intrinsic_ssbo_atomic_umin_ir3,
389    nir_intrinsic_ssbo_atomic_xor,
390    nir_intrinsic_ssbo_atomic_xor_ir3,
391    nir_intrinsic_store_combined_output_pan,
392    nir_intrinsic_store_deref,
393    nir_intrinsic_store_deref_block_intel,
394    nir_intrinsic_store_global,
395    nir_intrinsic_store_global_block_intel,
396    nir_intrinsic_store_global_ir3,
397    nir_intrinsic_store_local_shared_r600,
398    nir_intrinsic_store_output,
399    nir_intrinsic_store_per_vertex_output,
400    nir_intrinsic_store_raw_output_pan,
401    nir_intrinsic_store_scratch,
402    nir_intrinsic_store_shared,
403    nir_intrinsic_store_shared_block_intel,
404    nir_intrinsic_store_shared_ir3,
405    nir_intrinsic_store_ssbo,
406    nir_intrinsic_store_ssbo_block_intel,
407    nir_intrinsic_store_ssbo_ir3,
408    nir_intrinsic_store_tf_r600,
409    nir_intrinsic_store_tlb_sample_color_v3d,
410    nir_intrinsic_terminate,
411    nir_intrinsic_terminate_if,
412    nir_intrinsic_terminate_ray,
413    nir_intrinsic_trace_ray,
414    nir_intrinsic_vote_all,
415    nir_intrinsic_vote_any,
416    nir_intrinsic_vote_feq,
417    nir_intrinsic_vote_ieq,
418    nir_intrinsic_vulkan_resource_index,
419    nir_intrinsic_vulkan_resource_reindex,
420    nir_intrinsic_write_invocation_amd,
421 
422    nir_last_intrinsic = nir_intrinsic_write_invocation_amd,
423    nir_num_intrinsics = nir_last_intrinsic + 1
424 } nir_intrinsic_op;
425 
426 #endif /* _NIR_INTRINSICS_ */