2 * Copyright © 2013 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
21 * DEALINGS IN THE SOFTWARE.
25 * \file builtin_functions.cpp
27 * Support for GLSL built-in functions.
29 * This file is split into several main components:
31 * 1. Availability predicates
33 * A series of small functions that check whether the current shader
34 * supports the version/extensions required to expose a built-in.
36 * 2. Core builtin_builder class functionality
38 * 3. Lists of built-in functions
40 * The builtin_builder::create_builtins() function contains lists of all
41 * built-in function signatures, where they're available, what types they
44 * 4. Implementations of built-in function signatures
46 * A series of functions which create ir_function_signatures and emit IR
47 * via ir_builder to implement them.
51 * A few functions the rest of the compiler can use to interact with the
52 * built-in function module. For example, searching for a built-in by
53 * name and parameters.
58 * Unfortunately, some versions of MinGW produce bad code if this file
59 * is compiled with -O2 or -O3. The resulting driver will crash in random
60 * places if the app uses GLSL.
61 * The work-around is to disable optimizations for just this file. Luckily,
62 * this code is basically just executed once.
64 * MinGW 4.6.3 (in Ubuntu 13.10) does not have this bug.
65 * MinGW 5.3.1 (in Ubuntu 16.04) definitely has this bug.
66 * MinGW 6.2.0 (in Ubuntu 16.10) definitely has this bug.
67 * MinGW x.y.z - don't know. Assume versions after 4.6.x are buggy
70 #if defined(__MINGW32__) && ((__GNUC__ * 100) + __GNUC_MINOR >= 407)
71 #warning "disabling optimizations for this file to work around compiler bug"
72 #pragma GCC optimize("O1")
78 #include "main/mtypes.h"
79 #include "main/shaderobj.h"
80 #include "ir_builder.h"
81 #include "glsl_parser_extras.h"
82 #include "program/prog_instruction.h"
84 #include "builtin_functions.h"
85 #include "util/hash_table.h"
87 #define M_PIf ((float) M_PI)
88 #define M_PI_2f ((float) M_PI_2)
89 #define M_PI_4f ((float) M_PI_4)
91 using namespace ir_builder
;
94 * Availability predicates:
98 always_available(const _mesa_glsl_parse_state
*)
104 compatibility_vs_only(const _mesa_glsl_parse_state
*state
)
106 return state
->stage
== MESA_SHADER_VERTEX
&&
107 (state
->compat_shader
|| state
->ARB_compatibility_enable
) &&
112 derivatives_only(const _mesa_glsl_parse_state
*state
)
114 return state
->stage
== MESA_SHADER_FRAGMENT
||
115 (state
->stage
== MESA_SHADER_COMPUTE
&&
116 state
->NV_compute_shader_derivatives_enable
);
120 gs_only(const _mesa_glsl_parse_state
*state
)
122 return state
->stage
== MESA_SHADER_GEOMETRY
;
126 v110(const _mesa_glsl_parse_state
*state
)
128 return !state
->es_shader
;
132 v110_derivatives_only(const _mesa_glsl_parse_state
*state
)
134 return !state
->es_shader
&&
135 derivatives_only(state
);
139 v120(const _mesa_glsl_parse_state
*state
)
141 return state
->is_version(120, 300);
145 v130(const _mesa_glsl_parse_state
*state
)
147 return state
->is_version(130, 300);
151 v130_desktop(const _mesa_glsl_parse_state
*state
)
153 return state
->is_version(130, 0);
157 v460_desktop(const _mesa_glsl_parse_state
*state
)
159 return state
->is_version(460, 0);
163 v130_derivatives_only(const _mesa_glsl_parse_state
*state
)
165 return state
->is_version(130, 300) &&
166 derivatives_only(state
);
170 v140_or_es3(const _mesa_glsl_parse_state
*state
)
172 return state
->is_version(140, 300);
176 v400_derivatives_only(const _mesa_glsl_parse_state
*state
)
178 return state
->is_version(400, 0) &&
179 derivatives_only(state
);
183 texture_rectangle(const _mesa_glsl_parse_state
*state
)
185 return state
->ARB_texture_rectangle_enable
;
189 texture_external(const _mesa_glsl_parse_state
*state
)
191 return state
->OES_EGL_image_external_enable
;
195 texture_external_es3(const _mesa_glsl_parse_state
*state
)
197 return state
->OES_EGL_image_external_essl3_enable
&&
199 state
->is_version(0, 300);
202 /** True if texturing functions with explicit LOD are allowed. */
204 lod_exists_in_stage(const _mesa_glsl_parse_state
*state
)
206 /* Texturing functions with "Lod" in their name exist:
207 * - In the vertex shader stage (for all languages)
208 * - In any stage for GLSL 1.30+ or GLSL ES 3.00
209 * - In any stage for desktop GLSL with ARB_shader_texture_lod enabled.
211 * Since ARB_shader_texture_lod can only be enabled on desktop GLSL, we
212 * don't need to explicitly check state->es_shader.
214 return state
->stage
== MESA_SHADER_VERTEX
||
215 state
->is_version(130, 300) ||
216 state
->ARB_shader_texture_lod_enable
||
217 state
->EXT_gpu_shader4_enable
;
221 v110_lod(const _mesa_glsl_parse_state
*state
)
223 return !state
->es_shader
&& lod_exists_in_stage(state
);
227 texture_buffer(const _mesa_glsl_parse_state
*state
)
229 return state
->is_version(140, 320) ||
230 state
->EXT_texture_buffer_enable
||
231 state
->OES_texture_buffer_enable
;
235 shader_texture_lod(const _mesa_glsl_parse_state
*state
)
237 return state
->ARB_shader_texture_lod_enable
;
241 shader_texture_lod_and_rect(const _mesa_glsl_parse_state
*state
)
243 return state
->ARB_shader_texture_lod_enable
&&
244 state
->ARB_texture_rectangle_enable
;
248 shader_bit_encoding(const _mesa_glsl_parse_state
*state
)
250 return state
->is_version(330, 300) ||
251 state
->ARB_shader_bit_encoding_enable
||
252 state
->ARB_gpu_shader5_enable
;
256 shader_integer_mix(const _mesa_glsl_parse_state
*state
)
258 return state
->is_version(450, 310) ||
259 state
->ARB_ES3_1_compatibility_enable
||
260 (v130(state
) && state
->EXT_shader_integer_mix_enable
);
264 shader_packing_or_es3(const _mesa_glsl_parse_state
*state
)
266 return state
->ARB_shading_language_packing_enable
||
267 state
->is_version(420, 300);
271 shader_packing_or_es3_or_gpu_shader5(const _mesa_glsl_parse_state
*state
)
273 return state
->ARB_shading_language_packing_enable
||
274 state
->ARB_gpu_shader5_enable
||
275 state
->is_version(400, 300);
279 gpu_shader4(const _mesa_glsl_parse_state
*state
)
281 return state
->EXT_gpu_shader4_enable
;
285 gpu_shader4_integer(const _mesa_glsl_parse_state
*state
)
287 return state
->EXT_gpu_shader4_enable
&&
288 state
->ctx
->Extensions
.EXT_texture_integer
;
292 gpu_shader4_array(const _mesa_glsl_parse_state
*state
)
294 return state
->EXT_gpu_shader4_enable
&&
295 state
->ctx
->Extensions
.EXT_texture_array
;
299 gpu_shader4_array_integer(const _mesa_glsl_parse_state
*state
)
301 return gpu_shader4_array(state
) &&
302 state
->ctx
->Extensions
.EXT_texture_integer
;
306 gpu_shader4_rect(const _mesa_glsl_parse_state
*state
)
308 return state
->EXT_gpu_shader4_enable
&&
309 state
->ctx
->Extensions
.NV_texture_rectangle
;
313 gpu_shader4_rect_integer(const _mesa_glsl_parse_state
*state
)
315 return gpu_shader4_rect(state
) &&
316 state
->ctx
->Extensions
.EXT_texture_integer
;
320 gpu_shader4_tbo(const _mesa_glsl_parse_state
*state
)
322 return state
->EXT_gpu_shader4_enable
&&
323 state
->ctx
->Extensions
.EXT_texture_buffer_object
;
327 gpu_shader4_tbo_integer(const _mesa_glsl_parse_state
*state
)
329 return gpu_shader4_tbo(state
) &&
330 state
->ctx
->Extensions
.EXT_texture_integer
;
334 gpu_shader4_derivs_only(const _mesa_glsl_parse_state
*state
)
336 return state
->EXT_gpu_shader4_enable
&&
337 derivatives_only(state
);
341 gpu_shader4_integer_derivs_only(const _mesa_glsl_parse_state
*state
)
343 return gpu_shader4_derivs_only(state
) &&
344 state
->ctx
->Extensions
.EXT_texture_integer
;
348 gpu_shader4_array_derivs_only(const _mesa_glsl_parse_state
*state
)
350 return gpu_shader4_derivs_only(state
) &&
351 state
->ctx
->Extensions
.EXT_texture_array
;
355 gpu_shader4_array_integer_derivs_only(const _mesa_glsl_parse_state
*state
)
357 return gpu_shader4_array_derivs_only(state
) &&
358 state
->ctx
->Extensions
.EXT_texture_integer
;
362 v130_or_gpu_shader4(const _mesa_glsl_parse_state
*state
)
364 return state
->is_version(130, 300) || state
->EXT_gpu_shader4_enable
;
368 v130_or_gpu_shader4_and_tex_shadow_lod(const _mesa_glsl_parse_state
*state
)
370 return v130_or_gpu_shader4(state
) &&
371 state
->EXT_texture_shadow_lod_enable
;
375 gpu_shader5(const _mesa_glsl_parse_state
*state
)
377 return state
->is_version(400, 0) || state
->ARB_gpu_shader5_enable
;
381 gpu_shader5_es(const _mesa_glsl_parse_state
*state
)
383 return state
->is_version(400, 320) ||
384 state
->ARB_gpu_shader5_enable
||
385 state
->EXT_gpu_shader5_enable
||
386 state
->OES_gpu_shader5_enable
;
390 gpu_shader5_or_OES_texture_cube_map_array(const _mesa_glsl_parse_state
*state
)
392 return state
->is_version(400, 320) ||
393 state
->ARB_gpu_shader5_enable
||
394 state
->EXT_texture_cube_map_array_enable
||
395 state
->OES_texture_cube_map_array_enable
;
399 es31_not_gs5(const _mesa_glsl_parse_state
*state
)
401 return state
->is_version(0, 310) && !gpu_shader5_es(state
);
405 gpu_shader5_or_es31(const _mesa_glsl_parse_state
*state
)
407 return state
->is_version(400, 310) || state
->ARB_gpu_shader5_enable
;
411 shader_packing_or_es31_or_gpu_shader5(const _mesa_glsl_parse_state
*state
)
413 return state
->ARB_shading_language_packing_enable
||
414 state
->ARB_gpu_shader5_enable
||
415 state
->is_version(400, 310);
419 gpu_shader5_or_es31_or_integer_functions(const _mesa_glsl_parse_state
*state
)
421 return gpu_shader5_or_es31(state
) ||
422 state
->MESA_shader_integer_functions_enable
;
426 fs_interpolate_at(const _mesa_glsl_parse_state
*state
)
428 return state
->stage
== MESA_SHADER_FRAGMENT
&&
429 (state
->is_version(400, 320) ||
430 state
->ARB_gpu_shader5_enable
||
431 state
->OES_shader_multisample_interpolation_enable
);
436 texture_array_lod(const _mesa_glsl_parse_state
*state
)
438 return lod_exists_in_stage(state
) &&
439 (state
->EXT_texture_array_enable
||
440 (state
->EXT_gpu_shader4_enable
&&
441 state
->ctx
->Extensions
.EXT_texture_array
));
445 texture_array(const _mesa_glsl_parse_state
*state
)
447 return state
->EXT_texture_array_enable
||
448 (state
->EXT_gpu_shader4_enable
&&
449 state
->ctx
->Extensions
.EXT_texture_array
);
453 texture_array_derivs_only(const _mesa_glsl_parse_state
*state
)
455 return derivatives_only(state
) &&
456 texture_array(state
);
460 texture_multisample(const _mesa_glsl_parse_state
*state
)
462 return state
->is_version(150, 310) ||
463 state
->ARB_texture_multisample_enable
;
467 texture_multisample_array(const _mesa_glsl_parse_state
*state
)
469 return state
->is_version(150, 320) ||
470 state
->ARB_texture_multisample_enable
||
471 state
->OES_texture_storage_multisample_2d_array_enable
;
475 texture_samples_identical(const _mesa_glsl_parse_state
*state
)
477 return texture_multisample(state
) &&
478 state
->EXT_shader_samples_identical_enable
;
482 texture_samples_identical_array(const _mesa_glsl_parse_state
*state
)
484 return texture_multisample_array(state
) &&
485 state
->EXT_shader_samples_identical_enable
;
489 derivatives_texture_cube_map_array(const _mesa_glsl_parse_state
*state
)
491 return state
->has_texture_cube_map_array() &&
492 derivatives_only(state
);
496 texture_cube_map_array(const _mesa_glsl_parse_state
*state
)
498 return state
->has_texture_cube_map_array();
502 v130_or_gpu_shader4_and_tex_cube_map_array(const _mesa_glsl_parse_state
*state
)
504 return texture_cube_map_array(state
) &&
505 v130_or_gpu_shader4(state
) &&
506 state
->EXT_texture_shadow_lod_enable
;
510 texture_query_levels(const _mesa_glsl_parse_state
*state
)
512 return state
->is_version(430, 0) ||
513 state
->ARB_texture_query_levels_enable
;
517 texture_query_lod(const _mesa_glsl_parse_state
*state
)
519 return derivatives_only(state
) &&
520 (state
->ARB_texture_query_lod_enable
||
521 state
->EXT_texture_query_lod_enable
);
525 texture_gather_cube_map_array(const _mesa_glsl_parse_state
*state
)
527 return state
->is_version(400, 320) ||
528 state
->ARB_texture_gather_enable
||
529 state
->ARB_gpu_shader5_enable
||
530 state
->EXT_texture_cube_map_array_enable
||
531 state
->OES_texture_cube_map_array_enable
;
535 texture_texture4(const _mesa_glsl_parse_state
*state
)
537 return state
->AMD_texture_texture4_enable
;
541 texture_gather_or_es31(const _mesa_glsl_parse_state
*state
)
543 return state
->is_version(400, 310) ||
544 state
->ARB_texture_gather_enable
||
545 state
->ARB_gpu_shader5_enable
;
548 /* Only ARB_texture_gather but not GLSL 4.0 or ARB_gpu_shader5.
549 * used for relaxation of const offset requirements.
552 texture_gather_only_or_es31(const _mesa_glsl_parse_state
*state
)
554 return !state
->is_version(400, 320) &&
555 !state
->ARB_gpu_shader5_enable
&&
556 !state
->EXT_gpu_shader5_enable
&&
557 !state
->OES_gpu_shader5_enable
&&
558 (state
->ARB_texture_gather_enable
||
559 state
->is_version(0, 310));
562 /* Desktop GL or OES_standard_derivatives */
564 derivatives(const _mesa_glsl_parse_state
*state
)
566 return derivatives_only(state
) &&
567 (state
->is_version(110, 300) ||
568 state
->OES_standard_derivatives_enable
||
569 state
->ctx
->Const
.AllowGLSLRelaxedES
);
573 derivative_control(const _mesa_glsl_parse_state
*state
)
575 return derivatives_only(state
) &&
576 (state
->is_version(450, 0) ||
577 state
->ARB_derivative_control_enable
);
581 tex1d_lod(const _mesa_glsl_parse_state
*state
)
583 return !state
->es_shader
&& lod_exists_in_stage(state
);
586 /** True if sampler3D exists */
588 tex3d(const _mesa_glsl_parse_state
*state
)
590 /* sampler3D exists in all desktop GLSL versions, GLSL ES 1.00 with the
591 * OES_texture_3D extension, and in GLSL ES 3.00.
593 return !state
->es_shader
||
594 state
->OES_texture_3D_enable
||
595 state
->language_version
>= 300;
599 derivatives_tex3d(const _mesa_glsl_parse_state
*state
)
601 return (!state
->es_shader
|| state
->OES_texture_3D_enable
) &&
602 derivatives_only(state
);
606 tex3d_lod(const _mesa_glsl_parse_state
*state
)
608 return tex3d(state
) && lod_exists_in_stage(state
);
612 shader_atomic_counters(const _mesa_glsl_parse_state
*state
)
614 return state
->has_atomic_counters();
618 shader_atomic_counter_ops(const _mesa_glsl_parse_state
*state
)
620 return state
->ARB_shader_atomic_counter_ops_enable
;
624 shader_atomic_counter_ops_or_v460_desktop(const _mesa_glsl_parse_state
*state
)
626 return state
->ARB_shader_atomic_counter_ops_enable
|| v460_desktop(state
);
630 shader_ballot(const _mesa_glsl_parse_state
*state
)
632 return state
->ARB_shader_ballot_enable
;
636 supports_arb_fragment_shader_interlock(const _mesa_glsl_parse_state
*state
)
638 return state
->ARB_fragment_shader_interlock_enable
;
642 supports_nv_fragment_shader_interlock(const _mesa_glsl_parse_state
*state
)
644 return state
->NV_fragment_shader_interlock_enable
;
648 shader_clock(const _mesa_glsl_parse_state
*state
)
650 return state
->ARB_shader_clock_enable
;
654 shader_clock_int64(const _mesa_glsl_parse_state
*state
)
656 return state
->ARB_shader_clock_enable
&&
657 (state
->ARB_gpu_shader_int64_enable
||
658 state
->AMD_gpu_shader_int64_enable
);
662 shader_storage_buffer_object(const _mesa_glsl_parse_state
*state
)
664 return state
->has_shader_storage_buffer_objects();
668 shader_trinary_minmax(const _mesa_glsl_parse_state
*state
)
670 return state
->AMD_shader_trinary_minmax_enable
;
674 shader_image_load_store(const _mesa_glsl_parse_state
*state
)
676 return (state
->is_version(420, 310) ||
677 state
->ARB_shader_image_load_store_enable
||
678 state
->EXT_shader_image_load_store_enable
);
682 shader_image_load_store_ext(const _mesa_glsl_parse_state
*state
)
684 return state
->EXT_shader_image_load_store_enable
;
688 shader_image_atomic(const _mesa_glsl_parse_state
*state
)
690 return (state
->is_version(420, 320) ||
691 state
->ARB_shader_image_load_store_enable
||
692 state
->EXT_shader_image_load_store_enable
||
693 state
->OES_shader_image_atomic_enable
);
697 shader_image_atomic_exchange_float(const _mesa_glsl_parse_state
*state
)
699 return (state
->is_version(450, 320) ||
700 state
->ARB_ES3_1_compatibility_enable
||
701 state
->OES_shader_image_atomic_enable
||
702 state
->NV_shader_atomic_float_enable
);
706 shader_image_atomic_add_float(const _mesa_glsl_parse_state
*state
)
708 return state
->NV_shader_atomic_float_enable
;
712 shader_image_size(const _mesa_glsl_parse_state
*state
)
714 return state
->is_version(430, 310) ||
715 state
->ARB_shader_image_size_enable
;
719 shader_samples(const _mesa_glsl_parse_state
*state
)
721 return state
->is_version(450, 0) ||
722 state
->ARB_shader_texture_image_samples_enable
;
726 gs_streams(const _mesa_glsl_parse_state
*state
)
728 return gpu_shader5(state
) && gs_only(state
);
732 fp64(const _mesa_glsl_parse_state
*state
)
734 return state
->has_double();
738 int64(const _mesa_glsl_parse_state
*state
)
740 return state
->has_int64();
744 int64_fp64(const _mesa_glsl_parse_state
*state
)
746 return state
->has_int64() && state
->has_double();
750 compute_shader(const _mesa_glsl_parse_state
*state
)
752 return state
->stage
== MESA_SHADER_COMPUTE
;
756 compute_shader_supported(const _mesa_glsl_parse_state
*state
)
758 return state
->has_compute_shader();
762 buffer_atomics_supported(const _mesa_glsl_parse_state
*state
)
764 return compute_shader(state
) || shader_storage_buffer_object(state
);
768 barrier_supported(const _mesa_glsl_parse_state
*state
)
770 return compute_shader(state
) ||
771 state
->stage
== MESA_SHADER_TESS_CTRL
;
775 vote(const _mesa_glsl_parse_state
*state
)
777 return state
->ARB_shader_group_vote_enable
;
781 vote_ext(const _mesa_glsl_parse_state
*state
)
783 return state
->EXT_shader_group_vote_enable
;
787 vote_or_v460_desktop(const _mesa_glsl_parse_state
*state
)
789 return state
->EXT_shader_group_vote_enable
|| state
->ARB_shader_group_vote_enable
|| v460_desktop(state
);
793 integer_functions_supported(const _mesa_glsl_parse_state
*state
)
795 return state
->extensions
->MESA_shader_integer_functions
;
799 NV_shader_atomic_float_supported(const _mesa_glsl_parse_state
*state
)
801 return state
->extensions
->NV_shader_atomic_float
;
805 shader_atomic_float_add(const _mesa_glsl_parse_state
*state
)
807 return state
->NV_shader_atomic_float_enable
;
811 shader_atomic_float_exchange(const _mesa_glsl_parse_state
*state
)
813 return state
->NV_shader_atomic_float_enable
||
814 state
->INTEL_shader_atomic_float_minmax_enable
;
818 INTEL_shader_atomic_float_minmax_supported(const _mesa_glsl_parse_state
*state
)
820 return state
->extensions
->INTEL_shader_atomic_float_minmax
;
824 shader_atomic_float_minmax(const _mesa_glsl_parse_state
*state
)
826 return state
->INTEL_shader_atomic_float_minmax_enable
;
830 demote_to_helper_invocation(const _mesa_glsl_parse_state
*state
)
832 return state
->EXT_demote_to_helper_invocation_enable
;
836 shader_integer_functions2(const _mesa_glsl_parse_state
*state
)
838 return state
->INTEL_shader_integer_functions2_enable
;
842 shader_integer_functions2_int64(const _mesa_glsl_parse_state
*state
)
844 return state
->INTEL_shader_integer_functions2_enable
&& state
->has_int64();
848 is_nir(const _mesa_glsl_parse_state
*state
)
850 return state
->ctx
->Const
.ShaderCompilerOptions
[state
->stage
].NirOptions
;
854 is_not_nir(const _mesa_glsl_parse_state
*state
)
856 return !is_nir(state
);
861 /******************************************************************************/
866 * builtin_builder: A singleton object representing the core of the built-in
869 * It generates IR for every built-in function signature, and organizes them
872 class builtin_builder
{
879 ir_function_signature
*find(_mesa_glsl_parse_state
*state
,
880 const char *name
, exec_list
*actual_parameters
);
883 * A shader to hold all the built-in signatures; created by this module.
885 * This includes signatures for every built-in, regardless of version or
886 * enabled extensions. The availability predicate associated with each
887 * signature allows matching_signature() to filter out the irrelevant ones.
894 void create_shader();
895 void create_intrinsics();
896 void create_builtins();
899 * IR builder helpers:
901 * These convenience functions assist in emitting IR, but don't necessarily
902 * fit in ir_builder itself. Many of them rely on having a mem_ctx class
905 ir_variable
*in_var(const glsl_type
*type
, const char *name
);
906 ir_variable
*out_var(const glsl_type
*type
, const char *name
);
907 ir_constant
*imm(float f
, unsigned vector_elements
=1);
908 ir_constant
*imm(bool b
, unsigned vector_elements
=1);
909 ir_constant
*imm(int i
, unsigned vector_elements
=1);
910 ir_constant
*imm(unsigned u
, unsigned vector_elements
=1);
911 ir_constant
*imm(double d
, unsigned vector_elements
=1);
912 ir_constant
*imm(const glsl_type
*type
, const ir_constant_data
&);
913 ir_dereference_variable
*var_ref(ir_variable
*var
);
914 ir_dereference_array
*array_ref(ir_variable
*var
, int i
);
915 ir_swizzle
*matrix_elt(ir_variable
*var
, int col
, int row
);
917 ir_expression
*asin_expr(ir_variable
*x
, float p0
, float p1
);
918 void do_atan(ir_factory
&body
, const glsl_type
*type
, ir_variable
*res
, operand y_over_x
);
921 * Call function \param f with parameters specified as the linked
922 * list \param params of \c ir_variable objects. \param ret should
923 * point to the ir_variable that will hold the function return
924 * value, or be \c NULL if the function has void return type.
926 ir_call
*call(ir_function
*f
, ir_variable
*ret
, exec_list params
);
928 /** Create a new function and add the given signatures. */
929 void add_function(const char *name
, ...);
931 typedef ir_function_signature
*(builtin_builder::*image_prototype_ctr
)(const glsl_type
*image_type
,
932 unsigned num_arguments
,
936 * Create a new image built-in function for all known image types.
937 * \p flags is a bitfield of \c image_function_flags flags.
939 void add_image_function(const char *name
,
940 const char *intrinsic_name
,
941 image_prototype_ctr prototype
,
942 unsigned num_arguments
,
944 enum ir_intrinsic_id id
);
947 * Create new functions for all known image built-ins and types.
948 * If \p glsl is \c true, use the GLSL built-in names and emit code
949 * to call into the actual compiler intrinsic. If \p glsl is
950 * false, emit a function prototype with no body for each image
953 void add_image_functions(bool glsl
);
955 ir_function_signature
*new_sig(const glsl_type
*return_type
,
956 builtin_available_predicate avail
,
957 int num_params
, ...);
960 * Function signature generators:
963 ir_function_signature
*unop(builtin_available_predicate avail
,
964 ir_expression_operation opcode
,
965 const glsl_type
*return_type
,
966 const glsl_type
*param_type
);
967 ir_function_signature
*binop(builtin_available_predicate avail
,
968 ir_expression_operation opcode
,
969 const glsl_type
*return_type
,
970 const glsl_type
*param0_type
,
971 const glsl_type
*param1_type
,
972 bool swap_operands
= false);
974 #define B0(X) ir_function_signature *_##X();
975 #define B1(X) ir_function_signature *_##X(const glsl_type *);
976 #define B2(X) ir_function_signature *_##X(const glsl_type *, const glsl_type *);
977 #define B3(X) ir_function_signature *_##X(const glsl_type *, const glsl_type *, const glsl_type *);
978 #define BA1(X) ir_function_signature *_##X(builtin_available_predicate, const glsl_type *);
979 #define BA2(X) ir_function_signature *_##X(builtin_available_predicate, const glsl_type *, const glsl_type *);
1019 ir_function_signature
*_mix_sel(builtin_available_predicate avail
,
1020 const glsl_type
*val_type
,
1021 const glsl_type
*blend_type
);
1031 BA1(doubleBitsToInt64
)
1032 BA1(doubleBitsToUint64
)
1033 BA1(int64BitsToDouble
)
1034 BA1(uint64BitsToDouble
)
1036 ir_function_signature
*_packUnorm2x16(builtin_available_predicate avail
);
1037 ir_function_signature
*_packSnorm2x16(builtin_available_predicate avail
);
1038 ir_function_signature
*_packUnorm4x8(builtin_available_predicate avail
);
1039 ir_function_signature
*_packSnorm4x8(builtin_available_predicate avail
);
1040 ir_function_signature
*_unpackUnorm2x16(builtin_available_predicate avail
);
1041 ir_function_signature
*_unpackSnorm2x16(builtin_available_predicate avail
);
1042 ir_function_signature
*_unpackUnorm4x8(builtin_available_predicate avail
);
1043 ir_function_signature
*_unpackSnorm4x8(builtin_available_predicate avail
);
1044 ir_function_signature
*_packHalf2x16(builtin_available_predicate avail
);
1045 ir_function_signature
*_unpackHalf2x16(builtin_available_predicate avail
);
1046 ir_function_signature
*_packDouble2x32(builtin_available_predicate avail
);
1047 ir_function_signature
*_unpackDouble2x32(builtin_available_predicate avail
);
1048 ir_function_signature
*_packInt2x32(builtin_available_predicate avail
);
1049 ir_function_signature
*_unpackInt2x32(builtin_available_predicate avail
);
1050 ir_function_signature
*_packUint2x32(builtin_available_predicate avail
);
1051 ir_function_signature
*_unpackUint2x32(builtin_available_predicate avail
);
1062 BA1(matrixCompMult
);
1064 BA1(determinant_mat2
);
1065 BA1(determinant_mat3
);
1066 BA1(determinant_mat4
);
1074 BA1(greaterThanEqual
);
1081 BA1(textureSamples
);
1083 /** Flags to _texture() */
1084 #define TEX_PROJECT 1
1085 #define TEX_OFFSET 2
1086 #define TEX_COMPONENT 4
1087 #define TEX_OFFSET_NONCONST 8
1088 #define TEX_OFFSET_ARRAY 16
1090 ir_function_signature
*_texture(ir_texture_opcode opcode
,
1091 builtin_available_predicate avail
,
1092 const glsl_type
*return_type
,
1093 const glsl_type
*sampler_type
,
1094 const glsl_type
*coord_type
,
1096 ir_function_signature
*_textureCubeArrayShadow(ir_texture_opcode opcode
,
1097 builtin_available_predicate avail
,
1098 const glsl_type
*x
);
1099 ir_function_signature
*_texelFetch(builtin_available_predicate avail
,
1100 const glsl_type
*return_type
,
1101 const glsl_type
*sampler_type
,
1102 const glsl_type
*coord_type
,
1103 const glsl_type
*offset_type
= NULL
);
1107 ir_function_signature
*_EmitStreamVertex(builtin_available_predicate avail
,
1108 const glsl_type
*stream_type
);
1109 ir_function_signature
*_EndStreamPrimitive(builtin_available_predicate avail
,
1110 const glsl_type
*stream_type
);
1113 BA2(textureQueryLod
);
1114 BA1(textureQueryLevels
);
1115 BA2(textureSamplesIdentical
);
1136 BA1(countLeadingZeros
)
1137 BA1(countTrailingZeros
)
1145 BA1(subtractSaturate
)
1146 BA1(absoluteDifference
)
1151 B1(interpolateAtCentroid
)
1152 B1(interpolateAtOffset
)
1153 B1(interpolateAtSample
)
1155 ir_function_signature
*_atomic_counter_intrinsic(builtin_available_predicate avail
,
1156 enum ir_intrinsic_id id
);
1157 ir_function_signature
*_atomic_counter_intrinsic1(builtin_available_predicate avail
,
1158 enum ir_intrinsic_id id
);
1159 ir_function_signature
*_atomic_counter_intrinsic2(builtin_available_predicate avail
,
1160 enum ir_intrinsic_id id
);
1161 ir_function_signature
*_atomic_counter_op(const char *intrinsic
,
1162 builtin_available_predicate avail
);
1163 ir_function_signature
*_atomic_counter_op1(const char *intrinsic
,
1164 builtin_available_predicate avail
);
1165 ir_function_signature
*_atomic_counter_op2(const char *intrinsic
,
1166 builtin_available_predicate avail
);
1168 ir_function_signature
*_atomic_intrinsic2(builtin_available_predicate avail
,
1169 const glsl_type
*type
,
1170 enum ir_intrinsic_id id
);
1171 ir_function_signature
*_atomic_op2(const char *intrinsic
,
1172 builtin_available_predicate avail
,
1173 const glsl_type
*type
);
1174 ir_function_signature
*_atomic_intrinsic3(builtin_available_predicate avail
,
1175 const glsl_type
*type
,
1176 enum ir_intrinsic_id id
);
1177 ir_function_signature
*_atomic_op3(const char *intrinsic
,
1178 builtin_available_predicate avail
,
1179 const glsl_type
*type
);
1185 ir_function_signature
*_image_prototype(const glsl_type
*image_type
,
1186 unsigned num_arguments
,
1188 ir_function_signature
*_image_size_prototype(const glsl_type
*image_type
,
1189 unsigned num_arguments
,
1191 ir_function_signature
*_image_samples_prototype(const glsl_type
*image_type
,
1192 unsigned num_arguments
,
1194 ir_function_signature
*_image(image_prototype_ctr prototype
,
1195 const glsl_type
*image_type
,
1196 const char *intrinsic_name
,
1197 unsigned num_arguments
,
1199 enum ir_intrinsic_id id
);
1201 ir_function_signature
*_memory_barrier_intrinsic(
1202 builtin_available_predicate avail
,
1203 enum ir_intrinsic_id id
);
1204 ir_function_signature
*_memory_barrier(const char *intrinsic_name
,
1205 builtin_available_predicate avail
);
1207 ir_function_signature
*_ballot_intrinsic();
1208 ir_function_signature
*_ballot();
1209 ir_function_signature
*_read_first_invocation_intrinsic(const glsl_type
*type
);
1210 ir_function_signature
*_read_first_invocation(const glsl_type
*type
);
1211 ir_function_signature
*_read_invocation_intrinsic(const glsl_type
*type
);
1212 ir_function_signature
*_read_invocation(const glsl_type
*type
);
1215 ir_function_signature
*_invocation_interlock_intrinsic(
1216 builtin_available_predicate avail
,
1217 enum ir_intrinsic_id id
);
1218 ir_function_signature
*_invocation_interlock(
1219 const char *intrinsic_name
,
1220 builtin_available_predicate avail
);
1222 ir_function_signature
*_shader_clock_intrinsic(builtin_available_predicate avail
,
1223 const glsl_type
*type
);
1224 ir_function_signature
*_shader_clock(builtin_available_predicate avail
,
1225 const glsl_type
*type
);
1227 ir_function_signature
*_vote_intrinsic(builtin_available_predicate avail
,
1228 enum ir_intrinsic_id id
);
1229 ir_function_signature
*_vote(const char *intrinsic_name
,
1230 builtin_available_predicate avail
);
1232 ir_function_signature
*_helper_invocation_intrinsic();
1233 ir_function_signature
*_helper_invocation();
1244 enum image_function_flags
{
1245 IMAGE_FUNCTION_EMIT_STUB
= (1 << 0),
1246 IMAGE_FUNCTION_RETURNS_VOID
= (1 << 1),
1247 IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE
= (1 << 2),
1248 IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
= (1 << 3),
1249 IMAGE_FUNCTION_READ_ONLY
= (1 << 4),
1250 IMAGE_FUNCTION_WRITE_ONLY
= (1 << 5),
1251 IMAGE_FUNCTION_AVAIL_ATOMIC
= (1 << 6),
1252 IMAGE_FUNCTION_MS_ONLY
= (1 << 7),
1253 IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE
= (1 << 8),
1254 IMAGE_FUNCTION_AVAIL_ATOMIC_ADD
= (1 << 9),
1255 IMAGE_FUNCTION_EXT_ONLY
= (1 << 10),
1256 IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
= (1 << 11),
1259 } /* anonymous namespace */
1262 * Core builtin_builder functionality:
1265 builtin_builder::builtin_builder()
1271 builtin_builder::~builtin_builder()
1273 ralloc_free(mem_ctx
);
1276 ir_function_signature
*
1277 builtin_builder::find(_mesa_glsl_parse_state
*state
,
1278 const char *name
, exec_list
*actual_parameters
)
1280 /* The shader currently being compiled requested a built-in function;
1281 * it needs to link against builtin_builder::shader in order to get them.
1283 * Even if we don't find a matching signature, we still need to do this so
1284 * that the "no matching signature" error will list potential candidates
1285 * from the available built-ins.
1287 state
->uses_builtin_functions
= true;
1289 ir_function
*f
= shader
->symbols
->get_function(name
);
1293 ir_function_signature
*sig
=
1294 f
->matching_signature(state
, actual_parameters
, true);
1302 builtin_builder::initialize()
1304 /* If already initialized, don't do it again. */
1305 if (mem_ctx
!= NULL
)
1308 glsl_type_singleton_init_or_ref();
1310 mem_ctx
= ralloc_context(NULL
);
1312 create_intrinsics();
1317 builtin_builder::release()
1319 ralloc_free(mem_ctx
);
1322 ralloc_free(shader
);
1325 glsl_type_singleton_decref();
1329 builtin_builder::create_shader()
1331 /* The target doesn't actually matter. There's no target for generic
1332 * GLSL utility code that could be linked against any stage, so just
1333 * arbitrarily pick GL_VERTEX_SHADER.
1335 shader
= _mesa_new_shader(0, MESA_SHADER_VERTEX
);
1336 shader
->symbols
= new(mem_ctx
) glsl_symbol_table
;
1342 * Create ir_function and ir_function_signature objects for each
1346 builtin_builder::create_intrinsics()
1348 add_function("__intrinsic_atomic_read",
1349 _atomic_counter_intrinsic(shader_atomic_counters
,
1350 ir_intrinsic_atomic_counter_read
),
1352 add_function("__intrinsic_atomic_increment",
1353 _atomic_counter_intrinsic(shader_atomic_counters
,
1354 ir_intrinsic_atomic_counter_increment
),
1356 add_function("__intrinsic_atomic_predecrement",
1357 _atomic_counter_intrinsic(shader_atomic_counters
,
1358 ir_intrinsic_atomic_counter_predecrement
),
1361 add_function("__intrinsic_atomic_add",
1362 _atomic_intrinsic2(buffer_atomics_supported
,
1363 glsl_type::uint_type
,
1364 ir_intrinsic_generic_atomic_add
),
1365 _atomic_intrinsic2(buffer_atomics_supported
,
1366 glsl_type::int_type
,
1367 ir_intrinsic_generic_atomic_add
),
1368 _atomic_intrinsic2(NV_shader_atomic_float_supported
,
1369 glsl_type::float_type
,
1370 ir_intrinsic_generic_atomic_add
),
1371 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1372 ir_intrinsic_atomic_counter_add
),
1374 add_function("__intrinsic_atomic_min",
1375 _atomic_intrinsic2(buffer_atomics_supported
,
1376 glsl_type::uint_type
,
1377 ir_intrinsic_generic_atomic_min
),
1378 _atomic_intrinsic2(buffer_atomics_supported
,
1379 glsl_type::int_type
,
1380 ir_intrinsic_generic_atomic_min
),
1381 _atomic_intrinsic2(INTEL_shader_atomic_float_minmax_supported
,
1382 glsl_type::float_type
,
1383 ir_intrinsic_generic_atomic_min
),
1384 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1385 ir_intrinsic_atomic_counter_min
),
1387 add_function("__intrinsic_atomic_max",
1388 _atomic_intrinsic2(buffer_atomics_supported
,
1389 glsl_type::uint_type
,
1390 ir_intrinsic_generic_atomic_max
),
1391 _atomic_intrinsic2(buffer_atomics_supported
,
1392 glsl_type::int_type
,
1393 ir_intrinsic_generic_atomic_max
),
1394 _atomic_intrinsic2(INTEL_shader_atomic_float_minmax_supported
,
1395 glsl_type::float_type
,
1396 ir_intrinsic_generic_atomic_max
),
1397 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1398 ir_intrinsic_atomic_counter_max
),
1400 add_function("__intrinsic_atomic_and",
1401 _atomic_intrinsic2(buffer_atomics_supported
,
1402 glsl_type::uint_type
,
1403 ir_intrinsic_generic_atomic_and
),
1404 _atomic_intrinsic2(buffer_atomics_supported
,
1405 glsl_type::int_type
,
1406 ir_intrinsic_generic_atomic_and
),
1407 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1408 ir_intrinsic_atomic_counter_and
),
1410 add_function("__intrinsic_atomic_or",
1411 _atomic_intrinsic2(buffer_atomics_supported
,
1412 glsl_type::uint_type
,
1413 ir_intrinsic_generic_atomic_or
),
1414 _atomic_intrinsic2(buffer_atomics_supported
,
1415 glsl_type::int_type
,
1416 ir_intrinsic_generic_atomic_or
),
1417 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1418 ir_intrinsic_atomic_counter_or
),
1420 add_function("__intrinsic_atomic_xor",
1421 _atomic_intrinsic2(buffer_atomics_supported
,
1422 glsl_type::uint_type
,
1423 ir_intrinsic_generic_atomic_xor
),
1424 _atomic_intrinsic2(buffer_atomics_supported
,
1425 glsl_type::int_type
,
1426 ir_intrinsic_generic_atomic_xor
),
1427 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1428 ir_intrinsic_atomic_counter_xor
),
1430 add_function("__intrinsic_atomic_exchange",
1431 _atomic_intrinsic2(buffer_atomics_supported
,
1432 glsl_type::uint_type
,
1433 ir_intrinsic_generic_atomic_exchange
),
1434 _atomic_intrinsic2(buffer_atomics_supported
,
1435 glsl_type::int_type
,
1436 ir_intrinsic_generic_atomic_exchange
),
1437 _atomic_intrinsic2(NV_shader_atomic_float_supported
,
1438 glsl_type::float_type
,
1439 ir_intrinsic_generic_atomic_exchange
),
1440 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1441 ir_intrinsic_atomic_counter_exchange
),
1443 add_function("__intrinsic_atomic_comp_swap",
1444 _atomic_intrinsic3(buffer_atomics_supported
,
1445 glsl_type::uint_type
,
1446 ir_intrinsic_generic_atomic_comp_swap
),
1447 _atomic_intrinsic3(buffer_atomics_supported
,
1448 glsl_type::int_type
,
1449 ir_intrinsic_generic_atomic_comp_swap
),
1450 _atomic_intrinsic3(INTEL_shader_atomic_float_minmax_supported
,
1451 glsl_type::float_type
,
1452 ir_intrinsic_generic_atomic_comp_swap
),
1453 _atomic_counter_intrinsic2(shader_atomic_counter_ops_or_v460_desktop
,
1454 ir_intrinsic_atomic_counter_comp_swap
),
1457 add_image_functions(false);
1459 add_function("__intrinsic_memory_barrier",
1460 _memory_barrier_intrinsic(shader_image_load_store
,
1461 ir_intrinsic_memory_barrier
),
1463 add_function("__intrinsic_group_memory_barrier",
1464 _memory_barrier_intrinsic(compute_shader
,
1465 ir_intrinsic_group_memory_barrier
),
1467 add_function("__intrinsic_memory_barrier_atomic_counter",
1468 _memory_barrier_intrinsic(compute_shader_supported
,
1469 ir_intrinsic_memory_barrier_atomic_counter
),
1471 add_function("__intrinsic_memory_barrier_buffer",
1472 _memory_barrier_intrinsic(compute_shader_supported
,
1473 ir_intrinsic_memory_barrier_buffer
),
1475 add_function("__intrinsic_memory_barrier_image",
1476 _memory_barrier_intrinsic(compute_shader_supported
,
1477 ir_intrinsic_memory_barrier_image
),
1479 add_function("__intrinsic_memory_barrier_shared",
1480 _memory_barrier_intrinsic(compute_shader
,
1481 ir_intrinsic_memory_barrier_shared
),
1484 add_function("__intrinsic_begin_invocation_interlock",
1485 _invocation_interlock_intrinsic(
1486 supports_arb_fragment_shader_interlock
,
1487 ir_intrinsic_begin_invocation_interlock
), NULL
);
1489 add_function("__intrinsic_end_invocation_interlock",
1490 _invocation_interlock_intrinsic(
1491 supports_arb_fragment_shader_interlock
,
1492 ir_intrinsic_end_invocation_interlock
), NULL
);
1494 add_function("__intrinsic_shader_clock",
1495 _shader_clock_intrinsic(shader_clock
,
1496 glsl_type::uvec2_type
),
1499 add_function("__intrinsic_vote_all",
1500 _vote_intrinsic(vote_or_v460_desktop
, ir_intrinsic_vote_all
),
1502 add_function("__intrinsic_vote_any",
1503 _vote_intrinsic(vote_or_v460_desktop
, ir_intrinsic_vote_any
),
1505 add_function("__intrinsic_vote_eq",
1506 _vote_intrinsic(vote_or_v460_desktop
, ir_intrinsic_vote_eq
),
1509 add_function("__intrinsic_ballot", _ballot_intrinsic(), NULL
);
1511 add_function("__intrinsic_read_invocation",
1512 _read_invocation_intrinsic(glsl_type::float_type
),
1513 _read_invocation_intrinsic(glsl_type::vec2_type
),
1514 _read_invocation_intrinsic(glsl_type::vec3_type
),
1515 _read_invocation_intrinsic(glsl_type::vec4_type
),
1517 _read_invocation_intrinsic(glsl_type::int_type
),
1518 _read_invocation_intrinsic(glsl_type::ivec2_type
),
1519 _read_invocation_intrinsic(glsl_type::ivec3_type
),
1520 _read_invocation_intrinsic(glsl_type::ivec4_type
),
1522 _read_invocation_intrinsic(glsl_type::uint_type
),
1523 _read_invocation_intrinsic(glsl_type::uvec2_type
),
1524 _read_invocation_intrinsic(glsl_type::uvec3_type
),
1525 _read_invocation_intrinsic(glsl_type::uvec4_type
),
1528 add_function("__intrinsic_read_first_invocation",
1529 _read_first_invocation_intrinsic(glsl_type::float_type
),
1530 _read_first_invocation_intrinsic(glsl_type::vec2_type
),
1531 _read_first_invocation_intrinsic(glsl_type::vec3_type
),
1532 _read_first_invocation_intrinsic(glsl_type::vec4_type
),
1534 _read_first_invocation_intrinsic(glsl_type::int_type
),
1535 _read_first_invocation_intrinsic(glsl_type::ivec2_type
),
1536 _read_first_invocation_intrinsic(glsl_type::ivec3_type
),
1537 _read_first_invocation_intrinsic(glsl_type::ivec4_type
),
1539 _read_first_invocation_intrinsic(glsl_type::uint_type
),
1540 _read_first_invocation_intrinsic(glsl_type::uvec2_type
),
1541 _read_first_invocation_intrinsic(glsl_type::uvec3_type
),
1542 _read_first_invocation_intrinsic(glsl_type::uvec4_type
),
1545 add_function("__intrinsic_helper_invocation",
1546 _helper_invocation_intrinsic(), NULL
);
1550 * Create ir_function and ir_function_signature objects for each built-in.
1552 * Contains a list of every available built-in.
1555 builtin_builder::create_builtins()
1558 add_function(#NAME, \
1559 _##NAME(glsl_type::float_type), \
1560 _##NAME(glsl_type::vec2_type), \
1561 _##NAME(glsl_type::vec3_type), \
1562 _##NAME(glsl_type::vec4_type), \
1566 add_function(#NAME, \
1567 _##NAME(always_available, glsl_type::float_type), \
1568 _##NAME(always_available, glsl_type::vec2_type), \
1569 _##NAME(always_available, glsl_type::vec3_type), \
1570 _##NAME(always_available, glsl_type::vec4_type), \
1571 _##NAME(fp64, glsl_type::double_type), \
1572 _##NAME(fp64, glsl_type::dvec2_type), \
1573 _##NAME(fp64, glsl_type::dvec3_type), \
1574 _##NAME(fp64, glsl_type::dvec4_type), \
1577 #define FD130(NAME) \
1578 add_function(#NAME, \
1579 _##NAME(v130, glsl_type::float_type), \
1580 _##NAME(v130, glsl_type::vec2_type), \
1581 _##NAME(v130, glsl_type::vec3_type), \
1582 _##NAME(v130, glsl_type::vec4_type), \
1583 _##NAME(fp64, glsl_type::double_type), \
1584 _##NAME(fp64, glsl_type::dvec2_type), \
1585 _##NAME(fp64, glsl_type::dvec3_type), \
1586 _##NAME(fp64, glsl_type::dvec4_type), \
1589 #define FDGS5(NAME) \
1590 add_function(#NAME, \
1591 _##NAME(gpu_shader5_es, glsl_type::float_type), \
1592 _##NAME(gpu_shader5_es, glsl_type::vec2_type), \
1593 _##NAME(gpu_shader5_es, glsl_type::vec3_type), \
1594 _##NAME(gpu_shader5_es, glsl_type::vec4_type), \
1595 _##NAME(fp64, glsl_type::double_type), \
1596 _##NAME(fp64, glsl_type::dvec2_type), \
1597 _##NAME(fp64, glsl_type::dvec3_type), \
1598 _##NAME(fp64, glsl_type::dvec4_type), \
1602 add_function(#NAME, \
1603 _##NAME(glsl_type::float_type), \
1604 _##NAME(glsl_type::vec2_type), \
1605 _##NAME(glsl_type::vec3_type), \
1606 _##NAME(glsl_type::vec4_type), \
1607 _##NAME(glsl_type::int_type), \
1608 _##NAME(glsl_type::ivec2_type), \
1609 _##NAME(glsl_type::ivec3_type), \
1610 _##NAME(glsl_type::ivec4_type), \
1613 #define FI64(NAME) \
1614 add_function(#NAME, \
1615 _##NAME(always_available, glsl_type::float_type), \
1616 _##NAME(always_available, glsl_type::vec2_type), \
1617 _##NAME(always_available, glsl_type::vec3_type), \
1618 _##NAME(always_available, glsl_type::vec4_type), \
1619 _##NAME(always_available, glsl_type::int_type), \
1620 _##NAME(always_available, glsl_type::ivec2_type), \
1621 _##NAME(always_available, glsl_type::ivec3_type), \
1622 _##NAME(always_available, glsl_type::ivec4_type), \
1623 _##NAME(fp64, glsl_type::double_type), \
1624 _##NAME(fp64, glsl_type::dvec2_type), \
1625 _##NAME(fp64, glsl_type::dvec3_type), \
1626 _##NAME(fp64, glsl_type::dvec4_type), \
1627 _##NAME(int64, glsl_type::int64_t_type), \
1628 _##NAME(int64, glsl_type::i64vec2_type), \
1629 _##NAME(int64, glsl_type::i64vec3_type), \
1630 _##NAME(int64, glsl_type::i64vec4_type), \
1633 #define FIUD_VEC(NAME) \
1634 add_function(#NAME, \
1635 _##NAME(always_available, glsl_type::vec2_type), \
1636 _##NAME(always_available, glsl_type::vec3_type), \
1637 _##NAME(always_available, glsl_type::vec4_type), \
1639 _##NAME(always_available, glsl_type::ivec2_type), \
1640 _##NAME(always_available, glsl_type::ivec3_type), \
1641 _##NAME(always_available, glsl_type::ivec4_type), \
1643 _##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type), \
1644 _##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type), \
1645 _##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type), \
1646 _##NAME(fp64, glsl_type::dvec2_type), \
1647 _##NAME(fp64, glsl_type::dvec3_type), \
1648 _##NAME(fp64, glsl_type::dvec4_type), \
1649 _##NAME(int64, glsl_type::int64_t_type), \
1650 _##NAME(int64, glsl_type::i64vec2_type), \
1651 _##NAME(int64, glsl_type::i64vec3_type), \
1652 _##NAME(int64, glsl_type::i64vec4_type), \
1653 _##NAME(int64, glsl_type::uint64_t_type), \
1654 _##NAME(int64, glsl_type::u64vec2_type), \
1655 _##NAME(int64, glsl_type::u64vec3_type), \
1656 _##NAME(int64, glsl_type::u64vec4_type), \
1660 add_function(#NAME, \
1661 _##NAME(glsl_type::int_type), \
1662 _##NAME(glsl_type::ivec2_type), \
1663 _##NAME(glsl_type::ivec3_type), \
1664 _##NAME(glsl_type::ivec4_type), \
1666 _##NAME(glsl_type::uint_type), \
1667 _##NAME(glsl_type::uvec2_type), \
1668 _##NAME(glsl_type::uvec3_type), \
1669 _##NAME(glsl_type::uvec4_type), \
1672 #define FIUBD_VEC(NAME) \
1673 add_function(#NAME, \
1674 _##NAME(always_available, glsl_type::vec2_type), \
1675 _##NAME(always_available, glsl_type::vec3_type), \
1676 _##NAME(always_available, glsl_type::vec4_type), \
1678 _##NAME(always_available, glsl_type::ivec2_type), \
1679 _##NAME(always_available, glsl_type::ivec3_type), \
1680 _##NAME(always_available, glsl_type::ivec4_type), \
1682 _##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type), \
1683 _##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type), \
1684 _##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type), \
1686 _##NAME(always_available, glsl_type::bvec2_type), \
1687 _##NAME(always_available, glsl_type::bvec3_type), \
1688 _##NAME(always_available, glsl_type::bvec4_type), \
1690 _##NAME(fp64, glsl_type::dvec2_type), \
1691 _##NAME(fp64, glsl_type::dvec3_type), \
1692 _##NAME(fp64, glsl_type::dvec4_type), \
1693 _##NAME(int64, glsl_type::int64_t_type), \
1694 _##NAME(int64, glsl_type::i64vec2_type), \
1695 _##NAME(int64, glsl_type::i64vec3_type), \
1696 _##NAME(int64, glsl_type::i64vec4_type), \
1697 _##NAME(int64, glsl_type::uint64_t_type), \
1698 _##NAME(int64, glsl_type::u64vec2_type), \
1699 _##NAME(int64, glsl_type::u64vec3_type), \
1700 _##NAME(int64, glsl_type::u64vec4_type), \
1703 #define FIUD2_MIXED(NAME) \
1704 add_function(#NAME, \
1705 _##NAME(always_available, glsl_type::float_type, glsl_type::float_type), \
1706 _##NAME(always_available, glsl_type::vec2_type, glsl_type::float_type), \
1707 _##NAME(always_available, glsl_type::vec3_type, glsl_type::float_type), \
1708 _##NAME(always_available, glsl_type::vec4_type, glsl_type::float_type), \
1710 _##NAME(always_available, glsl_type::vec2_type, glsl_type::vec2_type), \
1711 _##NAME(always_available, glsl_type::vec3_type, glsl_type::vec3_type), \
1712 _##NAME(always_available, glsl_type::vec4_type, glsl_type::vec4_type), \
1714 _##NAME(always_available, glsl_type::int_type, glsl_type::int_type), \
1715 _##NAME(always_available, glsl_type::ivec2_type, glsl_type::int_type), \
1716 _##NAME(always_available, glsl_type::ivec3_type, glsl_type::int_type), \
1717 _##NAME(always_available, glsl_type::ivec4_type, glsl_type::int_type), \
1719 _##NAME(always_available, glsl_type::ivec2_type, glsl_type::ivec2_type), \
1720 _##NAME(always_available, glsl_type::ivec3_type, glsl_type::ivec3_type), \
1721 _##NAME(always_available, glsl_type::ivec4_type, glsl_type::ivec4_type), \
1723 _##NAME(v130_or_gpu_shader4, glsl_type::uint_type, glsl_type::uint_type), \
1724 _##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type, glsl_type::uint_type), \
1725 _##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type, glsl_type::uint_type), \
1726 _##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type, glsl_type::uint_type), \
1728 _##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type, glsl_type::uvec2_type), \
1729 _##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type, glsl_type::uvec3_type), \
1730 _##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type, glsl_type::uvec4_type), \
1732 _##NAME(fp64, glsl_type::double_type, glsl_type::double_type), \
1733 _##NAME(fp64, glsl_type::dvec2_type, glsl_type::double_type), \
1734 _##NAME(fp64, glsl_type::dvec3_type, glsl_type::double_type), \
1735 _##NAME(fp64, glsl_type::dvec4_type, glsl_type::double_type), \
1736 _##NAME(fp64, glsl_type::dvec2_type, glsl_type::dvec2_type), \
1737 _##NAME(fp64, glsl_type::dvec3_type, glsl_type::dvec3_type), \
1738 _##NAME(fp64, glsl_type::dvec4_type, glsl_type::dvec4_type), \
1740 _##NAME(int64, glsl_type::int64_t_type, glsl_type::int64_t_type), \
1741 _##NAME(int64, glsl_type::i64vec2_type, glsl_type::int64_t_type), \
1742 _##NAME(int64, glsl_type::i64vec3_type, glsl_type::int64_t_type), \
1743 _##NAME(int64, glsl_type::i64vec4_type, glsl_type::int64_t_type), \
1744 _##NAME(int64, glsl_type::i64vec2_type, glsl_type::i64vec2_type), \
1745 _##NAME(int64, glsl_type::i64vec3_type, glsl_type::i64vec3_type), \
1746 _##NAME(int64, glsl_type::i64vec4_type, glsl_type::i64vec4_type), \
1747 _##NAME(int64, glsl_type::uint64_t_type, glsl_type::uint64_t_type), \
1748 _##NAME(int64, glsl_type::u64vec2_type, glsl_type::uint64_t_type), \
1749 _##NAME(int64, glsl_type::u64vec3_type, glsl_type::uint64_t_type), \
1750 _##NAME(int64, glsl_type::u64vec4_type, glsl_type::uint64_t_type), \
1751 _##NAME(int64, glsl_type::u64vec2_type, glsl_type::u64vec2_type), \
1752 _##NAME(int64, glsl_type::u64vec3_type, glsl_type::u64vec3_type), \
1753 _##NAME(int64, glsl_type::u64vec4_type, glsl_type::u64vec4_type), \
1764 add_function("atan",
1765 _atan(glsl_type::float_type
),
1766 _atan(glsl_type::vec2_type
),
1767 _atan(glsl_type::vec3_type
),
1768 _atan(glsl_type::vec4_type
),
1769 _atan2(glsl_type::float_type
),
1770 _atan2(glsl_type::vec2_type
),
1771 _atan2(glsl_type::vec3_type
),
1772 _atan2(glsl_type::vec4_type
),
1773 _atan_op(glsl_type::float_type
),
1774 _atan_op(glsl_type::vec2_type
),
1775 _atan_op(glsl_type::vec3_type
),
1776 _atan_op(glsl_type::vec4_type
),
1777 _atan2_op(glsl_type::float_type
),
1778 _atan2_op(glsl_type::vec2_type
),
1779 _atan2_op(glsl_type::vec3_type
),
1780 _atan2_op(glsl_type::vec4_type
),
1805 add_function("truncate",
1806 _truncate(gpu_shader4
, glsl_type::float_type
),
1807 _truncate(gpu_shader4
, glsl_type::vec2_type
),
1808 _truncate(gpu_shader4
, glsl_type::vec3_type
),
1809 _truncate(gpu_shader4
, glsl_type::vec4_type
),
1814 _mod(always_available
, glsl_type::float_type
, glsl_type::float_type
),
1815 _mod(always_available
, glsl_type::vec2_type
, glsl_type::float_type
),
1816 _mod(always_available
, glsl_type::vec3_type
, glsl_type::float_type
),
1817 _mod(always_available
, glsl_type::vec4_type
, glsl_type::float_type
),
1819 _mod(always_available
, glsl_type::vec2_type
, glsl_type::vec2_type
),
1820 _mod(always_available
, glsl_type::vec3_type
, glsl_type::vec3_type
),
1821 _mod(always_available
, glsl_type::vec4_type
, glsl_type::vec4_type
),
1823 _mod(fp64
, glsl_type::double_type
, glsl_type::double_type
),
1824 _mod(fp64
, glsl_type::dvec2_type
, glsl_type::double_type
),
1825 _mod(fp64
, glsl_type::dvec3_type
, glsl_type::double_type
),
1826 _mod(fp64
, glsl_type::dvec4_type
, glsl_type::double_type
),
1828 _mod(fp64
, glsl_type::dvec2_type
, glsl_type::dvec2_type
),
1829 _mod(fp64
, glsl_type::dvec3_type
, glsl_type::dvec3_type
),
1830 _mod(fp64
, glsl_type::dvec4_type
, glsl_type::dvec4_type
),
1840 _mix_lrp(always_available
, glsl_type::float_type
, glsl_type::float_type
),
1841 _mix_lrp(always_available
, glsl_type::vec2_type
, glsl_type::float_type
),
1842 _mix_lrp(always_available
, glsl_type::vec3_type
, glsl_type::float_type
),
1843 _mix_lrp(always_available
, glsl_type::vec4_type
, glsl_type::float_type
),
1845 _mix_lrp(always_available
, glsl_type::vec2_type
, glsl_type::vec2_type
),
1846 _mix_lrp(always_available
, glsl_type::vec3_type
, glsl_type::vec3_type
),
1847 _mix_lrp(always_available
, glsl_type::vec4_type
, glsl_type::vec4_type
),
1849 _mix_lrp(fp64
, glsl_type::double_type
, glsl_type::double_type
),
1850 _mix_lrp(fp64
, glsl_type::dvec2_type
, glsl_type::double_type
),
1851 _mix_lrp(fp64
, glsl_type::dvec3_type
, glsl_type::double_type
),
1852 _mix_lrp(fp64
, glsl_type::dvec4_type
, glsl_type::double_type
),
1854 _mix_lrp(fp64
, glsl_type::dvec2_type
, glsl_type::dvec2_type
),
1855 _mix_lrp(fp64
, glsl_type::dvec3_type
, glsl_type::dvec3_type
),
1856 _mix_lrp(fp64
, glsl_type::dvec4_type
, glsl_type::dvec4_type
),
1858 _mix_sel(v130
, glsl_type::float_type
, glsl_type::bool_type
),
1859 _mix_sel(v130
, glsl_type::vec2_type
, glsl_type::bvec2_type
),
1860 _mix_sel(v130
, glsl_type::vec3_type
, glsl_type::bvec3_type
),
1861 _mix_sel(v130
, glsl_type::vec4_type
, glsl_type::bvec4_type
),
1863 _mix_sel(fp64
, glsl_type::double_type
, glsl_type::bool_type
),
1864 _mix_sel(fp64
, glsl_type::dvec2_type
, glsl_type::bvec2_type
),
1865 _mix_sel(fp64
, glsl_type::dvec3_type
, glsl_type::bvec3_type
),
1866 _mix_sel(fp64
, glsl_type::dvec4_type
, glsl_type::bvec4_type
),
1868 _mix_sel(shader_integer_mix
, glsl_type::int_type
, glsl_type::bool_type
),
1869 _mix_sel(shader_integer_mix
, glsl_type::ivec2_type
, glsl_type::bvec2_type
),
1870 _mix_sel(shader_integer_mix
, glsl_type::ivec3_type
, glsl_type::bvec3_type
),
1871 _mix_sel(shader_integer_mix
, glsl_type::ivec4_type
, glsl_type::bvec4_type
),
1873 _mix_sel(shader_integer_mix
, glsl_type::uint_type
, glsl_type::bool_type
),
1874 _mix_sel(shader_integer_mix
, glsl_type::uvec2_type
, glsl_type::bvec2_type
),
1875 _mix_sel(shader_integer_mix
, glsl_type::uvec3_type
, glsl_type::bvec3_type
),
1876 _mix_sel(shader_integer_mix
, glsl_type::uvec4_type
, glsl_type::bvec4_type
),
1878 _mix_sel(shader_integer_mix
, glsl_type::bool_type
, glsl_type::bool_type
),
1879 _mix_sel(shader_integer_mix
, glsl_type::bvec2_type
, glsl_type::bvec2_type
),
1880 _mix_sel(shader_integer_mix
, glsl_type::bvec3_type
, glsl_type::bvec3_type
),
1881 _mix_sel(shader_integer_mix
, glsl_type::bvec4_type
, glsl_type::bvec4_type
),
1883 _mix_sel(int64
, glsl_type::int64_t_type
, glsl_type::bool_type
),
1884 _mix_sel(int64
, glsl_type::i64vec2_type
, glsl_type::bvec2_type
),
1885 _mix_sel(int64
, glsl_type::i64vec3_type
, glsl_type::bvec3_type
),
1886 _mix_sel(int64
, glsl_type::i64vec4_type
, glsl_type::bvec4_type
),
1888 _mix_sel(int64
, glsl_type::uint64_t_type
, glsl_type::bool_type
),
1889 _mix_sel(int64
, glsl_type::u64vec2_type
, glsl_type::bvec2_type
),
1890 _mix_sel(int64
, glsl_type::u64vec3_type
, glsl_type::bvec3_type
),
1891 _mix_sel(int64
, glsl_type::u64vec4_type
, glsl_type::bvec4_type
),
1894 add_function("step",
1895 _step(always_available
, glsl_type::float_type
, glsl_type::float_type
),
1896 _step(always_available
, glsl_type::float_type
, glsl_type::vec2_type
),
1897 _step(always_available
, glsl_type::float_type
, glsl_type::vec3_type
),
1898 _step(always_available
, glsl_type::float_type
, glsl_type::vec4_type
),
1900 _step(always_available
, glsl_type::vec2_type
, glsl_type::vec2_type
),
1901 _step(always_available
, glsl_type::vec3_type
, glsl_type::vec3_type
),
1902 _step(always_available
, glsl_type::vec4_type
, glsl_type::vec4_type
),
1903 _step(fp64
, glsl_type::double_type
, glsl_type::double_type
),
1904 _step(fp64
, glsl_type::double_type
, glsl_type::dvec2_type
),
1905 _step(fp64
, glsl_type::double_type
, glsl_type::dvec3_type
),
1906 _step(fp64
, glsl_type::double_type
, glsl_type::dvec4_type
),
1908 _step(fp64
, glsl_type::dvec2_type
, glsl_type::dvec2_type
),
1909 _step(fp64
, glsl_type::dvec3_type
, glsl_type::dvec3_type
),
1910 _step(fp64
, glsl_type::dvec4_type
, glsl_type::dvec4_type
),
1913 add_function("smoothstep",
1914 _smoothstep(always_available
, glsl_type::float_type
, glsl_type::float_type
),
1915 _smoothstep(always_available
, glsl_type::float_type
, glsl_type::vec2_type
),
1916 _smoothstep(always_available
, glsl_type::float_type
, glsl_type::vec3_type
),
1917 _smoothstep(always_available
, glsl_type::float_type
, glsl_type::vec4_type
),
1919 _smoothstep(always_available
, glsl_type::vec2_type
, glsl_type::vec2_type
),
1920 _smoothstep(always_available
, glsl_type::vec3_type
, glsl_type::vec3_type
),
1921 _smoothstep(always_available
, glsl_type::vec4_type
, glsl_type::vec4_type
),
1922 _smoothstep(fp64
, glsl_type::double_type
, glsl_type::double_type
),
1923 _smoothstep(fp64
, glsl_type::double_type
, glsl_type::dvec2_type
),
1924 _smoothstep(fp64
, glsl_type::double_type
, glsl_type::dvec3_type
),
1925 _smoothstep(fp64
, glsl_type::double_type
, glsl_type::dvec4_type
),
1927 _smoothstep(fp64
, glsl_type::dvec2_type
, glsl_type::dvec2_type
),
1928 _smoothstep(fp64
, glsl_type::dvec3_type
, glsl_type::dvec3_type
),
1929 _smoothstep(fp64
, glsl_type::dvec4_type
, glsl_type::dvec4_type
),
1937 add_function("intBitsToFloat",
1938 _intBitsToFloat(glsl_type::int_type
),
1939 _intBitsToFloat(glsl_type::ivec2_type
),
1940 _intBitsToFloat(glsl_type::ivec3_type
),
1941 _intBitsToFloat(glsl_type::ivec4_type
),
1943 add_function("uintBitsToFloat",
1944 _uintBitsToFloat(glsl_type::uint_type
),
1945 _uintBitsToFloat(glsl_type::uvec2_type
),
1946 _uintBitsToFloat(glsl_type::uvec3_type
),
1947 _uintBitsToFloat(glsl_type::uvec4_type
),
1950 add_function("doubleBitsToInt64",
1951 _doubleBitsToInt64(int64_fp64
, glsl_type::double_type
),
1952 _doubleBitsToInt64(int64_fp64
, glsl_type::dvec2_type
),
1953 _doubleBitsToInt64(int64_fp64
, glsl_type::dvec3_type
),
1954 _doubleBitsToInt64(int64_fp64
, glsl_type::dvec4_type
),
1957 add_function("doubleBitsToUint64",
1958 _doubleBitsToUint64(int64_fp64
, glsl_type::double_type
),
1959 _doubleBitsToUint64(int64_fp64
, glsl_type::dvec2_type
),
1960 _doubleBitsToUint64(int64_fp64
, glsl_type::dvec3_type
),
1961 _doubleBitsToUint64(int64_fp64
, glsl_type::dvec4_type
),
1964 add_function("int64BitsToDouble",
1965 _int64BitsToDouble(int64_fp64
, glsl_type::int64_t_type
),
1966 _int64BitsToDouble(int64_fp64
, glsl_type::i64vec2_type
),
1967 _int64BitsToDouble(int64_fp64
, glsl_type::i64vec3_type
),
1968 _int64BitsToDouble(int64_fp64
, glsl_type::i64vec4_type
),
1971 add_function("uint64BitsToDouble",
1972 _uint64BitsToDouble(int64_fp64
, glsl_type::uint64_t_type
),
1973 _uint64BitsToDouble(int64_fp64
, glsl_type::u64vec2_type
),
1974 _uint64BitsToDouble(int64_fp64
, glsl_type::u64vec3_type
),
1975 _uint64BitsToDouble(int64_fp64
, glsl_type::u64vec4_type
),
1978 add_function("packUnorm2x16", _packUnorm2x16(shader_packing_or_es3_or_gpu_shader5
), NULL
);
1979 add_function("packSnorm2x16", _packSnorm2x16(shader_packing_or_es3
), NULL
);
1980 add_function("packUnorm4x8", _packUnorm4x8(shader_packing_or_es31_or_gpu_shader5
), NULL
);
1981 add_function("packSnorm4x8", _packSnorm4x8(shader_packing_or_es31_or_gpu_shader5
), NULL
);
1982 add_function("unpackUnorm2x16", _unpackUnorm2x16(shader_packing_or_es3_or_gpu_shader5
), NULL
);
1983 add_function("unpackSnorm2x16", _unpackSnorm2x16(shader_packing_or_es3
), NULL
);
1984 add_function("unpackUnorm4x8", _unpackUnorm4x8(shader_packing_or_es31_or_gpu_shader5
), NULL
);
1985 add_function("unpackSnorm4x8", _unpackSnorm4x8(shader_packing_or_es31_or_gpu_shader5
), NULL
);
1986 add_function("packHalf2x16", _packHalf2x16(shader_packing_or_es3
), NULL
);
1987 add_function("unpackHalf2x16", _unpackHalf2x16(shader_packing_or_es3
), NULL
);
1988 add_function("packDouble2x32", _packDouble2x32(fp64
), NULL
);
1989 add_function("unpackDouble2x32", _unpackDouble2x32(fp64
), NULL
);
1991 add_function("packInt2x32", _packInt2x32(int64
), NULL
);
1992 add_function("unpackInt2x32", _unpackInt2x32(int64
), NULL
);
1993 add_function("packUint2x32", _packUint2x32(int64
), NULL
);
1994 add_function("unpackUint2x32", _unpackUint2x32(int64
), NULL
);
2000 add_function("cross", _cross(always_available
, glsl_type::vec3_type
),
2001 _cross(fp64
, glsl_type::dvec3_type
), NULL
);
2004 add_function("ftransform", _ftransform(), NULL
);
2009 add_function("matrixCompMult",
2010 _matrixCompMult(always_available
, glsl_type::mat2_type
),
2011 _matrixCompMult(always_available
, glsl_type::mat3_type
),
2012 _matrixCompMult(always_available
, glsl_type::mat4_type
),
2013 _matrixCompMult(always_available
, glsl_type::mat2x3_type
),
2014 _matrixCompMult(always_available
, glsl_type::mat2x4_type
),
2015 _matrixCompMult(always_available
, glsl_type::mat3x2_type
),
2016 _matrixCompMult(always_available
, glsl_type::mat3x4_type
),
2017 _matrixCompMult(always_available
, glsl_type::mat4x2_type
),
2018 _matrixCompMult(always_available
, glsl_type::mat4x3_type
),
2019 _matrixCompMult(fp64
, glsl_type::dmat2_type
),
2020 _matrixCompMult(fp64
, glsl_type::dmat3_type
),
2021 _matrixCompMult(fp64
, glsl_type::dmat4_type
),
2022 _matrixCompMult(fp64
, glsl_type::dmat2x3_type
),
2023 _matrixCompMult(fp64
, glsl_type::dmat2x4_type
),
2024 _matrixCompMult(fp64
, glsl_type::dmat3x2_type
),
2025 _matrixCompMult(fp64
, glsl_type::dmat3x4_type
),
2026 _matrixCompMult(fp64
, glsl_type::dmat4x2_type
),
2027 _matrixCompMult(fp64
, glsl_type::dmat4x3_type
),
2029 add_function("outerProduct",
2030 _outerProduct(v120
, glsl_type::mat2_type
),
2031 _outerProduct(v120
, glsl_type::mat3_type
),
2032 _outerProduct(v120
, glsl_type::mat4_type
),
2033 _outerProduct(v120
, glsl_type::mat2x3_type
),
2034 _outerProduct(v120
, glsl_type::mat2x4_type
),
2035 _outerProduct(v120
, glsl_type::mat3x2_type
),
2036 _outerProduct(v120
, glsl_type::mat3x4_type
),
2037 _outerProduct(v120
, glsl_type::mat4x2_type
),
2038 _outerProduct(v120
, glsl_type::mat4x3_type
),
2039 _outerProduct(fp64
, glsl_type::dmat2_type
),
2040 _outerProduct(fp64
, glsl_type::dmat3_type
),
2041 _outerProduct(fp64
, glsl_type::dmat4_type
),
2042 _outerProduct(fp64
, glsl_type::dmat2x3_type
),
2043 _outerProduct(fp64
, glsl_type::dmat2x4_type
),
2044 _outerProduct(fp64
, glsl_type::dmat3x2_type
),
2045 _outerProduct(fp64
, glsl_type::dmat3x4_type
),
2046 _outerProduct(fp64
, glsl_type::dmat4x2_type
),
2047 _outerProduct(fp64
, glsl_type::dmat4x3_type
),
2049 add_function("determinant",
2050 _determinant_mat2(v120
, glsl_type::mat2_type
),
2051 _determinant_mat3(v120
, glsl_type::mat3_type
),
2052 _determinant_mat4(v120
, glsl_type::mat4_type
),
2053 _determinant_mat2(fp64
, glsl_type::dmat2_type
),
2054 _determinant_mat3(fp64
, glsl_type::dmat3_type
),
2055 _determinant_mat4(fp64
, glsl_type::dmat4_type
),
2058 add_function("inverse",
2059 _inverse_mat2(v140_or_es3
, glsl_type::mat2_type
),
2060 _inverse_mat3(v140_or_es3
, glsl_type::mat3_type
),
2061 _inverse_mat4(v140_or_es3
, glsl_type::mat4_type
),
2062 _inverse_mat2(fp64
, glsl_type::dmat2_type
),
2063 _inverse_mat3(fp64
, glsl_type::dmat3_type
),
2064 _inverse_mat4(fp64
, glsl_type::dmat4_type
),
2066 add_function("transpose",
2067 _transpose(v120
, glsl_type::mat2_type
),
2068 _transpose(v120
, glsl_type::mat3_type
),
2069 _transpose(v120
, glsl_type::mat4_type
),
2070 _transpose(v120
, glsl_type::mat2x3_type
),
2071 _transpose(v120
, glsl_type::mat2x4_type
),
2072 _transpose(v120
, glsl_type::mat3x2_type
),
2073 _transpose(v120
, glsl_type::mat3x4_type
),
2074 _transpose(v120
, glsl_type::mat4x2_type
),
2075 _transpose(v120
, glsl_type::mat4x3_type
),
2076 _transpose(fp64
, glsl_type::dmat2_type
),
2077 _transpose(fp64
, glsl_type::dmat3_type
),
2078 _transpose(fp64
, glsl_type::dmat4_type
),
2079 _transpose(fp64
, glsl_type::dmat2x3_type
),
2080 _transpose(fp64
, glsl_type::dmat2x4_type
),
2081 _transpose(fp64
, glsl_type::dmat3x2_type
),
2082 _transpose(fp64
, glsl_type::dmat3x4_type
),
2083 _transpose(fp64
, glsl_type::dmat4x2_type
),
2084 _transpose(fp64
, glsl_type::dmat4x3_type
),
2087 FIUD_VEC(lessThanEqual
)
2088 FIUD_VEC(greaterThan
)
2089 FIUD_VEC(greaterThanEqual
)
2094 _any(glsl_type::bvec2_type
),
2095 _any(glsl_type::bvec3_type
),
2096 _any(glsl_type::bvec4_type
),
2100 _all(glsl_type::bvec2_type
),
2101 _all(glsl_type::bvec3_type
),
2102 _all(glsl_type::bvec4_type
),
2106 _not(glsl_type::bvec2_type
),
2107 _not(glsl_type::bvec3_type
),
2108 _not(glsl_type::bvec4_type
),
2111 add_function("textureSize",
2112 _textureSize(v130
, glsl_type::int_type
, glsl_type::sampler1D_type
),
2113 _textureSize(v130
, glsl_type::int_type
, glsl_type::isampler1D_type
),
2114 _textureSize(v130
, glsl_type::int_type
, glsl_type::usampler1D_type
),
2116 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler2D_type
),
2117 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::isampler2D_type
),
2118 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::usampler2D_type
),
2120 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::sampler3D_type
),
2121 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::isampler3D_type
),
2122 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::usampler3D_type
),
2124 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::samplerCube_type
),
2125 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::isamplerCube_type
),
2126 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::usamplerCube_type
),
2128 _textureSize(v130
, glsl_type::int_type
, glsl_type::sampler1DShadow_type
),
2129 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler2DShadow_type
),
2130 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::samplerCubeShadow_type
),
2132 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler1DArray_type
),
2133 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::isampler1DArray_type
),
2134 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::usampler1DArray_type
),
2135 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::sampler2DArray_type
),
2136 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::isampler2DArray_type
),
2137 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::usampler2DArray_type
),
2139 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler1DArrayShadow_type
),
2140 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::sampler2DArrayShadow_type
),
2142 _textureSize(texture_cube_map_array
, glsl_type::ivec3_type
, glsl_type::samplerCubeArray_type
),
2143 _textureSize(texture_cube_map_array
, glsl_type::ivec3_type
, glsl_type::isamplerCubeArray_type
),
2144 _textureSize(texture_cube_map_array
, glsl_type::ivec3_type
, glsl_type::usamplerCubeArray_type
),
2145 _textureSize(texture_cube_map_array
, glsl_type::ivec3_type
, glsl_type::samplerCubeArrayShadow_type
),
2147 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler2DRect_type
),
2148 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::isampler2DRect_type
),
2149 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::usampler2DRect_type
),
2150 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler2DRectShadow_type
),
2152 _textureSize(texture_buffer
, glsl_type::int_type
, glsl_type::samplerBuffer_type
),
2153 _textureSize(texture_buffer
, glsl_type::int_type
, glsl_type::isamplerBuffer_type
),
2154 _textureSize(texture_buffer
, glsl_type::int_type
, glsl_type::usamplerBuffer_type
),
2155 _textureSize(texture_multisample
, glsl_type::ivec2_type
, glsl_type::sampler2DMS_type
),
2156 _textureSize(texture_multisample
, glsl_type::ivec2_type
, glsl_type::isampler2DMS_type
),
2157 _textureSize(texture_multisample
, glsl_type::ivec2_type
, glsl_type::usampler2DMS_type
),
2159 _textureSize(texture_multisample_array
, glsl_type::ivec3_type
, glsl_type::sampler2DMSArray_type
),
2160 _textureSize(texture_multisample_array
, glsl_type::ivec3_type
, glsl_type::isampler2DMSArray_type
),
2161 _textureSize(texture_multisample_array
, glsl_type::ivec3_type
, glsl_type::usampler2DMSArray_type
),
2163 _textureSize(texture_external_es3
, glsl_type::ivec2_type
, glsl_type::samplerExternalOES_type
),
2166 add_function("textureSize1D",
2167 _textureSize(gpu_shader4
, glsl_type::int_type
, glsl_type::sampler1D_type
),
2168 _textureSize(gpu_shader4_integer
, glsl_type::int_type
, glsl_type::isampler1D_type
),
2169 _textureSize(gpu_shader4_integer
, glsl_type::int_type
, glsl_type::usampler1D_type
),
2172 add_function("textureSize2D",
2173 _textureSize(gpu_shader4
, glsl_type::ivec2_type
, glsl_type::sampler2D_type
),
2174 _textureSize(gpu_shader4_integer
, glsl_type::ivec2_type
, glsl_type::isampler2D_type
),
2175 _textureSize(gpu_shader4_integer
, glsl_type::ivec2_type
, glsl_type::usampler2D_type
),
2178 add_function("textureSize3D",
2179 _textureSize(gpu_shader4
, glsl_type::ivec3_type
, glsl_type::sampler3D_type
),
2180 _textureSize(gpu_shader4_integer
, glsl_type::ivec3_type
, glsl_type::isampler3D_type
),
2181 _textureSize(gpu_shader4_integer
, glsl_type::ivec3_type
, glsl_type::usampler3D_type
),
2184 add_function("textureSizeCube",
2185 _textureSize(gpu_shader4
, glsl_type::ivec2_type
, glsl_type::samplerCube_type
),
2186 _textureSize(gpu_shader4_integer
, glsl_type::ivec2_type
, glsl_type::isamplerCube_type
),
2187 _textureSize(gpu_shader4_integer
, glsl_type::ivec2_type
, glsl_type::usamplerCube_type
),
2190 add_function("textureSize1DArray",
2191 _textureSize(gpu_shader4_array
, glsl_type::ivec2_type
, glsl_type::sampler1DArray_type
),
2192 _textureSize(gpu_shader4_array_integer
, glsl_type::ivec2_type
, glsl_type::isampler1DArray_type
),
2193 _textureSize(gpu_shader4_array_integer
, glsl_type::ivec2_type
, glsl_type::usampler1DArray_type
),
2196 add_function("textureSize2DArray",
2197 _textureSize(gpu_shader4_array
, glsl_type::ivec3_type
, glsl_type::sampler2DArray_type
),
2198 _textureSize(gpu_shader4_array_integer
, glsl_type::ivec3_type
, glsl_type::isampler2DArray_type
),
2199 _textureSize(gpu_shader4_array_integer
, glsl_type::ivec3_type
, glsl_type::usampler2DArray_type
),
2202 add_function("textureSize2DRect",
2203 _textureSize(gpu_shader4_rect
, glsl_type::ivec2_type
, glsl_type::sampler2DRect_type
),
2204 _textureSize(gpu_shader4_rect_integer
, glsl_type::ivec2_type
, glsl_type::isampler2DRect_type
),
2205 _textureSize(gpu_shader4_rect_integer
, glsl_type::ivec2_type
, glsl_type::usampler2DRect_type
),
2208 add_function("textureSizeBuffer",
2209 _textureSize(gpu_shader4_tbo
, glsl_type::int_type
, glsl_type::samplerBuffer_type
),
2210 _textureSize(gpu_shader4_tbo_integer
, glsl_type::int_type
, glsl_type::isamplerBuffer_type
),
2211 _textureSize(gpu_shader4_tbo_integer
, glsl_type::int_type
, glsl_type::usamplerBuffer_type
),
2214 add_function("textureSamples",
2215 _textureSamples(shader_samples
, glsl_type::sampler2DMS_type
),
2216 _textureSamples(shader_samples
, glsl_type::isampler2DMS_type
),
2217 _textureSamples(shader_samples
, glsl_type::usampler2DMS_type
),
2219 _textureSamples(shader_samples
, glsl_type::sampler2DMSArray_type
),
2220 _textureSamples(shader_samples
, glsl_type::isampler2DMSArray_type
),
2221 _textureSamples(shader_samples
, glsl_type::usampler2DMSArray_type
),
2224 add_function("texture",
2225 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
2226 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
2227 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
2229 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
2230 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
2231 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
2233 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
2234 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
2235 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
2237 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
2238 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
2239 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
2241 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
2242 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
2243 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
2245 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
2246 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
2247 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
2249 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
2250 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
2251 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
2253 _texture(ir_tex
, texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
),
2254 _texture(ir_tex
, texture_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
),
2255 _texture(ir_tex
, texture_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
),
2257 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
2258 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
2259 /* samplerCubeArrayShadow is special; it has an extra parameter
2260 * for the shadow comparator since there is no vec5 type.
2262 _textureCubeArrayShadow(ir_tex
, texture_cube_map_array
, glsl_type::samplerCubeArrayShadow_type
),
2264 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
2265 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
),
2266 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
),
2268 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
),
2270 _texture(ir_tex
, texture_external_es3
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec2_type
),
2272 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
2273 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
2274 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
2276 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
2277 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
2278 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
2280 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
2281 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
2282 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
2284 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
2285 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
2286 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
2288 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
2289 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
2290 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
2292 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
2293 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
2294 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
2296 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
2297 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
2298 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
2300 _texture(ir_txb
, derivatives_texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
),
2301 _texture(ir_txb
, derivatives_texture_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
),
2302 _texture(ir_txb
, derivatives_texture_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
),
2304 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
2305 _texture(ir_tex
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
2306 _texture(ir_txb
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
2308 _textureCubeArrayShadow(ir_tex
, v130_or_gpu_shader4_and_tex_cube_map_array
, glsl_type::samplerCubeArrayShadow_type
),
2309 _textureCubeArrayShadow(ir_txb
, v130_or_gpu_shader4_and_tex_cube_map_array
, glsl_type::samplerCubeArrayShadow_type
),
2312 add_function("textureLod",
2313 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
2314 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
2315 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
2317 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
2318 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
2319 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
2321 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
2322 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
2323 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
2325 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
2326 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
2327 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
2329 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
2330 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
2332 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
2333 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
2334 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
2336 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
2337 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
2338 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
2340 _texture(ir_txl
, texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
),
2341 _texture(ir_txl
, texture_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
),
2342 _texture(ir_txl
, texture_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
),
2344 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
2345 _texture(ir_txl
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
2346 _texture(ir_txl
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
2347 _textureCubeArrayShadow(ir_txl
, v130_or_gpu_shader4_and_tex_cube_map_array
, glsl_type::samplerCubeArrayShadow_type
),
2350 add_function("textureOffset",
2351 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2352 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2353 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2355 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2356 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2357 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2359 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2360 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2361 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2363 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2364 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2365 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2367 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2369 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2370 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2372 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2373 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2374 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2376 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2377 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2378 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2380 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2381 /* The next one was forgotten in GLSL 1.30 spec. It's from
2382 * EXT_gpu_shader4 originally. It was added in 4.30 with the
2383 * wrong syntax. This was corrected in 4.40. 4.30 indicates
2384 * that it was intended to be included previously, so allow it
2387 _texture(ir_tex
, v130_desktop
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
2389 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2390 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2391 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2393 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2394 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2395 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2397 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2398 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2399 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2401 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2402 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2404 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2405 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2406 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2408 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2409 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2410 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2412 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2413 _texture(ir_tex
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
2414 _texture(ir_txb
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
2417 add_function("texture1DOffset",
2418 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2419 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2420 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2421 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2422 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2423 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2426 add_function("texture2DOffset",
2427 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2428 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2429 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2430 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2431 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2432 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2435 add_function("texture3DOffset",
2436 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2437 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2438 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2439 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2440 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2441 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2444 add_function("texture2DRectOffset",
2445 _texture(ir_tex
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2446 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2447 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2450 add_function("shadow2DRectOffset",
2451 _texture(ir_tex
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2454 add_function("shadow1DOffset",
2455 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2456 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2459 add_function("shadow2DOffset",
2460 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2461 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2464 add_function("texture1DArrayOffset",
2465 _texture(ir_tex
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2466 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2467 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2468 _texture(ir_txb
, gpu_shader4_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2469 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2470 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2473 add_function("texture2DArrayOffset",
2474 _texture(ir_tex
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2475 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2476 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2477 _texture(ir_txb
, gpu_shader4_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2478 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2479 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2482 add_function("shadow1DArrayOffset",
2483 _texture(ir_tex
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2484 _texture(ir_txb
, gpu_shader4_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2487 add_function("shadow2DArrayOffset",
2488 _texture(ir_tex
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
2491 add_function("textureProj",
2492 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2493 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2494 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2495 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2496 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2497 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2499 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2500 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2501 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2502 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2503 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2504 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2506 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2507 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2508 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2510 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2511 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2513 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2514 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2515 _texture(ir_tex
, texture_external_es3
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2516 _texture(ir_tex
, texture_external_es3
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2518 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2519 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2520 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2521 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2523 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2525 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2526 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2527 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2528 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2529 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2530 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2532 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2533 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2534 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2535 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2536 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2537 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2539 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2540 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2541 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2543 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2544 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2547 add_function("texelFetch",
2548 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::int_type
),
2549 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::int_type
),
2550 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::int_type
),
2552 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::ivec2_type
),
2553 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::ivec2_type
),
2554 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::ivec2_type
),
2556 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::ivec3_type
),
2557 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::ivec3_type
),
2558 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::ivec3_type
),
2560 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::ivec2_type
),
2561 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::ivec2_type
),
2562 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::ivec2_type
),
2564 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::ivec2_type
),
2565 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::ivec2_type
),
2566 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::ivec2_type
),
2568 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::ivec3_type
),
2569 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::ivec3_type
),
2570 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::ivec3_type
),
2572 _texelFetch(texture_buffer
, glsl_type::vec4_type
, glsl_type::samplerBuffer_type
, glsl_type::int_type
),
2573 _texelFetch(texture_buffer
, glsl_type::ivec4_type
, glsl_type::isamplerBuffer_type
, glsl_type::int_type
),
2574 _texelFetch(texture_buffer
, glsl_type::uvec4_type
, glsl_type::usamplerBuffer_type
, glsl_type::int_type
),
2576 _texelFetch(texture_multisample
, glsl_type::vec4_type
, glsl_type::sampler2DMS_type
, glsl_type::ivec2_type
),
2577 _texelFetch(texture_multisample
, glsl_type::ivec4_type
, glsl_type::isampler2DMS_type
, glsl_type::ivec2_type
),
2578 _texelFetch(texture_multisample
, glsl_type::uvec4_type
, glsl_type::usampler2DMS_type
, glsl_type::ivec2_type
),
2580 _texelFetch(texture_multisample_array
, glsl_type::vec4_type
, glsl_type::sampler2DMSArray_type
, glsl_type::ivec3_type
),
2581 _texelFetch(texture_multisample_array
, glsl_type::ivec4_type
, glsl_type::isampler2DMSArray_type
, glsl_type::ivec3_type
),
2582 _texelFetch(texture_multisample_array
, glsl_type::uvec4_type
, glsl_type::usampler2DMSArray_type
, glsl_type::ivec3_type
),
2584 _texelFetch(texture_external_es3
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::ivec2_type
),
2588 add_function("texelFetch1D",
2589 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::int_type
),
2590 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::int_type
),
2591 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::int_type
),
2594 add_function("texelFetch2D",
2595 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::ivec2_type
),
2596 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::ivec2_type
),
2597 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::ivec2_type
),
2600 add_function("texelFetch3D",
2601 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::ivec3_type
),
2602 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::ivec3_type
),
2603 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::ivec3_type
),
2606 add_function("texelFetch2DRect",
2607 _texelFetch(gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::ivec2_type
),
2608 _texelFetch(gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::ivec2_type
),
2609 _texelFetch(gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::ivec2_type
),
2612 add_function("texelFetch1DArray",
2613 _texelFetch(gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::ivec2_type
),
2614 _texelFetch(gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::ivec2_type
),
2615 _texelFetch(gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::ivec2_type
),
2618 add_function("texelFetch2DArray",
2619 _texelFetch(gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::ivec3_type
),
2620 _texelFetch(gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::ivec3_type
),
2621 _texelFetch(gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::ivec3_type
),
2624 add_function("texelFetchBuffer",
2625 _texelFetch(gpu_shader4_tbo
, glsl_type::vec4_type
, glsl_type::samplerBuffer_type
, glsl_type::int_type
),
2626 _texelFetch(gpu_shader4_tbo_integer
, glsl_type::ivec4_type
, glsl_type::isamplerBuffer_type
, glsl_type::int_type
),
2627 _texelFetch(gpu_shader4_tbo_integer
, glsl_type::uvec4_type
, glsl_type::usamplerBuffer_type
, glsl_type::int_type
),
2630 add_function("texelFetchOffset",
2631 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2632 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2633 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2635 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2636 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2637 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2639 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2640 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2641 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2643 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2644 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2645 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2647 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2648 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2649 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2651 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2652 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2653 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2657 add_function("texelFetch1DOffset",
2658 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2659 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2660 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2663 add_function("texelFetch2DOffset",
2664 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2665 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2666 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2669 add_function("texelFetch3DOffset",
2670 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2671 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2672 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2675 add_function("texelFetch2DRectOffset",
2676 _texelFetch(gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2677 _texelFetch(gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2678 _texelFetch(gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2681 add_function("texelFetch1DArrayOffset",
2682 _texelFetch(gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2683 _texelFetch(gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2684 _texelFetch(gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2687 add_function("texelFetch2DArrayOffset",
2688 _texelFetch(gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2689 _texelFetch(gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2690 _texelFetch(gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2693 add_function("textureProjOffset",
2694 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2695 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2696 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2697 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2698 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2699 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2701 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2702 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2703 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2704 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2705 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2706 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2708 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2709 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2710 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2712 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2713 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2715 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2716 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2717 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2718 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2719 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2720 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2722 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2724 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2725 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2726 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2727 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2728 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2729 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2731 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2732 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2733 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2734 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2735 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2736 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2738 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2739 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2740 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2742 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2743 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2746 add_function("texture1DProjOffset",
2747 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2748 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2749 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2750 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2751 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2752 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2753 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2754 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2755 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2756 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2757 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2758 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2761 add_function("texture2DProjOffset",
2762 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2763 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2764 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2765 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2766 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2767 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2768 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2769 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2770 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2771 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2772 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2773 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2776 add_function("texture3DProjOffset",
2777 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2778 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2779 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2780 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2781 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2782 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2785 add_function("shadow1DProjOffset",
2786 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2787 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2790 add_function("shadow2DProjOffset",
2791 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2792 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2795 add_function("texture2DRectProjOffset",
2796 _texture(ir_tex
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2797 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2798 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2799 _texture(ir_tex
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2800 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2801 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2804 add_function("shadow2DRectProjOffset",
2805 _texture(ir_tex
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2808 add_function("textureLodOffset",
2809 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2810 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2811 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2813 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2814 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2815 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2817 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2818 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2819 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2821 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2822 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2824 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2825 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2826 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2828 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2829 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2830 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2832 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2833 _texture(ir_txl
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
2836 add_function("texture1DLodOffset",
2837 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2838 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2839 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2842 add_function("texture2DLodOffset",
2843 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2844 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2845 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2848 add_function("texture3DLodOffset",
2849 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2850 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2851 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2854 add_function("shadow1DLodOffset",
2855 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2858 add_function("shadow2DLodOffset",
2859 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2862 add_function("texture1DArrayLodOffset",
2863 _texture(ir_txl
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2864 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2865 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2868 add_function("texture2DArrayLodOffset",
2869 _texture(ir_txl
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2870 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2871 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2874 add_function("shadow1DArrayLodOffset",
2875 _texture(ir_txl
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2878 add_function("textureProjLod",
2879 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2880 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2881 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2882 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2883 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2884 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2886 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2887 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2888 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2889 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2890 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2891 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2893 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2894 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2895 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2897 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2898 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2901 add_function("textureProjLodOffset",
2902 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2903 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2904 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2905 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2906 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2907 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2909 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2910 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2911 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2912 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2913 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2914 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2916 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2917 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2918 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2920 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2921 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2924 add_function("texture1DProjLodOffset",
2925 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2926 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2927 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2928 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2929 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2930 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2933 add_function("texture2DProjLodOffset",
2934 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2935 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2936 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2937 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2938 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2939 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2942 add_function("texture3DProjLodOffset",
2943 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2944 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2945 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2948 add_function("shadow1DProjLodOffset",
2949 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2952 add_function("shadow2DProjLodOffset",
2953 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2956 add_function("textureGrad",
2957 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
2958 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
2959 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
2961 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
2962 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
2963 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
2965 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
2966 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
2967 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
2969 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
2970 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
2971 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
2973 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
2974 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
),
2975 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
),
2977 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
),
2979 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
2980 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
2981 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
2983 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
2984 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
2985 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
2987 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
2988 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
2989 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
2991 _texture(ir_txd
, texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
),
2992 _texture(ir_txd
, texture_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
),
2993 _texture(ir_txd
, texture_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
),
2995 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
2996 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
2999 add_function("textureGradOffset",
3000 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
3001 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
3002 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
3004 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3005 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3006 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3008 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3009 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3010 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3012 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3013 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3014 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3016 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3018 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3019 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3021 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3022 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3023 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3025 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3026 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3027 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3029 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3030 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
3033 add_function("texture1DGradOffset",
3034 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
3035 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
3036 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
3039 add_function("texture2DGradOffset",
3040 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3041 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3042 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3045 add_function("texture3DGradOffset",
3046 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3047 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3048 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3051 add_function("texture2DRectGradOffset",
3052 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3053 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3054 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3057 add_function("shadow2DRectGradOffset",
3058 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3061 add_function("shadow1DGradOffset",
3062 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3065 add_function("shadow2DGradOffset",
3066 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3069 add_function("texture1DArrayGradOffset",
3070 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3071 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3072 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3075 add_function("texture2DArrayGradOffset",
3076 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3077 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3078 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3081 add_function("shadow1DArrayGradOffset",
3082 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3085 add_function("shadow2DArrayGradOffset",
3086 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
3089 add_function("textureProjGrad",
3090 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3091 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3092 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3093 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3094 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3095 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3097 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3098 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3099 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3100 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3101 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3102 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3104 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3105 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3106 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3108 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3109 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3110 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3111 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3112 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3113 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3115 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3117 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3118 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3121 add_function("textureProjGradOffset",
3122 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3123 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3124 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3125 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3126 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3127 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3129 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3130 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3131 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3132 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3133 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3134 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3136 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3137 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3138 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3140 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3141 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3142 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3143 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3144 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3145 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3147 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3149 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3150 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3153 add_function("texture1DProjGradOffset",
3154 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3155 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3156 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3157 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3158 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3159 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3162 add_function("texture2DProjGradOffset",
3163 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3164 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3165 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3166 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3167 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3168 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3171 add_function("texture3DProjGradOffset",
3172 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3173 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3174 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3177 add_function("texture2DRectProjGradOffset",
3178 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3179 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3180 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3181 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3182 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3183 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3186 add_function("shadow2DRectProjGradOffset",
3187 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3190 add_function("shadow1DProjGradOffset",
3191 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3194 add_function("shadow2DProjGradOffset",
3195 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3198 add_function("EmitVertex", _EmitVertex(), NULL
);
3199 add_function("EndPrimitive", _EndPrimitive(), NULL
);
3200 add_function("EmitStreamVertex",
3201 _EmitStreamVertex(gs_streams
, glsl_type::uint_type
),
3202 _EmitStreamVertex(gs_streams
, glsl_type::int_type
),
3204 add_function("EndStreamPrimitive",
3205 _EndStreamPrimitive(gs_streams
, glsl_type::uint_type
),
3206 _EndStreamPrimitive(gs_streams
, glsl_type::int_type
),
3208 add_function("barrier", _barrier(), NULL
);
3210 add_function("textureQueryLOD",
3211 _textureQueryLod(texture_query_lod
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3212 _textureQueryLod(texture_query_lod
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3213 _textureQueryLod(texture_query_lod
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3215 _textureQueryLod(texture_query_lod
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3216 _textureQueryLod(texture_query_lod
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3217 _textureQueryLod(texture_query_lod
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3219 _textureQueryLod(texture_query_lod
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3220 _textureQueryLod(texture_query_lod
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3221 _textureQueryLod(texture_query_lod
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3223 _textureQueryLod(texture_query_lod
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3224 _textureQueryLod(texture_query_lod
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3225 _textureQueryLod(texture_query_lod
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3227 _textureQueryLod(texture_query_lod
, glsl_type::sampler1DArray_type
, glsl_type::float_type
),
3228 _textureQueryLod(texture_query_lod
, glsl_type::isampler1DArray_type
, glsl_type::float_type
),
3229 _textureQueryLod(texture_query_lod
, glsl_type::usampler1DArray_type
, glsl_type::float_type
),
3231 _textureQueryLod(texture_query_lod
, glsl_type::sampler2DArray_type
, glsl_type::vec2_type
),
3232 _textureQueryLod(texture_query_lod
, glsl_type::isampler2DArray_type
, glsl_type::vec2_type
),
3233 _textureQueryLod(texture_query_lod
, glsl_type::usampler2DArray_type
, glsl_type::vec2_type
),
3235 _textureQueryLod(texture_query_lod
, glsl_type::samplerCubeArray_type
, glsl_type::vec3_type
),
3236 _textureQueryLod(texture_query_lod
, glsl_type::isamplerCubeArray_type
, glsl_type::vec3_type
),
3237 _textureQueryLod(texture_query_lod
, glsl_type::usamplerCubeArray_type
, glsl_type::vec3_type
),
3239 _textureQueryLod(texture_query_lod
, glsl_type::sampler1DShadow_type
, glsl_type::float_type
),
3240 _textureQueryLod(texture_query_lod
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
),
3241 _textureQueryLod(texture_query_lod
, glsl_type::samplerCubeShadow_type
, glsl_type::vec3_type
),
3242 _textureQueryLod(texture_query_lod
, glsl_type::sampler1DArrayShadow_type
, glsl_type::float_type
),
3243 _textureQueryLod(texture_query_lod
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec2_type
),
3244 _textureQueryLod(texture_query_lod
, glsl_type::samplerCubeArrayShadow_type
, glsl_type::vec3_type
),
3247 add_function("textureQueryLod",
3248 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3249 _textureQueryLod(v400_derivatives_only
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3250 _textureQueryLod(v400_derivatives_only
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3252 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3253 _textureQueryLod(v400_derivatives_only
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3254 _textureQueryLod(v400_derivatives_only
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3256 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3257 _textureQueryLod(v400_derivatives_only
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3258 _textureQueryLod(v400_derivatives_only
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3260 _textureQueryLod(v400_derivatives_only
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3261 _textureQueryLod(v400_derivatives_only
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3262 _textureQueryLod(v400_derivatives_only
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3264 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler1DArray_type
, glsl_type::float_type
),
3265 _textureQueryLod(v400_derivatives_only
, glsl_type::isampler1DArray_type
, glsl_type::float_type
),
3266 _textureQueryLod(v400_derivatives_only
, glsl_type::usampler1DArray_type
, glsl_type::float_type
),
3268 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler2DArray_type
, glsl_type::vec2_type
),
3269 _textureQueryLod(v400_derivatives_only
, glsl_type::isampler2DArray_type
, glsl_type::vec2_type
),
3270 _textureQueryLod(v400_derivatives_only
, glsl_type::usampler2DArray_type
, glsl_type::vec2_type
),
3272 _textureQueryLod(v400_derivatives_only
, glsl_type::samplerCubeArray_type
, glsl_type::vec3_type
),
3273 _textureQueryLod(v400_derivatives_only
, glsl_type::isamplerCubeArray_type
, glsl_type::vec3_type
),
3274 _textureQueryLod(v400_derivatives_only
, glsl_type::usamplerCubeArray_type
, glsl_type::vec3_type
),
3276 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler1DShadow_type
, glsl_type::float_type
),
3277 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
),
3278 _textureQueryLod(v400_derivatives_only
, glsl_type::samplerCubeShadow_type
, glsl_type::vec3_type
),
3279 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler1DArrayShadow_type
, glsl_type::float_type
),
3280 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec2_type
),
3281 _textureQueryLod(v400_derivatives_only
, glsl_type::samplerCubeArrayShadow_type
, glsl_type::vec3_type
),
3284 add_function("textureQueryLevels",
3285 _textureQueryLevels(texture_query_levels
, glsl_type::sampler1D_type
),
3286 _textureQueryLevels(texture_query_levels
, glsl_type::sampler2D_type
),
3287 _textureQueryLevels(texture_query_levels
, glsl_type::sampler3D_type
),
3288 _textureQueryLevels(texture_query_levels
, glsl_type::samplerCube_type
),
3289 _textureQueryLevels(texture_query_levels
, glsl_type::sampler1DArray_type
),
3290 _textureQueryLevels(texture_query_levels
, glsl_type::sampler2DArray_type
),
3291 _textureQueryLevels(texture_query_levels
, glsl_type::samplerCubeArray_type
),
3292 _textureQueryLevels(texture_query_levels
, glsl_type::sampler1DShadow_type
),
3293 _textureQueryLevels(texture_query_levels
, glsl_type::sampler2DShadow_type
),
3294 _textureQueryLevels(texture_query_levels
, glsl_type::samplerCubeShadow_type
),
3295 _textureQueryLevels(texture_query_levels
, glsl_type::sampler1DArrayShadow_type
),
3296 _textureQueryLevels(texture_query_levels
, glsl_type::sampler2DArrayShadow_type
),
3297 _textureQueryLevels(texture_query_levels
, glsl_type::samplerCubeArrayShadow_type
),
3299 _textureQueryLevels(texture_query_levels
, glsl_type::isampler1D_type
),
3300 _textureQueryLevels(texture_query_levels
, glsl_type::isampler2D_type
),
3301 _textureQueryLevels(texture_query_levels
, glsl_type::isampler3D_type
),
3302 _textureQueryLevels(texture_query_levels
, glsl_type::isamplerCube_type
),
3303 _textureQueryLevels(texture_query_levels
, glsl_type::isampler1DArray_type
),
3304 _textureQueryLevels(texture_query_levels
, glsl_type::isampler2DArray_type
),
3305 _textureQueryLevels(texture_query_levels
, glsl_type::isamplerCubeArray_type
),
3307 _textureQueryLevels(texture_query_levels
, glsl_type::usampler1D_type
),
3308 _textureQueryLevels(texture_query_levels
, glsl_type::usampler2D_type
),
3309 _textureQueryLevels(texture_query_levels
, glsl_type::usampler3D_type
),
3310 _textureQueryLevels(texture_query_levels
, glsl_type::usamplerCube_type
),
3311 _textureQueryLevels(texture_query_levels
, glsl_type::usampler1DArray_type
),
3312 _textureQueryLevels(texture_query_levels
, glsl_type::usampler2DArray_type
),
3313 _textureQueryLevels(texture_query_levels
, glsl_type::usamplerCubeArray_type
),
3317 add_function("textureSamplesIdenticalEXT",
3318 _textureSamplesIdentical(texture_samples_identical
, glsl_type::sampler2DMS_type
, glsl_type::ivec2_type
),
3319 _textureSamplesIdentical(texture_samples_identical
, glsl_type::isampler2DMS_type
, glsl_type::ivec2_type
),
3320 _textureSamplesIdentical(texture_samples_identical
, glsl_type::usampler2DMS_type
, glsl_type::ivec2_type
),
3322 _textureSamplesIdentical(texture_samples_identical_array
, glsl_type::sampler2DMSArray_type
, glsl_type::ivec3_type
),
3323 _textureSamplesIdentical(texture_samples_identical_array
, glsl_type::isampler2DMSArray_type
, glsl_type::ivec3_type
),
3324 _textureSamplesIdentical(texture_samples_identical_array
, glsl_type::usampler2DMSArray_type
, glsl_type::ivec3_type
),
3327 add_function("texture1D",
3328 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3329 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3330 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3331 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3332 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3333 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3336 add_function("texture1DArray",
3337 _texture(ir_tex
, texture_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
3338 _texture(ir_txb
, texture_array_derivs_only
,glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
3339 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
3340 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
3341 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
3342 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
3345 add_function("texture1DProj",
3346 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3347 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3348 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3349 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3350 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3351 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3352 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3353 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3354 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3355 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3356 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3357 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3360 add_function("texture1DLod",
3361 _texture(ir_txl
, tex1d_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3362 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3363 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3366 add_function("texture1DArrayLod",
3367 _texture(ir_txl
, texture_array_lod
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
3368 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
3369 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
3372 add_function("texture1DProjLod",
3373 _texture(ir_txl
, tex1d_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3374 _texture(ir_txl
, tex1d_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3375 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3376 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3377 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3378 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3381 add_function("texture2D",
3382 _texture(ir_tex
, always_available
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3383 _texture(ir_txb
, derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3384 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3385 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3386 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3387 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3388 _texture(ir_tex
, texture_external
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec2_type
),
3391 add_function("texture2DArray",
3392 _texture(ir_tex
, texture_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
3393 _texture(ir_txb
, texture_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
3394 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
3395 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
3396 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
3397 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
3400 add_function("texture2DProj",
3401 _texture(ir_tex
, always_available
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3402 _texture(ir_tex
, always_available
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3403 _texture(ir_txb
, derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3404 _texture(ir_txb
, derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3405 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3406 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3407 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3408 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3409 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3410 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3411 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3412 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3413 _texture(ir_tex
, texture_external
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3414 _texture(ir_tex
, texture_external
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3417 add_function("texture2DLod",
3418 _texture(ir_txl
, lod_exists_in_stage
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3419 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3420 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3423 add_function("texture2DArrayLod",
3424 _texture(ir_txl
, texture_array_lod
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
3425 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
3426 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
3429 add_function("texture2DProjLod",
3430 _texture(ir_txl
, lod_exists_in_stage
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3431 _texture(ir_txl
, lod_exists_in_stage
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3432 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3433 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3434 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3435 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3438 add_function("texture3D",
3439 _texture(ir_tex
, tex3d
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3440 _texture(ir_txb
, derivatives_tex3d
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3441 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3442 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3443 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3444 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3447 add_function("texture3DProj",
3448 _texture(ir_tex
, tex3d
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3449 _texture(ir_txb
, derivatives_tex3d
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3450 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3451 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3452 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3453 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3456 add_function("texture3DLod",
3457 _texture(ir_txl
, tex3d_lod
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3458 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3459 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3462 add_function("texture3DProjLod",
3463 _texture(ir_txl
, tex3d_lod
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3464 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3465 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3468 add_function("textureCube",
3469 _texture(ir_tex
, always_available
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3470 _texture(ir_txb
, derivatives_only
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3471 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3472 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3473 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3474 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3477 add_function("textureCubeLod",
3478 _texture(ir_txl
, lod_exists_in_stage
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3479 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3480 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3483 add_function("texture2DRect",
3484 _texture(ir_tex
, texture_rectangle
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
3485 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
),
3486 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
),
3489 add_function("texture2DRectProj",
3490 _texture(ir_tex
, texture_rectangle
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3491 _texture(ir_tex
, texture_rectangle
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3492 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3493 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3494 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3495 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3498 add_function("shadow1D",
3499 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
3500 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
3503 add_function("shadow1DArray",
3504 _texture(ir_tex
, texture_array
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
3505 _texture(ir_txb
, texture_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
3508 add_function("shadow2D",
3509 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
3510 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
3513 add_function("shadow2DArray",
3514 _texture(ir_tex
, texture_array
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
3515 _texture(ir_txb
, texture_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
3518 add_function("shadow1DProj",
3519 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3520 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3523 add_function("shadow2DArray",
3524 _texture(ir_tex
, texture_array
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
3525 _texture(ir_txb
, texture_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
3528 add_function("shadowCube",
3529 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
3530 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
3533 add_function("shadow2DProj",
3534 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3535 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3538 add_function("shadow1DLod",
3539 _texture(ir_txl
, v110_lod
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
3542 add_function("shadow2DLod",
3543 _texture(ir_txl
, v110_lod
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
3546 add_function("shadow1DArrayLod",
3547 _texture(ir_txl
, texture_array_lod
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
3550 add_function("shadow1DProjLod",
3551 _texture(ir_txl
, v110_lod
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3554 add_function("shadow2DProjLod",
3555 _texture(ir_txl
, v110_lod
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3558 add_function("shadow2DRect",
3559 _texture(ir_tex
, texture_rectangle
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
),
3562 add_function("shadow2DRectProj",
3563 _texture(ir_tex
, texture_rectangle
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3566 add_function("texture1DGradARB",
3567 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3570 add_function("texture1DProjGradARB",
3571 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3572 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3575 add_function("texture2DGradARB",
3576 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3579 add_function("texture2DProjGradARB",
3580 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3581 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3584 add_function("texture3DGradARB",
3585 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3588 add_function("texture3DProjGradARB",
3589 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3592 add_function("textureCubeGradARB",
3593 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3596 add_function("shadow1DGradARB",
3597 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
3600 add_function("shadow1DProjGradARB",
3601 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3604 add_function("shadow2DGradARB",
3605 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
3608 add_function("shadow2DProjGradARB",
3609 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3612 add_function("texture2DRectGradARB",
3613 _texture(ir_txd
, shader_texture_lod_and_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
3616 add_function("texture2DRectProjGradARB",
3617 _texture(ir_txd
, shader_texture_lod_and_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3618 _texture(ir_txd
, shader_texture_lod_and_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3621 add_function("shadow2DRectGradARB",
3622 _texture(ir_txd
, shader_texture_lod_and_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
),
3625 add_function("shadow2DRectProjGradARB",
3626 _texture(ir_txd
, shader_texture_lod_and_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3629 add_function("texture4",
3630 _texture(ir_tg4
, texture_texture4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3633 add_function("texture1DGrad",
3634 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3635 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3636 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3639 add_function("texture1DProjGrad",
3640 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3641 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3642 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3643 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3644 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3645 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3648 add_function("texture1DArrayGrad",
3649 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
3650 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
3651 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
3654 add_function("texture2DGrad",
3655 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3656 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3657 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3660 add_function("texture2DProjGrad",
3661 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3662 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3663 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3664 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3665 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3666 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3669 add_function("texture2DArrayGrad",
3670 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
3671 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
3672 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
3675 add_function("texture3DGrad",
3676 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3677 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3678 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3681 add_function("texture3DProjGrad",
3682 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3683 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3684 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3687 add_function("textureCubeGrad",
3688 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3689 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3690 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3693 add_function("shadow1DGrad",
3694 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
3697 add_function("shadow1DProjGrad",
3698 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3701 add_function("shadow1DArrayGrad",
3702 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
3705 add_function("shadow2DGrad",
3706 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
3709 add_function("shadow2DProjGrad",
3710 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3713 add_function("shadow2DArrayGrad",
3714 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
3717 add_function("texture2DRectGrad",
3718 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
3719 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
),
3720 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
),
3723 add_function("texture2DRectProjGrad",
3724 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3725 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3726 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3727 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3728 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3729 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3732 add_function("shadow2DRectGrad",
3733 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
),
3736 add_function("shadow2DRectProjGrad",
3737 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3740 add_function("shadowCubeGrad",
3741 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
3744 add_function("textureGather",
3745 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3746 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3747 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3749 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
3750 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
),
3751 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
),
3753 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
3754 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
3755 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
3757 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3758 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3759 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3761 _texture(ir_tg4
, texture_gather_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
),
3762 _texture(ir_tg4
, texture_gather_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
),
3763 _texture(ir_tg4
, texture_gather_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
),
3765 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3766 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3767 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3769 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3770 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3771 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3773 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3774 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3775 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3777 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3778 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3779 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3781 _texture(ir_tg4
, gpu_shader5_or_OES_texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
, TEX_COMPONENT
),
3782 _texture(ir_tg4
, gpu_shader5_or_OES_texture_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
, TEX_COMPONENT
),
3783 _texture(ir_tg4
, gpu_shader5_or_OES_texture_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
, TEX_COMPONENT
),
3785 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
),
3786 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec3_type
),
3787 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec3_type
),
3788 _texture(ir_tg4
, gpu_shader5_or_OES_texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArrayShadow_type
, glsl_type::vec4_type
),
3789 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec2_type
),
3792 add_function("textureGatherOffset",
3793 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3794 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3795 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3797 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3798 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3799 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3801 _texture(ir_tg4
, es31_not_gs5
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
| TEX_COMPONENT
),
3802 _texture(ir_tg4
, es31_not_gs5
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
| TEX_COMPONENT
),
3803 _texture(ir_tg4
, es31_not_gs5
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
| TEX_COMPONENT
),
3805 _texture(ir_tg4
, es31_not_gs5
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
| TEX_COMPONENT
),
3806 _texture(ir_tg4
, es31_not_gs5
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
| TEX_COMPONENT
),
3807 _texture(ir_tg4
, es31_not_gs5
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
| TEX_COMPONENT
),
3809 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3810 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3811 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3813 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
),
3814 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
),
3815 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
),
3817 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3818 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3819 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3821 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3822 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3823 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3825 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3826 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3827 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3829 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3830 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3831 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3833 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3834 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
),
3835 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3837 _texture(ir_tg4
, es31_not_gs5
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3838 _texture(ir_tg4
, es31_not_gs5
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3841 add_function("textureGatherOffsets",
3842 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3843 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3844 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3846 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3847 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3848 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3850 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
),
3851 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
),
3852 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
),
3854 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3855 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3856 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3858 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3859 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3860 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3862 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3863 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3864 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3866 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3867 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
),
3868 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3893 add_function("ldexp",
3894 _ldexp(glsl_type::float_type
, glsl_type::int_type
),
3895 _ldexp(glsl_type::vec2_type
, glsl_type::ivec2_type
),
3896 _ldexp(glsl_type::vec3_type
, glsl_type::ivec3_type
),
3897 _ldexp(glsl_type::vec4_type
, glsl_type::ivec4_type
),
3898 _ldexp(glsl_type::double_type
, glsl_type::int_type
),
3899 _ldexp(glsl_type::dvec2_type
, glsl_type::ivec2_type
),
3900 _ldexp(glsl_type::dvec3_type
, glsl_type::ivec3_type
),
3901 _ldexp(glsl_type::dvec4_type
, glsl_type::ivec4_type
),
3904 add_function("frexp",
3905 _frexp(glsl_type::float_type
, glsl_type::int_type
),
3906 _frexp(glsl_type::vec2_type
, glsl_type::ivec2_type
),
3907 _frexp(glsl_type::vec3_type
, glsl_type::ivec3_type
),
3908 _frexp(glsl_type::vec4_type
, glsl_type::ivec4_type
),
3909 _dfrexp(glsl_type::double_type
, glsl_type::int_type
),
3910 _dfrexp(glsl_type::dvec2_type
, glsl_type::ivec2_type
),
3911 _dfrexp(glsl_type::dvec3_type
, glsl_type::ivec3_type
),
3912 _dfrexp(glsl_type::dvec4_type
, glsl_type::ivec4_type
),
3914 add_function("uaddCarry",
3915 _uaddCarry(glsl_type::uint_type
),
3916 _uaddCarry(glsl_type::uvec2_type
),
3917 _uaddCarry(glsl_type::uvec3_type
),
3918 _uaddCarry(glsl_type::uvec4_type
),
3920 add_function("usubBorrow",
3921 _usubBorrow(glsl_type::uint_type
),
3922 _usubBorrow(glsl_type::uvec2_type
),
3923 _usubBorrow(glsl_type::uvec3_type
),
3924 _usubBorrow(glsl_type::uvec4_type
),
3926 add_function("imulExtended",
3927 _mulExtended(glsl_type::int_type
),
3928 _mulExtended(glsl_type::ivec2_type
),
3929 _mulExtended(glsl_type::ivec3_type
),
3930 _mulExtended(glsl_type::ivec4_type
),
3932 add_function("umulExtended",
3933 _mulExtended(glsl_type::uint_type
),
3934 _mulExtended(glsl_type::uvec2_type
),
3935 _mulExtended(glsl_type::uvec3_type
),
3936 _mulExtended(glsl_type::uvec4_type
),
3938 add_function("interpolateAtCentroid",
3939 _interpolateAtCentroid(glsl_type::float_type
),
3940 _interpolateAtCentroid(glsl_type::vec2_type
),
3941 _interpolateAtCentroid(glsl_type::vec3_type
),
3942 _interpolateAtCentroid(glsl_type::vec4_type
),
3944 add_function("interpolateAtOffset",
3945 _interpolateAtOffset(glsl_type::float_type
),
3946 _interpolateAtOffset(glsl_type::vec2_type
),
3947 _interpolateAtOffset(glsl_type::vec3_type
),
3948 _interpolateAtOffset(glsl_type::vec4_type
),
3950 add_function("interpolateAtSample",
3951 _interpolateAtSample(glsl_type::float_type
),
3952 _interpolateAtSample(glsl_type::vec2_type
),
3953 _interpolateAtSample(glsl_type::vec3_type
),
3954 _interpolateAtSample(glsl_type::vec4_type
),
3957 add_function("atomicCounter",
3958 _atomic_counter_op("__intrinsic_atomic_read",
3959 shader_atomic_counters
),
3961 add_function("atomicCounterIncrement",
3962 _atomic_counter_op("__intrinsic_atomic_increment",
3963 shader_atomic_counters
),
3965 add_function("atomicCounterDecrement",
3966 _atomic_counter_op("__intrinsic_atomic_predecrement",
3967 shader_atomic_counters
),
3970 add_function("atomicCounterAddARB",
3971 _atomic_counter_op1("__intrinsic_atomic_add",
3972 shader_atomic_counter_ops
),
3974 add_function("atomicCounterSubtractARB",
3975 _atomic_counter_op1("__intrinsic_atomic_sub",
3976 shader_atomic_counter_ops
),
3978 add_function("atomicCounterMinARB",
3979 _atomic_counter_op1("__intrinsic_atomic_min",
3980 shader_atomic_counter_ops
),
3982 add_function("atomicCounterMaxARB",
3983 _atomic_counter_op1("__intrinsic_atomic_max",
3984 shader_atomic_counter_ops
),
3986 add_function("atomicCounterAndARB",
3987 _atomic_counter_op1("__intrinsic_atomic_and",
3988 shader_atomic_counter_ops
),
3990 add_function("atomicCounterOrARB",
3991 _atomic_counter_op1("__intrinsic_atomic_or",
3992 shader_atomic_counter_ops
),
3994 add_function("atomicCounterXorARB",
3995 _atomic_counter_op1("__intrinsic_atomic_xor",
3996 shader_atomic_counter_ops
),
3998 add_function("atomicCounterExchangeARB",
3999 _atomic_counter_op1("__intrinsic_atomic_exchange",
4000 shader_atomic_counter_ops
),
4002 add_function("atomicCounterCompSwapARB",
4003 _atomic_counter_op2("__intrinsic_atomic_comp_swap",
4004 shader_atomic_counter_ops
),
4007 add_function("atomicCounterAdd",
4008 _atomic_counter_op1("__intrinsic_atomic_add",
4011 add_function("atomicCounterSubtract",
4012 _atomic_counter_op1("__intrinsic_atomic_sub",
4015 add_function("atomicCounterMin",
4016 _atomic_counter_op1("__intrinsic_atomic_min",
4019 add_function("atomicCounterMax",
4020 _atomic_counter_op1("__intrinsic_atomic_max",
4023 add_function("atomicCounterAnd",
4024 _atomic_counter_op1("__intrinsic_atomic_and",
4027 add_function("atomicCounterOr",
4028 _atomic_counter_op1("__intrinsic_atomic_or",
4031 add_function("atomicCounterXor",
4032 _atomic_counter_op1("__intrinsic_atomic_xor",
4035 add_function("atomicCounterExchange",
4036 _atomic_counter_op1("__intrinsic_atomic_exchange",
4039 add_function("atomicCounterCompSwap",
4040 _atomic_counter_op2("__intrinsic_atomic_comp_swap",
4044 add_function("atomicAdd",
4045 _atomic_op2("__intrinsic_atomic_add",
4046 buffer_atomics_supported
,
4047 glsl_type::uint_type
),
4048 _atomic_op2("__intrinsic_atomic_add",
4049 buffer_atomics_supported
,
4050 glsl_type::int_type
),
4051 _atomic_op2("__intrinsic_atomic_add",
4052 shader_atomic_float_add
,
4053 glsl_type::float_type
),
4055 add_function("atomicMin",
4056 _atomic_op2("__intrinsic_atomic_min",
4057 buffer_atomics_supported
,
4058 glsl_type::uint_type
),
4059 _atomic_op2("__intrinsic_atomic_min",
4060 buffer_atomics_supported
,
4061 glsl_type::int_type
),
4062 _atomic_op2("__intrinsic_atomic_min",
4063 shader_atomic_float_minmax
,
4064 glsl_type::float_type
),
4066 add_function("atomicMax",
4067 _atomic_op2("__intrinsic_atomic_max",
4068 buffer_atomics_supported
,
4069 glsl_type::uint_type
),
4070 _atomic_op2("__intrinsic_atomic_max",
4071 buffer_atomics_supported
,
4072 glsl_type::int_type
),
4073 _atomic_op2("__intrinsic_atomic_max",
4074 shader_atomic_float_minmax
,
4075 glsl_type::float_type
),
4077 add_function("atomicAnd",
4078 _atomic_op2("__intrinsic_atomic_and",
4079 buffer_atomics_supported
,
4080 glsl_type::uint_type
),
4081 _atomic_op2("__intrinsic_atomic_and",
4082 buffer_atomics_supported
,
4083 glsl_type::int_type
),
4085 add_function("atomicOr",
4086 _atomic_op2("__intrinsic_atomic_or",
4087 buffer_atomics_supported
,
4088 glsl_type::uint_type
),
4089 _atomic_op2("__intrinsic_atomic_or",
4090 buffer_atomics_supported
,
4091 glsl_type::int_type
),
4093 add_function("atomicXor",
4094 _atomic_op2("__intrinsic_atomic_xor",
4095 buffer_atomics_supported
,
4096 glsl_type::uint_type
),
4097 _atomic_op2("__intrinsic_atomic_xor",
4098 buffer_atomics_supported
,
4099 glsl_type::int_type
),
4101 add_function("atomicExchange",
4102 _atomic_op2("__intrinsic_atomic_exchange",
4103 buffer_atomics_supported
,
4104 glsl_type::uint_type
),
4105 _atomic_op2("__intrinsic_atomic_exchange",
4106 buffer_atomics_supported
,
4107 glsl_type::int_type
),
4108 _atomic_op2("__intrinsic_atomic_exchange",
4109 shader_atomic_float_exchange
,
4110 glsl_type::float_type
),
4112 add_function("atomicCompSwap",
4113 _atomic_op3("__intrinsic_atomic_comp_swap",
4114 buffer_atomics_supported
,
4115 glsl_type::uint_type
),
4116 _atomic_op3("__intrinsic_atomic_comp_swap",
4117 buffer_atomics_supported
,
4118 glsl_type::int_type
),
4119 _atomic_op3("__intrinsic_atomic_comp_swap",
4120 shader_atomic_float_minmax
,
4121 glsl_type::float_type
),
4124 add_function("min3",
4125 _min3(glsl_type::float_type
),
4126 _min3(glsl_type::vec2_type
),
4127 _min3(glsl_type::vec3_type
),
4128 _min3(glsl_type::vec4_type
),
4130 _min3(glsl_type::int_type
),
4131 _min3(glsl_type::ivec2_type
),
4132 _min3(glsl_type::ivec3_type
),
4133 _min3(glsl_type::ivec4_type
),
4135 _min3(glsl_type::uint_type
),
4136 _min3(glsl_type::uvec2_type
),
4137 _min3(glsl_type::uvec3_type
),
4138 _min3(glsl_type::uvec4_type
),
4141 add_function("max3",
4142 _max3(glsl_type::float_type
),
4143 _max3(glsl_type::vec2_type
),
4144 _max3(glsl_type::vec3_type
),
4145 _max3(glsl_type::vec4_type
),
4147 _max3(glsl_type::int_type
),
4148 _max3(glsl_type::ivec2_type
),
4149 _max3(glsl_type::ivec3_type
),
4150 _max3(glsl_type::ivec4_type
),
4152 _max3(glsl_type::uint_type
),
4153 _max3(glsl_type::uvec2_type
),
4154 _max3(glsl_type::uvec3_type
),
4155 _max3(glsl_type::uvec4_type
),
4158 add_function("mid3",
4159 _mid3(glsl_type::float_type
),
4160 _mid3(glsl_type::vec2_type
),
4161 _mid3(glsl_type::vec3_type
),
4162 _mid3(glsl_type::vec4_type
),
4164 _mid3(glsl_type::int_type
),
4165 _mid3(glsl_type::ivec2_type
),
4166 _mid3(glsl_type::ivec3_type
),
4167 _mid3(glsl_type::ivec4_type
),
4169 _mid3(glsl_type::uint_type
),
4170 _mid3(glsl_type::uvec2_type
),
4171 _mid3(glsl_type::uvec3_type
),
4172 _mid3(glsl_type::uvec4_type
),
4175 add_image_functions(true);
4177 add_function("memoryBarrier",
4178 _memory_barrier("__intrinsic_memory_barrier",
4179 shader_image_load_store
),
4181 add_function("groupMemoryBarrier",
4182 _memory_barrier("__intrinsic_group_memory_barrier",
4185 add_function("memoryBarrierAtomicCounter",
4186 _memory_barrier("__intrinsic_memory_barrier_atomic_counter",
4187 compute_shader_supported
),
4189 add_function("memoryBarrierBuffer",
4190 _memory_barrier("__intrinsic_memory_barrier_buffer",
4191 compute_shader_supported
),
4193 add_function("memoryBarrierImage",
4194 _memory_barrier("__intrinsic_memory_barrier_image",
4195 compute_shader_supported
),
4197 add_function("memoryBarrierShared",
4198 _memory_barrier("__intrinsic_memory_barrier_shared",
4202 add_function("ballotARB", _ballot(), NULL
);
4204 add_function("readInvocationARB",
4205 _read_invocation(glsl_type::float_type
),
4206 _read_invocation(glsl_type::vec2_type
),
4207 _read_invocation(glsl_type::vec3_type
),
4208 _read_invocation(glsl_type::vec4_type
),
4210 _read_invocation(glsl_type::int_type
),
4211 _read_invocation(glsl_type::ivec2_type
),
4212 _read_invocation(glsl_type::ivec3_type
),
4213 _read_invocation(glsl_type::ivec4_type
),
4215 _read_invocation(glsl_type::uint_type
),
4216 _read_invocation(glsl_type::uvec2_type
),
4217 _read_invocation(glsl_type::uvec3_type
),
4218 _read_invocation(glsl_type::uvec4_type
),
4221 add_function("readFirstInvocationARB",
4222 _read_first_invocation(glsl_type::float_type
),
4223 _read_first_invocation(glsl_type::vec2_type
),
4224 _read_first_invocation(glsl_type::vec3_type
),
4225 _read_first_invocation(glsl_type::vec4_type
),
4227 _read_first_invocation(glsl_type::int_type
),
4228 _read_first_invocation(glsl_type::ivec2_type
),
4229 _read_first_invocation(glsl_type::ivec3_type
),
4230 _read_first_invocation(glsl_type::ivec4_type
),
4232 _read_first_invocation(glsl_type::uint_type
),
4233 _read_first_invocation(glsl_type::uvec2_type
),
4234 _read_first_invocation(glsl_type::uvec3_type
),
4235 _read_first_invocation(glsl_type::uvec4_type
),
4238 add_function("clock2x32ARB",
4239 _shader_clock(shader_clock
,
4240 glsl_type::uvec2_type
),
4243 add_function("clockARB",
4244 _shader_clock(shader_clock_int64
,
4245 glsl_type::uint64_t_type
),
4248 add_function("beginInvocationInterlockARB",
4249 _invocation_interlock(
4250 "__intrinsic_begin_invocation_interlock",
4251 supports_arb_fragment_shader_interlock
),
4254 add_function("endInvocationInterlockARB",
4255 _invocation_interlock(
4256 "__intrinsic_end_invocation_interlock",
4257 supports_arb_fragment_shader_interlock
),
4260 add_function("beginInvocationInterlockNV",
4261 _invocation_interlock(
4262 "__intrinsic_begin_invocation_interlock",
4263 supports_nv_fragment_shader_interlock
),
4266 add_function("endInvocationInterlockNV",
4267 _invocation_interlock(
4268 "__intrinsic_end_invocation_interlock",
4269 supports_nv_fragment_shader_interlock
),
4272 add_function("anyInvocationARB",
4273 _vote("__intrinsic_vote_any", vote
),
4276 add_function("allInvocationsARB",
4277 _vote("__intrinsic_vote_all", vote
),
4280 add_function("allInvocationsEqualARB",
4281 _vote("__intrinsic_vote_eq", vote
),
4284 add_function("anyInvocationEXT",
4285 _vote("__intrinsic_vote_any", vote_ext
),
4288 add_function("allInvocationsEXT",
4289 _vote("__intrinsic_vote_all", vote_ext
),
4292 add_function("allInvocationsEqualEXT",
4293 _vote("__intrinsic_vote_eq", vote_ext
),
4296 add_function("anyInvocation",
4297 _vote("__intrinsic_vote_any", v460_desktop
),
4300 add_function("allInvocations",
4301 _vote("__intrinsic_vote_all", v460_desktop
),
4304 add_function("allInvocationsEqual",
4305 _vote("__intrinsic_vote_eq", v460_desktop
),
4308 add_function("helperInvocationEXT", _helper_invocation(), NULL
);
4310 add_function("__builtin_idiv64",
4311 generate_ir::idiv64(mem_ctx
, integer_functions_supported
),
4314 add_function("__builtin_imod64",
4315 generate_ir::imod64(mem_ctx
, integer_functions_supported
),
4318 add_function("__builtin_sign64",
4319 generate_ir::sign64(mem_ctx
, integer_functions_supported
),
4322 add_function("__builtin_udiv64",
4323 generate_ir::udiv64(mem_ctx
, integer_functions_supported
),
4326 add_function("__builtin_umod64",
4327 generate_ir::umod64(mem_ctx
, integer_functions_supported
),
4330 add_function("__builtin_umul64",
4331 generate_ir::umul64(mem_ctx
, integer_functions_supported
),
4334 add_function("countLeadingZeros",
4335 _countLeadingZeros(shader_integer_functions2
,
4336 glsl_type::uint_type
),
4337 _countLeadingZeros(shader_integer_functions2
,
4338 glsl_type::uvec2_type
),
4339 _countLeadingZeros(shader_integer_functions2
,
4340 glsl_type::uvec3_type
),
4341 _countLeadingZeros(shader_integer_functions2
,
4342 glsl_type::uvec4_type
),
4345 add_function("countTrailingZeros",
4346 _countTrailingZeros(shader_integer_functions2
,
4347 glsl_type::uint_type
),
4348 _countTrailingZeros(shader_integer_functions2
,
4349 glsl_type::uvec2_type
),
4350 _countTrailingZeros(shader_integer_functions2
,
4351 glsl_type::uvec3_type
),
4352 _countTrailingZeros(shader_integer_functions2
,
4353 glsl_type::uvec4_type
),
4356 add_function("absoluteDifference",
4357 _absoluteDifference(shader_integer_functions2
,
4358 glsl_type::int_type
),
4359 _absoluteDifference(shader_integer_functions2
,
4360 glsl_type::ivec2_type
),
4361 _absoluteDifference(shader_integer_functions2
,
4362 glsl_type::ivec3_type
),
4363 _absoluteDifference(shader_integer_functions2
,
4364 glsl_type::ivec4_type
),
4365 _absoluteDifference(shader_integer_functions2
,
4366 glsl_type::uint_type
),
4367 _absoluteDifference(shader_integer_functions2
,
4368 glsl_type::uvec2_type
),
4369 _absoluteDifference(shader_integer_functions2
,
4370 glsl_type::uvec3_type
),
4371 _absoluteDifference(shader_integer_functions2
,
4372 glsl_type::uvec4_type
),
4374 _absoluteDifference(shader_integer_functions2_int64
,
4375 glsl_type::int64_t_type
),
4376 _absoluteDifference(shader_integer_functions2_int64
,
4377 glsl_type::i64vec2_type
),
4378 _absoluteDifference(shader_integer_functions2_int64
,
4379 glsl_type::i64vec3_type
),
4380 _absoluteDifference(shader_integer_functions2_int64
,
4381 glsl_type::i64vec4_type
),
4382 _absoluteDifference(shader_integer_functions2_int64
,
4383 glsl_type::uint64_t_type
),
4384 _absoluteDifference(shader_integer_functions2_int64
,
4385 glsl_type::u64vec2_type
),
4386 _absoluteDifference(shader_integer_functions2_int64
,
4387 glsl_type::u64vec3_type
),
4388 _absoluteDifference(shader_integer_functions2_int64
,
4389 glsl_type::u64vec4_type
),
4392 add_function("addSaturate",
4393 _addSaturate(shader_integer_functions2
,
4394 glsl_type::int_type
),
4395 _addSaturate(shader_integer_functions2
,
4396 glsl_type::ivec2_type
),
4397 _addSaturate(shader_integer_functions2
,
4398 glsl_type::ivec3_type
),
4399 _addSaturate(shader_integer_functions2
,
4400 glsl_type::ivec4_type
),
4401 _addSaturate(shader_integer_functions2
,
4402 glsl_type::uint_type
),
4403 _addSaturate(shader_integer_functions2
,
4404 glsl_type::uvec2_type
),
4405 _addSaturate(shader_integer_functions2
,
4406 glsl_type::uvec3_type
),
4407 _addSaturate(shader_integer_functions2
,
4408 glsl_type::uvec4_type
),
4410 _addSaturate(shader_integer_functions2_int64
,
4411 glsl_type::int64_t_type
),
4412 _addSaturate(shader_integer_functions2_int64
,
4413 glsl_type::i64vec2_type
),
4414 _addSaturate(shader_integer_functions2_int64
,
4415 glsl_type::i64vec3_type
),
4416 _addSaturate(shader_integer_functions2_int64
,
4417 glsl_type::i64vec4_type
),
4418 _addSaturate(shader_integer_functions2_int64
,
4419 glsl_type::uint64_t_type
),
4420 _addSaturate(shader_integer_functions2_int64
,
4421 glsl_type::u64vec2_type
),
4422 _addSaturate(shader_integer_functions2_int64
,
4423 glsl_type::u64vec3_type
),
4424 _addSaturate(shader_integer_functions2_int64
,
4425 glsl_type::u64vec4_type
),
4428 add_function("average",
4429 _average(shader_integer_functions2
,
4430 glsl_type::int_type
),
4431 _average(shader_integer_functions2
,
4432 glsl_type::ivec2_type
),
4433 _average(shader_integer_functions2
,
4434 glsl_type::ivec3_type
),
4435 _average(shader_integer_functions2
,
4436 glsl_type::ivec4_type
),
4437 _average(shader_integer_functions2
,
4438 glsl_type::uint_type
),
4439 _average(shader_integer_functions2
,
4440 glsl_type::uvec2_type
),
4441 _average(shader_integer_functions2
,
4442 glsl_type::uvec3_type
),
4443 _average(shader_integer_functions2
,
4444 glsl_type::uvec4_type
),
4446 _average(shader_integer_functions2_int64
,
4447 glsl_type::int64_t_type
),
4448 _average(shader_integer_functions2_int64
,
4449 glsl_type::i64vec2_type
),
4450 _average(shader_integer_functions2_int64
,
4451 glsl_type::i64vec3_type
),
4452 _average(shader_integer_functions2_int64
,
4453 glsl_type::i64vec4_type
),
4454 _average(shader_integer_functions2_int64
,
4455 glsl_type::uint64_t_type
),
4456 _average(shader_integer_functions2_int64
,
4457 glsl_type::u64vec2_type
),
4458 _average(shader_integer_functions2_int64
,
4459 glsl_type::u64vec3_type
),
4460 _average(shader_integer_functions2_int64
,
4461 glsl_type::u64vec4_type
),
4464 add_function("averageRounded",
4465 _averageRounded(shader_integer_functions2
,
4466 glsl_type::int_type
),
4467 _averageRounded(shader_integer_functions2
,
4468 glsl_type::ivec2_type
),
4469 _averageRounded(shader_integer_functions2
,
4470 glsl_type::ivec3_type
),
4471 _averageRounded(shader_integer_functions2
,
4472 glsl_type::ivec4_type
),
4473 _averageRounded(shader_integer_functions2
,
4474 glsl_type::uint_type
),
4475 _averageRounded(shader_integer_functions2
,
4476 glsl_type::uvec2_type
),
4477 _averageRounded(shader_integer_functions2
,
4478 glsl_type::uvec3_type
),
4479 _averageRounded(shader_integer_functions2
,
4480 glsl_type::uvec4_type
),
4482 _averageRounded(shader_integer_functions2_int64
,
4483 glsl_type::int64_t_type
),
4484 _averageRounded(shader_integer_functions2_int64
,
4485 glsl_type::i64vec2_type
),
4486 _averageRounded(shader_integer_functions2_int64
,
4487 glsl_type::i64vec3_type
),
4488 _averageRounded(shader_integer_functions2_int64
,
4489 glsl_type::i64vec4_type
),
4490 _averageRounded(shader_integer_functions2_int64
,
4491 glsl_type::uint64_t_type
),
4492 _averageRounded(shader_integer_functions2_int64
,
4493 glsl_type::u64vec2_type
),
4494 _averageRounded(shader_integer_functions2_int64
,
4495 glsl_type::u64vec3_type
),
4496 _averageRounded(shader_integer_functions2_int64
,
4497 glsl_type::u64vec4_type
),
4500 add_function("subtractSaturate",
4501 _subtractSaturate(shader_integer_functions2
,
4502 glsl_type::int_type
),
4503 _subtractSaturate(shader_integer_functions2
,
4504 glsl_type::ivec2_type
),
4505 _subtractSaturate(shader_integer_functions2
,
4506 glsl_type::ivec3_type
),
4507 _subtractSaturate(shader_integer_functions2
,
4508 glsl_type::ivec4_type
),
4509 _subtractSaturate(shader_integer_functions2
,
4510 glsl_type::uint_type
),
4511 _subtractSaturate(shader_integer_functions2
,
4512 glsl_type::uvec2_type
),
4513 _subtractSaturate(shader_integer_functions2
,
4514 glsl_type::uvec3_type
),
4515 _subtractSaturate(shader_integer_functions2
,
4516 glsl_type::uvec4_type
),
4518 _subtractSaturate(shader_integer_functions2_int64
,
4519 glsl_type::int64_t_type
),
4520 _subtractSaturate(shader_integer_functions2_int64
,
4521 glsl_type::i64vec2_type
),
4522 _subtractSaturate(shader_integer_functions2_int64
,
4523 glsl_type::i64vec3_type
),
4524 _subtractSaturate(shader_integer_functions2_int64
,
4525 glsl_type::i64vec4_type
),
4526 _subtractSaturate(shader_integer_functions2_int64
,
4527 glsl_type::uint64_t_type
),
4528 _subtractSaturate(shader_integer_functions2_int64
,
4529 glsl_type::u64vec2_type
),
4530 _subtractSaturate(shader_integer_functions2_int64
,
4531 glsl_type::u64vec3_type
),
4532 _subtractSaturate(shader_integer_functions2_int64
,
4533 glsl_type::u64vec4_type
),
4536 add_function("multiply32x16",
4537 _multiply32x16(shader_integer_functions2
,
4538 glsl_type::int_type
),
4539 _multiply32x16(shader_integer_functions2
,
4540 glsl_type::ivec2_type
),
4541 _multiply32x16(shader_integer_functions2
,
4542 glsl_type::ivec3_type
),
4543 _multiply32x16(shader_integer_functions2
,
4544 glsl_type::ivec4_type
),
4545 _multiply32x16(shader_integer_functions2
,
4546 glsl_type::uint_type
),
4547 _multiply32x16(shader_integer_functions2
,
4548 glsl_type::uvec2_type
),
4549 _multiply32x16(shader_integer_functions2
,
4550 glsl_type::uvec3_type
),
4551 _multiply32x16(shader_integer_functions2
,
4552 glsl_type::uvec4_type
),
4563 builtin_builder::add_function(const char *name
, ...)
4567 ir_function
*f
= new(mem_ctx
) ir_function(name
);
4571 ir_function_signature
*sig
= va_arg(ap
, ir_function_signature
*);
4577 stuff
.push_tail(sig
);
4578 validate_ir_tree(&stuff
);
4581 f
->add_signature(sig
);
4585 shader
->symbols
->add_function(f
);
4589 builtin_builder::add_image_function(const char *name
,
4590 const char *intrinsic_name
,
4591 image_prototype_ctr prototype
,
4592 unsigned num_arguments
,
4594 enum ir_intrinsic_id intrinsic_id
)
4596 static const glsl_type
*const types
[] = {
4597 glsl_type::image1D_type
,
4598 glsl_type::image2D_type
,
4599 glsl_type::image3D_type
,
4600 glsl_type::image2DRect_type
,
4601 glsl_type::imageCube_type
,
4602 glsl_type::imageBuffer_type
,
4603 glsl_type::image1DArray_type
,
4604 glsl_type::image2DArray_type
,
4605 glsl_type::imageCubeArray_type
,
4606 glsl_type::image2DMS_type
,
4607 glsl_type::image2DMSArray_type
,
4608 glsl_type::iimage1D_type
,
4609 glsl_type::iimage2D_type
,
4610 glsl_type::iimage3D_type
,
4611 glsl_type::iimage2DRect_type
,
4612 glsl_type::iimageCube_type
,
4613 glsl_type::iimageBuffer_type
,
4614 glsl_type::iimage1DArray_type
,
4615 glsl_type::iimage2DArray_type
,
4616 glsl_type::iimageCubeArray_type
,
4617 glsl_type::iimage2DMS_type
,
4618 glsl_type::iimage2DMSArray_type
,
4619 glsl_type::uimage1D_type
,
4620 glsl_type::uimage2D_type
,
4621 glsl_type::uimage3D_type
,
4622 glsl_type::uimage2DRect_type
,
4623 glsl_type::uimageCube_type
,
4624 glsl_type::uimageBuffer_type
,
4625 glsl_type::uimage1DArray_type
,
4626 glsl_type::uimage2DArray_type
,
4627 glsl_type::uimageCubeArray_type
,
4628 glsl_type::uimage2DMS_type
,
4629 glsl_type::uimage2DMSArray_type
4632 ir_function
*f
= new(mem_ctx
) ir_function(name
);
4634 for (unsigned i
= 0; i
< ARRAY_SIZE(types
); ++i
) {
4635 if (types
[i
]->sampled_type
== GLSL_TYPE_FLOAT
&& !(flags
& IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
))
4637 if (types
[i
]->sampled_type
== GLSL_TYPE_INT
&& !(flags
& IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
))
4639 if ((types
[i
]->sampler_dimensionality
!= GLSL_SAMPLER_DIM_MS
) && (flags
& IMAGE_FUNCTION_MS_ONLY
))
4641 f
->add_signature(_image(prototype
, types
[i
], intrinsic_name
,
4642 num_arguments
, flags
, intrinsic_id
));
4644 shader
->symbols
->add_function(f
);
4648 builtin_builder::add_image_functions(bool glsl
)
4650 const unsigned flags
= (glsl
? IMAGE_FUNCTION_EMIT_STUB
: 0);
4652 add_image_function(glsl
? "imageLoad" : "__intrinsic_image_load",
4653 "__intrinsic_image_load",
4654 &builtin_builder::_image_prototype
, 0,
4655 (flags
| IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE
|
4656 IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
|
4657 IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
|
4658 IMAGE_FUNCTION_READ_ONLY
),
4659 ir_intrinsic_image_load
);
4661 add_image_function(glsl
? "imageStore" : "__intrinsic_image_store",
4662 "__intrinsic_image_store",
4663 &builtin_builder::_image_prototype
, 1,
4664 (flags
| IMAGE_FUNCTION_RETURNS_VOID
|
4665 IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE
|
4666 IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
|
4667 IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
|
4668 IMAGE_FUNCTION_WRITE_ONLY
),
4669 ir_intrinsic_image_store
);
4671 const unsigned atom_flags
= flags
| IMAGE_FUNCTION_AVAIL_ATOMIC
;
4673 add_image_function(glsl
? "imageAtomicAdd" : "__intrinsic_image_atomic_add",
4674 "__intrinsic_image_atomic_add",
4675 &builtin_builder::_image_prototype
, 1,
4676 (flags
| IMAGE_FUNCTION_AVAIL_ATOMIC_ADD
|
4677 IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
|
4678 IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
),
4679 ir_intrinsic_image_atomic_add
);
4681 add_image_function(glsl
? "imageAtomicMin" : "__intrinsic_image_atomic_min",
4682 "__intrinsic_image_atomic_min",
4683 &builtin_builder::_image_prototype
, 1,
4684 atom_flags
| IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
,
4685 ir_intrinsic_image_atomic_min
);
4687 add_image_function(glsl
? "imageAtomicMax" : "__intrinsic_image_atomic_max",
4688 "__intrinsic_image_atomic_max",
4689 &builtin_builder::_image_prototype
, 1,
4690 atom_flags
| IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
,
4691 ir_intrinsic_image_atomic_max
);
4693 add_image_function(glsl
? "imageAtomicAnd" : "__intrinsic_image_atomic_and",
4694 "__intrinsic_image_atomic_and",
4695 &builtin_builder::_image_prototype
, 1,
4696 atom_flags
| IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
,
4697 ir_intrinsic_image_atomic_and
);
4699 add_image_function(glsl
? "imageAtomicOr" : "__intrinsic_image_atomic_or",
4700 "__intrinsic_image_atomic_or",
4701 &builtin_builder::_image_prototype
, 1,
4702 atom_flags
| IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
,
4703 ir_intrinsic_image_atomic_or
);
4705 add_image_function(glsl
? "imageAtomicXor" : "__intrinsic_image_atomic_xor",
4706 "__intrinsic_image_atomic_xor",
4707 &builtin_builder::_image_prototype
, 1,
4708 atom_flags
| IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
,
4709 ir_intrinsic_image_atomic_xor
);
4711 add_image_function((glsl
? "imageAtomicExchange" :
4712 "__intrinsic_image_atomic_exchange"),
4713 "__intrinsic_image_atomic_exchange",
4714 &builtin_builder::_image_prototype
, 1,
4715 (flags
| IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE
|
4716 IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
|
4717 IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
),
4718 ir_intrinsic_image_atomic_exchange
);
4720 add_image_function((glsl
? "imageAtomicCompSwap" :
4721 "__intrinsic_image_atomic_comp_swap"),
4722 "__intrinsic_image_atomic_comp_swap",
4723 &builtin_builder::_image_prototype
, 2,
4724 atom_flags
| IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
,
4725 ir_intrinsic_image_atomic_comp_swap
);
4727 add_image_function(glsl
? "imageSize" : "__intrinsic_image_size",
4728 "__intrinsic_image_size",
4729 &builtin_builder::_image_size_prototype
, 1,
4730 flags
| IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
|
4731 IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
,
4732 ir_intrinsic_image_size
);
4734 add_image_function(glsl
? "imageSamples" : "__intrinsic_image_samples",
4735 "__intrinsic_image_samples",
4736 &builtin_builder::_image_samples_prototype
, 1,
4737 flags
| IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
|
4738 IMAGE_FUNCTION_SUPPORTS_SIGNED_DATA_TYPE
|
4739 IMAGE_FUNCTION_MS_ONLY
,
4740 ir_intrinsic_image_samples
);
4742 /* EXT_shader_image_load_store */
4743 add_image_function(glsl
? "imageAtomicIncWrap" : "__intrinsic_image_atomic_inc_wrap",
4744 "__intrinsic_image_atomic_inc_wrap",
4745 &builtin_builder::_image_prototype
, 1,
4746 (atom_flags
| IMAGE_FUNCTION_EXT_ONLY
),
4747 ir_intrinsic_image_atomic_inc_wrap
);
4748 add_image_function(glsl
? "imageAtomicDecWrap" : "__intrinsic_image_atomic_dec_wrap",
4749 "__intrinsic_image_atomic_dec_wrap",
4750 &builtin_builder::_image_prototype
, 1,
4751 (atom_flags
| IMAGE_FUNCTION_EXT_ONLY
),
4752 ir_intrinsic_image_atomic_dec_wrap
);
4756 builtin_builder::in_var(const glsl_type
*type
, const char *name
)
4758 return new(mem_ctx
) ir_variable(type
, name
, ir_var_function_in
);
4762 builtin_builder::out_var(const glsl_type
*type
, const char *name
)
4764 return new(mem_ctx
) ir_variable(type
, name
, ir_var_function_out
);
4768 builtin_builder::imm(bool b
, unsigned vector_elements
)
4770 return new(mem_ctx
) ir_constant(b
, vector_elements
);
4774 builtin_builder::imm(float f
, unsigned vector_elements
)
4776 return new(mem_ctx
) ir_constant(f
, vector_elements
);
4780 builtin_builder::imm(int i
, unsigned vector_elements
)
4782 return new(mem_ctx
) ir_constant(i
, vector_elements
);
4786 builtin_builder::imm(unsigned u
, unsigned vector_elements
)
4788 return new(mem_ctx
) ir_constant(u
, vector_elements
);
4792 builtin_builder::imm(double d
, unsigned vector_elements
)
4794 return new(mem_ctx
) ir_constant(d
, vector_elements
);
4798 builtin_builder::imm(const glsl_type
*type
, const ir_constant_data
&data
)
4800 return new(mem_ctx
) ir_constant(type
, &data
);
4803 #define IMM_FP(type, val) (type->is_double()) ? imm(val) : imm((float)val)
4805 ir_dereference_variable
*
4806 builtin_builder::var_ref(ir_variable
*var
)
4808 return new(mem_ctx
) ir_dereference_variable(var
);
4811 ir_dereference_array
*
4812 builtin_builder::array_ref(ir_variable
*var
, int idx
)
4814 return new(mem_ctx
) ir_dereference_array(var
, imm(idx
));
4817 /** Return an element of a matrix */
4819 builtin_builder::matrix_elt(ir_variable
*var
, int column
, int row
)
4821 return swizzle(array_ref(var
, column
), row
, 1);
4825 * Implementations of built-in functions:
4828 ir_function_signature
*
4829 builtin_builder::new_sig(const glsl_type
*return_type
,
4830 builtin_available_predicate avail
,
4836 ir_function_signature
*sig
=
4837 new(mem_ctx
) ir_function_signature(return_type
, avail
);
4840 va_start(ap
, num_params
);
4841 for (int i
= 0; i
< num_params
; i
++) {
4842 plist
.push_tail(va_arg(ap
, ir_variable
*));
4846 sig
->replace_parameters(&plist
);
4850 #define MAKE_SIG(return_type, avail, ...) \
4851 ir_function_signature *sig = \
4852 new_sig(return_type, avail, __VA_ARGS__); \
4853 ir_factory body(&sig->body, mem_ctx); \
4854 sig->is_defined = true;
4856 #define MAKE_INTRINSIC(return_type, id, avail, ...) \
4857 ir_function_signature *sig = \
4858 new_sig(return_type, avail, __VA_ARGS__); \
4859 sig->intrinsic_id = id;
4861 ir_function_signature
*
4862 builtin_builder::unop(builtin_available_predicate avail
,
4863 ir_expression_operation opcode
,
4864 const glsl_type
*return_type
,
4865 const glsl_type
*param_type
)
4867 ir_variable
*x
= in_var(param_type
, "x");
4868 MAKE_SIG(return_type
, avail
, 1, x
);
4869 body
.emit(ret(expr(opcode
, x
)));
4873 #define UNOP(NAME, OPCODE, AVAIL) \
4874 ir_function_signature * \
4875 builtin_builder::_##NAME(const glsl_type *type) \
4877 return unop(&AVAIL, OPCODE, type, type); \
4880 #define UNOPA(NAME, OPCODE) \
4881 ir_function_signature * \
4882 builtin_builder::_##NAME(builtin_available_predicate avail, const glsl_type *type) \
4884 return unop(avail, OPCODE, type, type); \
4887 ir_function_signature
*
4888 builtin_builder::binop(builtin_available_predicate avail
,
4889 ir_expression_operation opcode
,
4890 const glsl_type
*return_type
,
4891 const glsl_type
*param0_type
,
4892 const glsl_type
*param1_type
,
4895 ir_variable
*x
= in_var(param0_type
, "x");
4896 ir_variable
*y
= in_var(param1_type
, "y");
4897 MAKE_SIG(return_type
, avail
, 2, x
, y
);
4900 body
.emit(ret(expr(opcode
, y
, x
)));
4902 body
.emit(ret(expr(opcode
, x
, y
)));
4907 #define BINOP(NAME, OPCODE, AVAIL) \
4908 ir_function_signature * \
4909 builtin_builder::_##NAME(const glsl_type *return_type, \
4910 const glsl_type *param0_type, \
4911 const glsl_type *param1_type) \
4913 return binop(&AVAIL, OPCODE, return_type, param0_type, param1_type); \
4917 * Angle and Trigonometry Functions @{
4920 ir_function_signature
*
4921 builtin_builder::_radians(const glsl_type
*type
)
4923 ir_variable
*degrees
= in_var(type
, "degrees");
4924 MAKE_SIG(type
, always_available
, 1, degrees
);
4925 body
.emit(ret(mul(degrees
, imm(0.0174532925f
))));
4929 ir_function_signature
*
4930 builtin_builder::_degrees(const glsl_type
*type
)
4932 ir_variable
*radians
= in_var(type
, "radians");
4933 MAKE_SIG(type
, always_available
, 1, radians
);
4934 body
.emit(ret(mul(radians
, imm(57.29578f
))));
4938 UNOP(sin
, ir_unop_sin
, always_available
)
4939 UNOP(cos
, ir_unop_cos
, always_available
)
4941 ir_function_signature
*
4942 builtin_builder::_tan(const glsl_type
*type
)
4944 ir_variable
*theta
= in_var(type
, "theta");
4945 MAKE_SIG(type
, always_available
, 1, theta
);
4946 body
.emit(ret(div(sin(theta
), cos(theta
))));
4951 builtin_builder::asin_expr(ir_variable
*x
, float p0
, float p1
)
4955 mul(sqrt(sub(imm(1.0f
), abs(x
))),
4958 add(imm(M_PI_4f
- 1.0f
),
4961 mul(abs(x
), imm(p1
))))))))));
4965 * Generate a ir_call to a function with a set of parameters
4967 * The input \c params can either be a list of \c ir_variable or a list of
4968 * \c ir_dereference_variable. In the latter case, all nodes will be removed
4969 * from \c params and used directly as the parameters to the generated
4973 builtin_builder::call(ir_function
*f
, ir_variable
*ret
, exec_list params
)
4975 exec_list actual_params
;
4977 foreach_in_list_safe(ir_instruction
, ir
, ¶ms
) {
4978 ir_dereference_variable
*d
= ir
->as_dereference_variable();
4981 actual_params
.push_tail(d
);
4983 ir_variable
*var
= ir
->as_variable();
4984 assert(var
!= NULL
);
4985 actual_params
.push_tail(var_ref(var
));
4989 ir_function_signature
*sig
=
4990 f
->exact_matching_signature(NULL
, &actual_params
);
4994 ir_dereference_variable
*deref
=
4995 (sig
->return_type
->is_void() ? NULL
: var_ref(ret
));
4997 return new(mem_ctx
) ir_call(sig
, deref
, &actual_params
);
5000 ir_function_signature
*
5001 builtin_builder::_asin(const glsl_type
*type
)
5003 ir_variable
*x
= in_var(type
, "x");
5004 MAKE_SIG(type
, always_available
, 1, x
);
5006 body
.emit(ret(asin_expr(x
, 0.086566724f
, -0.03102955f
)));
5011 ir_function_signature
*
5012 builtin_builder::_acos(const glsl_type
*type
)
5014 ir_variable
*x
= in_var(type
, "x");
5015 MAKE_SIG(type
, always_available
, 1, x
);
5017 body
.emit(ret(sub(imm(M_PI_2f
), asin_expr(x
, 0.08132463f
, -0.02363318f
))));
5022 ir_function_signature
*
5023 builtin_builder::_atan2(const glsl_type
*type
)
5025 const unsigned n
= type
->vector_elements
;
5026 ir_variable
*y
= in_var(type
, "y");
5027 ir_variable
*x
= in_var(type
, "x");
5028 MAKE_SIG(type
, is_not_nir
, 2, y
, x
);
5030 /* If we're on the left half-plane rotate the coordinates π/2 clock-wise
5031 * for the y=0 discontinuity to end up aligned with the vertical
5032 * discontinuity of atan(s/t) along t=0. This also makes sure that we
5033 * don't attempt to divide by zero along the vertical line, which may give
5034 * unspecified results on non-GLSL 4.1-capable hardware.
5036 ir_variable
*flip
= body
.make_temp(glsl_type::bvec(n
), "flip");
5037 body
.emit(assign(flip
, gequal(imm(0.0f
, n
), x
)));
5038 ir_variable
*s
= body
.make_temp(type
, "s");
5039 body
.emit(assign(s
, csel(flip
, abs(x
), y
)));
5040 ir_variable
*t
= body
.make_temp(type
, "t");
5041 body
.emit(assign(t
, csel(flip
, y
, abs(x
))));
5043 /* If the magnitude of the denominator exceeds some huge value, scale down
5044 * the arguments in order to prevent the reciprocal operation from flushing
5045 * its result to zero, which would cause precision problems, and for s
5046 * infinite would cause us to return a NaN instead of the correct finite
5049 * If fmin and fmax are respectively the smallest and largest positive
5050 * normalized floating point values representable by the implementation,
5051 * the constants below should be in agreement with:
5054 * scale <= 1 / fmin / fmax (for |t| >= huge)
5056 * In addition scale should be a negative power of two in order to avoid
5057 * loss of precision. The values chosen below should work for most usual
5058 * floating point representations with at least the dynamic range of ATI's
5059 * 24-bit representation.
5061 ir_constant
*huge
= imm(1e18f
, n
);
5062 ir_variable
*scale
= body
.make_temp(type
, "scale");
5063 body
.emit(assign(scale
, csel(gequal(abs(t
), huge
),
5064 imm(0.25f
, n
), imm(1.0f
, n
))));
5065 ir_variable
*rcp_scaled_t
= body
.make_temp(type
, "rcp_scaled_t");
5066 body
.emit(assign(rcp_scaled_t
, rcp(mul(t
, scale
))));
5067 ir_expression
*s_over_t
= mul(mul(s
, scale
), rcp_scaled_t
);
5069 /* For |x| = |y| assume tan = 1 even if infinite (i.e. pretend momentarily
5070 * that ∞/∞ = 1) in order to comply with the rather artificial rules
5071 * inherited from IEEE 754-2008, namely:
5073 * "atan2(±∞, −∞) is ±3π/4
5074 * atan2(±∞, +∞) is ±π/4"
5076 * Note that this is inconsistent with the rules for the neighborhood of
5077 * zero that are based on iterated limits:
5079 * "atan2(±0, −0) is ±π
5080 * atan2(±0, +0) is ±0"
5082 * but GLSL specifically allows implementations to deviate from IEEE rules
5083 * at (0,0), so we take that license (i.e. pretend that 0/0 = 1 here as
5086 ir_expression
*tan
= csel(equal(abs(x
), abs(y
)),
5087 imm(1.0f
, n
), abs(s_over_t
));
5089 /* Calculate the arctangent and fix up the result if we had flipped the
5090 * coordinate system.
5092 ir_variable
*arc
= body
.make_temp(type
, "arc");
5093 do_atan(body
, type
, arc
, tan
);
5094 body
.emit(assign(arc
, add(arc
, mul(b2f(flip
), imm(M_PI_2f
)))));
5096 /* Rather convoluted calculation of the sign of the result. When x < 0 we
5097 * cannot use fsign because we need to be able to distinguish between
5098 * negative and positive zero. Unfortunately we cannot use bitwise
5099 * arithmetic tricks either because of back-ends without integer support.
5100 * When x >= 0 rcp_scaled_t will always be non-negative so this won't be
5101 * able to distinguish between negative and positive zero, but we don't
5102 * care because atan2 is continuous along the whole positive y = 0
5103 * half-line, so it won't affect the result significantly.
5105 body
.emit(ret(csel(less(min2(y
, rcp_scaled_t
), imm(0.0f
, n
)),
5112 builtin_builder::do_atan(ir_factory
&body
, const glsl_type
*type
, ir_variable
*res
, operand y_over_x
)
5115 * range-reduction, first step:
5117 * / y_over_x if |y_over_x| <= 1.0;
5119 * \ 1.0 / y_over_x otherwise
5121 ir_variable
*x
= body
.make_temp(type
, "atan_x");
5122 body
.emit(assign(x
, div(min2(abs(y_over_x
),
5128 * approximate atan by evaluating polynomial:
5130 * x * 0.9999793128310355 - x^3 * 0.3326756418091246 +
5131 * x^5 * 0.1938924977115610 - x^7 * 0.1173503194786851 +
5132 * x^9 * 0.0536813784310406 - x^11 * 0.0121323213173444
5134 ir_variable
*tmp
= body
.make_temp(type
, "atan_tmp");
5135 body
.emit(assign(tmp
, mul(x
, x
)));
5136 body
.emit(assign(tmp
, mul(add(mul(sub(mul(add(mul(sub(mul(add(mul(imm(-0.0121323213173444f
),
5138 imm(0.0536813784310406f
)),
5140 imm(0.1173503194786851f
)),
5142 imm(0.1938924977115610f
)),
5144 imm(0.3326756418091246f
)),
5146 imm(0.9999793128310355f
)),
5149 /* range-reduction fixup */
5150 body
.emit(assign(tmp
, add(tmp
,
5151 mul(b2f(greater(abs(y_over_x
),
5152 imm(1.0f
, type
->components()))),
5158 body
.emit(assign(res
, mul(tmp
, sign(y_over_x
))));
5161 ir_function_signature
*
5162 builtin_builder::_atan(const glsl_type
*type
)
5164 ir_variable
*y_over_x
= in_var(type
, "y_over_x");
5165 MAKE_SIG(type
, is_not_nir
, 1, y_over_x
);
5167 ir_variable
*tmp
= body
.make_temp(type
, "tmp");
5168 do_atan(body
, type
, tmp
, y_over_x
);
5169 body
.emit(ret(tmp
));
5174 ir_function_signature
*
5175 builtin_builder::_sinh(const glsl_type
*type
)
5177 ir_variable
*x
= in_var(type
, "x");
5178 MAKE_SIG(type
, v130
, 1, x
);
5180 /* 0.5 * (e^x - e^(-x)) */
5181 body
.emit(ret(mul(imm(0.5f
), sub(exp(x
), exp(neg(x
))))));
5186 ir_function_signature
*
5187 builtin_builder::_cosh(const glsl_type
*type
)
5189 ir_variable
*x
= in_var(type
, "x");
5190 MAKE_SIG(type
, v130
, 1, x
);
5192 /* 0.5 * (e^x + e^(-x)) */
5193 body
.emit(ret(mul(imm(0.5f
), add(exp(x
), exp(neg(x
))))));
5198 ir_function_signature
*
5199 builtin_builder::_tanh(const glsl_type
*type
)
5201 ir_variable
*x
= in_var(type
, "x");
5202 MAKE_SIG(type
, v130
, 1, x
);
5204 /* Clamp x to [-10, +10] to avoid precision problems.
5205 * When x > 10, e^(-x) is so small relative to e^x that it gets flushed to
5206 * zero in the computation e^x + e^(-x). The same happens in the other
5207 * direction when x < -10.
5209 ir_variable
*t
= body
.make_temp(type
, "tmp");
5210 body
.emit(assign(t
, min2(max2(x
, imm(-10.0f
)), imm(10.0f
))));
5212 /* (e^x - e^(-x)) / (e^x + e^(-x)) */
5213 body
.emit(ret(div(sub(exp(t
), exp(neg(t
))),
5214 add(exp(t
), exp(neg(t
))))));
5219 ir_function_signature
*
5220 builtin_builder::_asinh(const glsl_type
*type
)
5222 ir_variable
*x
= in_var(type
, "x");
5223 MAKE_SIG(type
, v130
, 1, x
);
5225 body
.emit(ret(mul(sign(x
), log(add(abs(x
), sqrt(add(mul(x
, x
),
5230 ir_function_signature
*
5231 builtin_builder::_acosh(const glsl_type
*type
)
5233 ir_variable
*x
= in_var(type
, "x");
5234 MAKE_SIG(type
, v130
, 1, x
);
5236 body
.emit(ret(log(add(x
, sqrt(sub(mul(x
, x
), imm(1.0f
)))))));
5240 ir_function_signature
*
5241 builtin_builder::_atanh(const glsl_type
*type
)
5243 ir_variable
*x
= in_var(type
, "x");
5244 MAKE_SIG(type
, v130
, 1, x
);
5246 body
.emit(ret(mul(imm(0.5f
), log(div(add(imm(1.0f
), x
),
5247 sub(imm(1.0f
), x
))))));
5253 * Exponential Functions @{
5256 ir_function_signature
*
5257 builtin_builder::_pow(const glsl_type
*type
)
5259 return binop(always_available
, ir_binop_pow
, type
, type
, type
);
5262 UNOP(exp
, ir_unop_exp
, always_available
)
5263 UNOP(log
, ir_unop_log
, always_available
)
5264 UNOP(exp2
, ir_unop_exp2
, always_available
)
5265 UNOP(log2
, ir_unop_log2
, always_available
)
5266 UNOP(atan_op
, ir_unop_atan
, is_nir
)
5267 UNOPA(sqrt
, ir_unop_sqrt
)
5268 UNOPA(inversesqrt
, ir_unop_rsq
)
5272 UNOPA(abs
, ir_unop_abs
)
5273 UNOPA(sign
, ir_unop_sign
)
5274 UNOPA(floor
, ir_unop_floor
)
5275 UNOPA(truncate
, ir_unop_trunc
)
5276 UNOPA(trunc
, ir_unop_trunc
)
5277 UNOPA(round
, ir_unop_round_even
)
5278 UNOPA(roundEven
, ir_unop_round_even
)
5279 UNOPA(ceil
, ir_unop_ceil
)
5280 UNOPA(fract
, ir_unop_fract
)
5282 ir_function_signature
*
5283 builtin_builder::_mod(builtin_available_predicate avail
,
5284 const glsl_type
*x_type
, const glsl_type
*y_type
)
5286 return binop(avail
, ir_binop_mod
, x_type
, x_type
, y_type
);
5289 ir_function_signature
*
5290 builtin_builder::_modf(builtin_available_predicate avail
, const glsl_type
*type
)
5292 ir_variable
*x
= in_var(type
, "x");
5293 ir_variable
*i
= out_var(type
, "i");
5294 MAKE_SIG(type
, avail
, 2, x
, i
);
5296 ir_variable
*t
= body
.make_temp(type
, "t");
5297 body
.emit(assign(t
, expr(ir_unop_trunc
, x
)));
5298 body
.emit(assign(i
, t
));
5299 body
.emit(ret(sub(x
, t
)));
5304 ir_function_signature
*
5305 builtin_builder::_min(builtin_available_predicate avail
,
5306 const glsl_type
*x_type
, const glsl_type
*y_type
)
5308 return binop(avail
, ir_binop_min
, x_type
, x_type
, y_type
);
5311 ir_function_signature
*
5312 builtin_builder::_max(builtin_available_predicate avail
,
5313 const glsl_type
*x_type
, const glsl_type
*y_type
)
5315 return binop(avail
, ir_binop_max
, x_type
, x_type
, y_type
);
5318 ir_function_signature
*
5319 builtin_builder::_clamp(builtin_available_predicate avail
,
5320 const glsl_type
*val_type
, const glsl_type
*bound_type
)
5322 ir_variable
*x
= in_var(val_type
, "x");
5323 ir_variable
*minVal
= in_var(bound_type
, "minVal");
5324 ir_variable
*maxVal
= in_var(bound_type
, "maxVal");
5325 MAKE_SIG(val_type
, avail
, 3, x
, minVal
, maxVal
);
5327 body
.emit(ret(clamp(x
, minVal
, maxVal
)));
5332 ir_function_signature
*
5333 builtin_builder::_mix_lrp(builtin_available_predicate avail
, const glsl_type
*val_type
, const glsl_type
*blend_type
)
5335 ir_variable
*x
= in_var(val_type
, "x");
5336 ir_variable
*y
= in_var(val_type
, "y");
5337 ir_variable
*a
= in_var(blend_type
, "a");
5338 MAKE_SIG(val_type
, avail
, 3, x
, y
, a
);
5340 body
.emit(ret(lrp(x
, y
, a
)));
5345 ir_function_signature
*
5346 builtin_builder::_mix_sel(builtin_available_predicate avail
,
5347 const glsl_type
*val_type
,
5348 const glsl_type
*blend_type
)
5350 ir_variable
*x
= in_var(val_type
, "x");
5351 ir_variable
*y
= in_var(val_type
, "y");
5352 ir_variable
*a
= in_var(blend_type
, "a");
5353 MAKE_SIG(val_type
, avail
, 3, x
, y
, a
);
5355 /* csel matches the ternary operator in that a selector of true choses the
5356 * first argument. This differs from mix(x, y, false) which choses the
5357 * second argument (to remain consistent with the interpolating version of
5358 * mix() which takes a blend factor from 0.0 to 1.0 where 0.0 is only x.
5360 * To handle the behavior mismatch, reverse the x and y arguments.
5362 body
.emit(ret(csel(a
, y
, x
)));
5367 ir_function_signature
*
5368 builtin_builder::_step(builtin_available_predicate avail
, const glsl_type
*edge_type
, const glsl_type
*x_type
)
5370 ir_variable
*edge
= in_var(edge_type
, "edge");
5371 ir_variable
*x
= in_var(x_type
, "x");
5372 MAKE_SIG(x_type
, avail
, 2, edge
, x
);
5374 ir_variable
*t
= body
.make_temp(x_type
, "t");
5375 if (x_type
->vector_elements
== 1) {
5376 /* Both are floats */
5377 if (edge_type
->is_double())
5378 body
.emit(assign(t
, f2d(b2f(gequal(x
, edge
)))));
5380 body
.emit(assign(t
, b2f(gequal(x
, edge
))));
5381 } else if (edge_type
->vector_elements
== 1) {
5382 /* x is a vector but edge is a float */
5383 for (int i
= 0; i
< x_type
->vector_elements
; i
++) {
5384 if (edge_type
->is_double())
5385 body
.emit(assign(t
, f2d(b2f(gequal(swizzle(x
, i
, 1), edge
))), 1 << i
));
5387 body
.emit(assign(t
, b2f(gequal(swizzle(x
, i
, 1), edge
)), 1 << i
));
5390 /* Both are vectors */
5391 for (int i
= 0; i
< x_type
->vector_elements
; i
++) {
5392 if (edge_type
->is_double())
5393 body
.emit(assign(t
, f2d(b2f(gequal(swizzle(x
, i
, 1), swizzle(edge
, i
, 1)))),
5396 body
.emit(assign(t
, b2f(gequal(swizzle(x
, i
, 1), swizzle(edge
, i
, 1))),
5406 ir_function_signature
*
5407 builtin_builder::_smoothstep(builtin_available_predicate avail
, const glsl_type
*edge_type
, const glsl_type
*x_type
)
5409 ir_variable
*edge0
= in_var(edge_type
, "edge0");
5410 ir_variable
*edge1
= in_var(edge_type
, "edge1");
5411 ir_variable
*x
= in_var(x_type
, "x");
5412 MAKE_SIG(x_type
, avail
, 3, edge0
, edge1
, x
);
5414 /* From the GLSL 1.10 specification:
5417 * t = clamp((x - edge0) / (edge1 - edge0), 0, 1);
5418 * return t * t * (3 - 2 * t);
5421 ir_variable
*t
= body
.make_temp(x_type
, "t");
5422 body
.emit(assign(t
, clamp(div(sub(x
, edge0
), sub(edge1
, edge0
)),
5423 IMM_FP(x_type
, 0.0), IMM_FP(x_type
, 1.0))));
5425 body
.emit(ret(mul(t
, mul(t
, sub(IMM_FP(x_type
, 3.0), mul(IMM_FP(x_type
, 2.0), t
))))));
5430 ir_function_signature
*
5431 builtin_builder::_isnan(builtin_available_predicate avail
, const glsl_type
*type
)
5433 ir_variable
*x
= in_var(type
, "x");
5434 MAKE_SIG(glsl_type::bvec(type
->vector_elements
), avail
, 1, x
);
5436 body
.emit(ret(nequal(x
, x
)));
5441 ir_function_signature
*
5442 builtin_builder::_isinf(builtin_available_predicate avail
, const glsl_type
*type
)
5444 ir_variable
*x
= in_var(type
, "x");
5445 MAKE_SIG(glsl_type::bvec(type
->vector_elements
), avail
, 1, x
);
5447 ir_constant_data infinities
;
5448 for (int i
= 0; i
< type
->vector_elements
; i
++) {
5449 switch (type
->base_type
) {
5450 case GLSL_TYPE_FLOAT
:
5451 infinities
.f
[i
] = INFINITY
;
5453 case GLSL_TYPE_DOUBLE
:
5454 infinities
.d
[i
] = INFINITY
;
5457 unreachable("unknown type");
5461 body
.emit(ret(equal(abs(x
), imm(type
, infinities
))));
5466 ir_function_signature
*
5467 builtin_builder::_atan2_op(const glsl_type
*x_type
)
5469 return binop(is_nir
, ir_binop_atan2
, x_type
, x_type
, x_type
);
5472 ir_function_signature
*
5473 builtin_builder::_floatBitsToInt(const glsl_type
*type
)
5475 ir_variable
*x
= in_var(type
, "x");
5476 MAKE_SIG(glsl_type::ivec(type
->vector_elements
), shader_bit_encoding
, 1, x
);
5477 body
.emit(ret(bitcast_f2i(x
)));
5481 ir_function_signature
*
5482 builtin_builder::_floatBitsToUint(const glsl_type
*type
)
5484 ir_variable
*x
= in_var(type
, "x");
5485 MAKE_SIG(glsl_type::uvec(type
->vector_elements
), shader_bit_encoding
, 1, x
);
5486 body
.emit(ret(bitcast_f2u(x
)));
5490 ir_function_signature
*
5491 builtin_builder::_intBitsToFloat(const glsl_type
*type
)
5493 ir_variable
*x
= in_var(type
, "x");
5494 MAKE_SIG(glsl_type::vec(type
->vector_elements
), shader_bit_encoding
, 1, x
);
5495 body
.emit(ret(bitcast_i2f(x
)));
5499 ir_function_signature
*
5500 builtin_builder::_uintBitsToFloat(const glsl_type
*type
)
5502 ir_variable
*x
= in_var(type
, "x");
5503 MAKE_SIG(glsl_type::vec(type
->vector_elements
), shader_bit_encoding
, 1, x
);
5504 body
.emit(ret(bitcast_u2f(x
)));
5508 ir_function_signature
*
5509 builtin_builder::_doubleBitsToInt64(builtin_available_predicate avail
, const glsl_type
*type
)
5511 ir_variable
*x
= in_var(type
, "x");
5512 MAKE_SIG(glsl_type::i64vec(type
->vector_elements
), avail
, 1, x
);
5513 body
.emit(ret(bitcast_d2i64(x
)));
5517 ir_function_signature
*
5518 builtin_builder::_doubleBitsToUint64(builtin_available_predicate avail
, const glsl_type
*type
)
5520 ir_variable
*x
= in_var(type
, "x");
5521 MAKE_SIG(glsl_type::u64vec(type
->vector_elements
), avail
, 1, x
);
5522 body
.emit(ret(bitcast_d2u64(x
)));
5526 ir_function_signature
*
5527 builtin_builder::_int64BitsToDouble(builtin_available_predicate avail
, const glsl_type
*type
)
5529 ir_variable
*x
= in_var(type
, "x");
5530 MAKE_SIG(glsl_type::dvec(type
->vector_elements
), avail
, 1, x
);
5531 body
.emit(ret(bitcast_i642d(x
)));
5535 ir_function_signature
*
5536 builtin_builder::_uint64BitsToDouble(builtin_available_predicate avail
, const glsl_type
*type
)
5538 ir_variable
*x
= in_var(type
, "x");
5539 MAKE_SIG(glsl_type::dvec(type
->vector_elements
), avail
, 1, x
);
5540 body
.emit(ret(bitcast_u642d(x
)));
5544 ir_function_signature
*
5545 builtin_builder::_packUnorm2x16(builtin_available_predicate avail
)
5547 ir_variable
*v
= in_var(glsl_type::vec2_type
, "v");
5548 MAKE_SIG(glsl_type::uint_type
, avail
, 1, v
);
5549 body
.emit(ret(expr(ir_unop_pack_unorm_2x16
, v
)));
5553 ir_function_signature
*
5554 builtin_builder::_packSnorm2x16(builtin_available_predicate avail
)
5556 ir_variable
*v
= in_var(glsl_type::vec2_type
, "v");
5557 MAKE_SIG(glsl_type::uint_type
, avail
, 1, v
);
5558 body
.emit(ret(expr(ir_unop_pack_snorm_2x16
, v
)));
5562 ir_function_signature
*
5563 builtin_builder::_packUnorm4x8(builtin_available_predicate avail
)
5565 ir_variable
*v
= in_var(glsl_type::vec4_type
, "v");
5566 MAKE_SIG(glsl_type::uint_type
, avail
, 1, v
);
5567 body
.emit(ret(expr(ir_unop_pack_unorm_4x8
, v
)));
5571 ir_function_signature
*
5572 builtin_builder::_packSnorm4x8(builtin_available_predicate avail
)
5574 ir_variable
*v
= in_var(glsl_type::vec4_type
, "v");
5575 MAKE_SIG(glsl_type::uint_type
, avail
, 1, v
);
5576 body
.emit(ret(expr(ir_unop_pack_snorm_4x8
, v
)));
5580 ir_function_signature
*
5581 builtin_builder::_unpackUnorm2x16(builtin_available_predicate avail
)
5583 ir_variable
*p
= in_var(glsl_type::uint_type
, "p");
5584 MAKE_SIG(glsl_type::vec2_type
, avail
, 1, p
);
5585 body
.emit(ret(expr(ir_unop_unpack_unorm_2x16
, p
)));
5589 ir_function_signature
*
5590 builtin_builder::_unpackSnorm2x16(builtin_available_predicate avail
)
5592 ir_variable
*p
= in_var(glsl_type::uint_type
, "p");
5593 MAKE_SIG(glsl_type::vec2_type
, avail
, 1, p
);
5594 body
.emit(ret(expr(ir_unop_unpack_snorm_2x16
, p
)));
5599 ir_function_signature
*
5600 builtin_builder::_unpackUnorm4x8(builtin_available_predicate avail
)
5602 ir_variable
*p
= in_var(glsl_type::uint_type
, "p");
5603 MAKE_SIG(glsl_type::vec4_type
, avail
, 1, p
);
5604 body
.emit(ret(expr(ir_unop_unpack_unorm_4x8
, p
)));
5608 ir_function_signature
*
5609 builtin_builder::_unpackSnorm4x8(builtin_available_predicate avail
)
5611 ir_variable
*p
= in_var(glsl_type::uint_type
, "p");
5612 MAKE_SIG(glsl_type::vec4_type
, avail
, 1, p
);
5613 body
.emit(ret(expr(ir_unop_unpack_snorm_4x8
, p
)));
5617 ir_function_signature
*
5618 builtin_builder::_packHalf2x16(builtin_available_predicate avail
)
5620 ir_variable
*v
= in_var(glsl_type::vec2_type
, "v");
5621 MAKE_SIG(glsl_type::uint_type
, avail
, 1, v
);
5622 body
.emit(ret(expr(ir_unop_pack_half_2x16
, v
)));
5626 ir_function_signature
*
5627 builtin_builder::_unpackHalf2x16(builtin_available_predicate avail
)
5629 ir_variable
*p
= in_var(glsl_type::uint_type
, "p");
5630 MAKE_SIG(glsl_type::vec2_type
, avail
, 1, p
);
5631 body
.emit(ret(expr(ir_unop_unpack_half_2x16
, p
)));
5635 ir_function_signature
*
5636 builtin_builder::_packDouble2x32(builtin_available_predicate avail
)
5638 ir_variable
*v
= in_var(glsl_type::uvec2_type
, "v");
5639 MAKE_SIG(glsl_type::double_type
, avail
, 1, v
);
5640 body
.emit(ret(expr(ir_unop_pack_double_2x32
, v
)));
5644 ir_function_signature
*
5645 builtin_builder::_unpackDouble2x32(builtin_available_predicate avail
)
5647 ir_variable
*p
= in_var(glsl_type::double_type
, "p");
5648 MAKE_SIG(glsl_type::uvec2_type
, avail
, 1, p
);
5649 body
.emit(ret(expr(ir_unop_unpack_double_2x32
, p
)));
5653 ir_function_signature
*
5654 builtin_builder::_packInt2x32(builtin_available_predicate avail
)
5656 ir_variable
*v
= in_var(glsl_type::ivec2_type
, "v");
5657 MAKE_SIG(glsl_type::int64_t_type
, avail
, 1, v
);
5658 body
.emit(ret(expr(ir_unop_pack_int_2x32
, v
)));
5662 ir_function_signature
*
5663 builtin_builder::_unpackInt2x32(builtin_available_predicate avail
)
5665 ir_variable
*p
= in_var(glsl_type::int64_t_type
, "p");
5666 MAKE_SIG(glsl_type::ivec2_type
, avail
, 1, p
);
5667 body
.emit(ret(expr(ir_unop_unpack_int_2x32
, p
)));
5671 ir_function_signature
*
5672 builtin_builder::_packUint2x32(builtin_available_predicate avail
)
5674 ir_variable
*v
= in_var(glsl_type::uvec2_type
, "v");
5675 MAKE_SIG(glsl_type::uint64_t_type
, avail
, 1, v
);
5676 body
.emit(ret(expr(ir_unop_pack_uint_2x32
, v
)));
5680 ir_function_signature
*
5681 builtin_builder::_unpackUint2x32(builtin_available_predicate avail
)
5683 ir_variable
*p
= in_var(glsl_type::uint64_t_type
, "p");
5684 MAKE_SIG(glsl_type::uvec2_type
, avail
, 1, p
);
5685 body
.emit(ret(expr(ir_unop_unpack_uint_2x32
, p
)));
5689 ir_function_signature
*
5690 builtin_builder::_length(builtin_available_predicate avail
, const glsl_type
*type
)
5692 ir_variable
*x
= in_var(type
, "x");
5693 MAKE_SIG(type
->get_base_type(), avail
, 1, x
);
5695 body
.emit(ret(sqrt(dot(x
, x
))));
5700 ir_function_signature
*
5701 builtin_builder::_distance(builtin_available_predicate avail
, const glsl_type
*type
)
5703 ir_variable
*p0
= in_var(type
, "p0");
5704 ir_variable
*p1
= in_var(type
, "p1");
5705 MAKE_SIG(type
->get_base_type(), avail
, 2, p0
, p1
);
5707 if (type
->vector_elements
== 1) {
5708 body
.emit(ret(abs(sub(p0
, p1
))));
5710 ir_variable
*p
= body
.make_temp(type
, "p");
5711 body
.emit(assign(p
, sub(p0
, p1
)));
5712 body
.emit(ret(sqrt(dot(p
, p
))));
5718 ir_function_signature
*
5719 builtin_builder::_dot(builtin_available_predicate avail
, const glsl_type
*type
)
5721 if (type
->vector_elements
== 1)
5722 return binop(avail
, ir_binop_mul
, type
, type
, type
);
5724 return binop(avail
, ir_binop_dot
,
5725 type
->get_base_type(), type
, type
);
5728 ir_function_signature
*
5729 builtin_builder::_cross(builtin_available_predicate avail
, const glsl_type
*type
)
5731 ir_variable
*a
= in_var(type
, "a");
5732 ir_variable
*b
= in_var(type
, "b");
5733 MAKE_SIG(type
, avail
, 2, a
, b
);
5735 int yzx
= MAKE_SWIZZLE4(SWIZZLE_Y
, SWIZZLE_Z
, SWIZZLE_X
, 0);
5736 int zxy
= MAKE_SWIZZLE4(SWIZZLE_Z
, SWIZZLE_X
, SWIZZLE_Y
, 0);
5738 body
.emit(ret(sub(mul(swizzle(a
, yzx
, 3), swizzle(b
, zxy
, 3)),
5739 mul(swizzle(a
, zxy
, 3), swizzle(b
, yzx
, 3)))));
5744 ir_function_signature
*
5745 builtin_builder::_normalize(builtin_available_predicate avail
, const glsl_type
*type
)
5747 ir_variable
*x
= in_var(type
, "x");
5748 MAKE_SIG(type
, avail
, 1, x
);
5750 if (type
->vector_elements
== 1) {
5751 body
.emit(ret(sign(x
)));
5753 body
.emit(ret(mul(x
, rsq(dot(x
, x
)))));
5759 ir_function_signature
*
5760 builtin_builder::_ftransform()
5762 MAKE_SIG(glsl_type::vec4_type
, compatibility_vs_only
, 0);
5764 /* ftransform() refers to global variables, and is always emitted
5765 * directly by ast_function.cpp. Just emit a prototype here so we
5766 * can recognize calls to it.
5771 ir_function_signature
*
5772 builtin_builder::_faceforward(builtin_available_predicate avail
, const glsl_type
*type
)
5774 ir_variable
*N
= in_var(type
, "N");
5775 ir_variable
*I
= in_var(type
, "I");
5776 ir_variable
*Nref
= in_var(type
, "Nref");
5777 MAKE_SIG(type
, avail
, 3, N
, I
, Nref
);
5779 body
.emit(if_tree(less(dot(Nref
, I
), IMM_FP(type
, 0.0)),
5780 ret(N
), ret(neg(N
))));
5785 ir_function_signature
*
5786 builtin_builder::_reflect(builtin_available_predicate avail
, const glsl_type
*type
)
5788 ir_variable
*I
= in_var(type
, "I");
5789 ir_variable
*N
= in_var(type
, "N");
5790 MAKE_SIG(type
, avail
, 2, I
, N
);
5792 /* I - 2 * dot(N, I) * N */
5793 body
.emit(ret(sub(I
, mul(IMM_FP(type
, 2.0), mul(dot(N
, I
), N
)))));
5798 ir_function_signature
*
5799 builtin_builder::_refract(builtin_available_predicate avail
, const glsl_type
*type
)
5801 ir_variable
*I
= in_var(type
, "I");
5802 ir_variable
*N
= in_var(type
, "N");
5803 ir_variable
*eta
= in_var(type
->get_base_type(), "eta");
5804 MAKE_SIG(type
, avail
, 3, I
, N
, eta
);
5806 ir_variable
*n_dot_i
= body
.make_temp(type
->get_base_type(), "n_dot_i");
5807 body
.emit(assign(n_dot_i
, dot(N
, I
)));
5809 /* From the GLSL 1.10 specification:
5810 * k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I))
5812 * return genType(0.0)
5814 * return eta * I - (eta * dot(N, I) + sqrt(k)) * N
5816 ir_variable
*k
= body
.make_temp(type
->get_base_type(), "k");
5817 body
.emit(assign(k
, sub(IMM_FP(type
, 1.0),
5818 mul(eta
, mul(eta
, sub(IMM_FP(type
, 1.0),
5819 mul(n_dot_i
, n_dot_i
)))))));
5820 body
.emit(if_tree(less(k
, IMM_FP(type
, 0.0)),
5821 ret(ir_constant::zero(mem_ctx
, type
)),
5822 ret(sub(mul(eta
, I
),
5823 mul(add(mul(eta
, n_dot_i
), sqrt(k
)), N
)))));
5828 ir_function_signature
*
5829 builtin_builder::_matrixCompMult(builtin_available_predicate avail
, const glsl_type
*type
)
5831 ir_variable
*x
= in_var(type
, "x");
5832 ir_variable
*y
= in_var(type
, "y");
5833 MAKE_SIG(type
, avail
, 2, x
, y
);
5835 ir_variable
*z
= body
.make_temp(type
, "z");
5836 for (int i
= 0; i
< type
->matrix_columns
; i
++) {
5837 body
.emit(assign(array_ref(z
, i
), mul(array_ref(x
, i
), array_ref(y
, i
))));
5844 ir_function_signature
*
5845 builtin_builder::_outerProduct(builtin_available_predicate avail
, const glsl_type
*type
)
5850 if (type
->is_double()) {
5851 r
= in_var(glsl_type::dvec(type
->matrix_columns
), "r");
5852 c
= in_var(glsl_type::dvec(type
->vector_elements
), "c");
5854 r
= in_var(glsl_type::vec(type
->matrix_columns
), "r");
5855 c
= in_var(glsl_type::vec(type
->vector_elements
), "c");
5857 MAKE_SIG(type
, avail
, 2, c
, r
);
5859 ir_variable
*m
= body
.make_temp(type
, "m");
5860 for (int i
= 0; i
< type
->matrix_columns
; i
++) {
5861 body
.emit(assign(array_ref(m
, i
), mul(c
, swizzle(r
, i
, 1))));
5868 ir_function_signature
*
5869 builtin_builder::_transpose(builtin_available_predicate avail
, const glsl_type
*orig_type
)
5871 const glsl_type
*transpose_type
=
5872 glsl_type::get_instance(orig_type
->base_type
,
5873 orig_type
->matrix_columns
,
5874 orig_type
->vector_elements
);
5876 ir_variable
*m
= in_var(orig_type
, "m");
5877 MAKE_SIG(transpose_type
, avail
, 1, m
);
5879 ir_variable
*t
= body
.make_temp(transpose_type
, "t");
5880 for (int i
= 0; i
< orig_type
->matrix_columns
; i
++) {
5881 for (int j
= 0; j
< orig_type
->vector_elements
; j
++) {
5882 body
.emit(assign(array_ref(t
, j
),
5883 matrix_elt(m
, i
, j
),
5892 ir_function_signature
*
5893 builtin_builder::_determinant_mat2(builtin_available_predicate avail
, const glsl_type
*type
)
5895 ir_variable
*m
= in_var(type
, "m");
5896 MAKE_SIG(type
->get_base_type(), avail
, 1, m
);
5898 body
.emit(ret(sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 1, 1)),
5899 mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 0, 1)))));
5904 ir_function_signature
*
5905 builtin_builder::_determinant_mat3(builtin_available_predicate avail
, const glsl_type
*type
)
5907 ir_variable
*m
= in_var(type
, "m");
5908 MAKE_SIG(type
->get_base_type(), avail
, 1, m
);
5911 sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 2, 2)),
5912 mul(matrix_elt(m
, 1, 2), matrix_elt(m
, 2, 1)));
5915 sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 2)),
5916 mul(matrix_elt(m
, 1, 2), matrix_elt(m
, 2, 0)));
5919 sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 1)),
5920 mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 2, 0)));
5922 body
.emit(ret(add(sub(mul(matrix_elt(m
, 0, 0), f1
),
5923 mul(matrix_elt(m
, 0, 1), f2
)),
5924 mul(matrix_elt(m
, 0, 2), f3
))));
5929 ir_function_signature
*
5930 builtin_builder::_determinant_mat4(builtin_available_predicate avail
, const glsl_type
*type
)
5932 ir_variable
*m
= in_var(type
, "m");
5933 const glsl_type
*btype
= type
->get_base_type();
5934 MAKE_SIG(btype
, avail
, 1, m
);
5936 ir_variable
*SubFactor00
= body
.make_temp(btype
, "SubFactor00");
5937 ir_variable
*SubFactor01
= body
.make_temp(btype
, "SubFactor01");
5938 ir_variable
*SubFactor02
= body
.make_temp(btype
, "SubFactor02");
5939 ir_variable
*SubFactor03
= body
.make_temp(btype
, "SubFactor03");
5940 ir_variable
*SubFactor04
= body
.make_temp(btype
, "SubFactor04");
5941 ir_variable
*SubFactor05
= body
.make_temp(btype
, "SubFactor05");
5942 ir_variable
*SubFactor06
= body
.make_temp(btype
, "SubFactor06");
5943 ir_variable
*SubFactor07
= body
.make_temp(btype
, "SubFactor07");
5944 ir_variable
*SubFactor08
= body
.make_temp(btype
, "SubFactor08");
5945 ir_variable
*SubFactor09
= body
.make_temp(btype
, "SubFactor09");
5946 ir_variable
*SubFactor10
= body
.make_temp(btype
, "SubFactor10");
5947 ir_variable
*SubFactor11
= body
.make_temp(btype
, "SubFactor11");
5948 ir_variable
*SubFactor12
= body
.make_temp(btype
, "SubFactor12");
5949 ir_variable
*SubFactor13
= body
.make_temp(btype
, "SubFactor13");
5950 ir_variable
*SubFactor14
= body
.make_temp(btype
, "SubFactor14");
5951 ir_variable
*SubFactor15
= body
.make_temp(btype
, "SubFactor15");
5952 ir_variable
*SubFactor16
= body
.make_temp(btype
, "SubFactor16");
5953 ir_variable
*SubFactor17
= body
.make_temp(btype
, "SubFactor17");
5954 ir_variable
*SubFactor18
= body
.make_temp(btype
, "SubFactor18");
5956 body
.emit(assign(SubFactor00
, sub(mul(matrix_elt(m
, 2, 2), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 2), matrix_elt(m
, 2, 3)))));
5957 body
.emit(assign(SubFactor01
, sub(mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 1), matrix_elt(m
, 2, 3)))));
5958 body
.emit(assign(SubFactor02
, sub(mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 3, 2)), mul(matrix_elt(m
, 3, 1), matrix_elt(m
, 2, 2)))));
5959 body
.emit(assign(SubFactor03
, sub(mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 2, 3)))));
5960 body
.emit(assign(SubFactor04
, sub(mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 3, 2)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 2, 2)))));
5961 body
.emit(assign(SubFactor05
, sub(mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 3, 1)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 2, 1)))));
5962 body
.emit(assign(SubFactor06
, sub(mul(matrix_elt(m
, 1, 2), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 2), matrix_elt(m
, 1, 3)))));
5963 body
.emit(assign(SubFactor07
, sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 1), matrix_elt(m
, 1, 3)))));
5964 body
.emit(assign(SubFactor08
, sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 3, 2)), mul(matrix_elt(m
, 3, 1), matrix_elt(m
, 1, 2)))));
5965 body
.emit(assign(SubFactor09
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 1, 3)))));
5966 body
.emit(assign(SubFactor10
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 3, 2)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 1, 2)))));
5967 body
.emit(assign(SubFactor11
, sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 1), matrix_elt(m
, 1, 3)))));
5968 body
.emit(assign(SubFactor12
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 3, 1)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 1, 1)))));
5969 body
.emit(assign(SubFactor13
, sub(mul(matrix_elt(m
, 1, 2), matrix_elt(m
, 2, 3)), mul(matrix_elt(m
, 2, 2), matrix_elt(m
, 1, 3)))));
5970 body
.emit(assign(SubFactor14
, sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 2, 3)), mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 1, 3)))));
5971 body
.emit(assign(SubFactor15
, sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 2, 2)), mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 1, 2)))));
5972 body
.emit(assign(SubFactor16
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 3)), mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 1, 3)))));
5973 body
.emit(assign(SubFactor17
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 2)), mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 1, 2)))));
5974 body
.emit(assign(SubFactor18
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 1)), mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 1, 1)))));
5976 ir_variable
*adj_0
= body
.make_temp(btype
== glsl_type::float_type
? glsl_type::vec4_type
: glsl_type::dvec4_type
, "adj_0");
5978 body
.emit(assign(adj_0
,
5979 add(sub(mul(matrix_elt(m
, 1, 1), SubFactor00
),
5980 mul(matrix_elt(m
, 1, 2), SubFactor01
)),
5981 mul(matrix_elt(m
, 1, 3), SubFactor02
)),
5983 body
.emit(assign(adj_0
, neg(
5984 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor00
),
5985 mul(matrix_elt(m
, 1, 2), SubFactor03
)),
5986 mul(matrix_elt(m
, 1, 3), SubFactor04
))),
5988 body
.emit(assign(adj_0
,
5989 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor01
),
5990 mul(matrix_elt(m
, 1, 1), SubFactor03
)),
5991 mul(matrix_elt(m
, 1, 3), SubFactor05
)),
5993 body
.emit(assign(adj_0
, neg(
5994 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor02
),
5995 mul(matrix_elt(m
, 1, 1), SubFactor04
)),
5996 mul(matrix_elt(m
, 1, 2), SubFactor05
))),
5999 body
.emit(ret(dot(array_ref(m
, 0), adj_0
)));
6004 ir_function_signature
*
6005 builtin_builder::_inverse_mat2(builtin_available_predicate avail
, const glsl_type
*type
)
6007 ir_variable
*m
= in_var(type
, "m");
6008 MAKE_SIG(type
, avail
, 1, m
);
6010 ir_variable
*adj
= body
.make_temp(type
, "adj");
6011 body
.emit(assign(array_ref(adj
, 0), matrix_elt(m
, 1, 1), 1 << 0));
6012 body
.emit(assign(array_ref(adj
, 0), neg(matrix_elt(m
, 0, 1)), 1 << 1));
6013 body
.emit(assign(array_ref(adj
, 1), neg(matrix_elt(m
, 1, 0)), 1 << 0));
6014 body
.emit(assign(array_ref(adj
, 1), matrix_elt(m
, 0, 0), 1 << 1));
6016 ir_expression
*det
=
6017 sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 1, 1)),
6018 mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 0, 1)));
6020 body
.emit(ret(div(adj
, det
)));
6024 ir_function_signature
*
6025 builtin_builder::_inverse_mat3(builtin_available_predicate avail
, const glsl_type
*type
)
6027 ir_variable
*m
= in_var(type
, "m");
6028 const glsl_type
*btype
= type
->get_base_type();
6029 MAKE_SIG(type
, avail
, 1, m
);
6031 ir_variable
*f11_22_21_12
= body
.make_temp(btype
, "f11_22_21_12");
6032 ir_variable
*f10_22_20_12
= body
.make_temp(btype
, "f10_22_20_12");
6033 ir_variable
*f10_21_20_11
= body
.make_temp(btype
, "f10_21_20_11");
6035 body
.emit(assign(f11_22_21_12
,
6036 sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 2, 2)),
6037 mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 1, 2)))));
6038 body
.emit(assign(f10_22_20_12
,
6039 sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 2)),
6040 mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 1, 2)))));
6041 body
.emit(assign(f10_21_20_11
,
6042 sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 1)),
6043 mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 1, 1)))));
6045 ir_variable
*adj
= body
.make_temp(type
, "adj");
6046 body
.emit(assign(array_ref(adj
, 0), f11_22_21_12
, WRITEMASK_X
));
6047 body
.emit(assign(array_ref(adj
, 1), neg(f10_22_20_12
), WRITEMASK_X
));
6048 body
.emit(assign(array_ref(adj
, 2), f10_21_20_11
, WRITEMASK_X
));
6050 body
.emit(assign(array_ref(adj
, 0), neg(
6051 sub(mul(matrix_elt(m
, 0, 1), matrix_elt(m
, 2, 2)),
6052 mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 0, 2)))),
6054 body
.emit(assign(array_ref(adj
, 1),
6055 sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 2, 2)),
6056 mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 0, 2))),
6058 body
.emit(assign(array_ref(adj
, 2), neg(
6059 sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 2, 1)),
6060 mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 0, 1)))),
6063 body
.emit(assign(array_ref(adj
, 0),
6064 sub(mul(matrix_elt(m
, 0, 1), matrix_elt(m
, 1, 2)),
6065 mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 0, 2))),
6067 body
.emit(assign(array_ref(adj
, 1), neg(
6068 sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 1, 2)),
6069 mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 0, 2)))),
6071 body
.emit(assign(array_ref(adj
, 2),
6072 sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 1, 1)),
6073 mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 0, 1))),
6076 ir_expression
*det
=
6077 add(sub(mul(matrix_elt(m
, 0, 0), f11_22_21_12
),
6078 mul(matrix_elt(m
, 0, 1), f10_22_20_12
)),
6079 mul(matrix_elt(m
, 0, 2), f10_21_20_11
));
6081 body
.emit(ret(div(adj
, det
)));
6086 ir_function_signature
*
6087 builtin_builder::_inverse_mat4(builtin_available_predicate avail
, const glsl_type
*type
)
6089 ir_variable
*m
= in_var(type
, "m");
6090 const glsl_type
*btype
= type
->get_base_type();
6091 MAKE_SIG(type
, avail
, 1, m
);
6093 ir_variable
*SubFactor00
= body
.make_temp(btype
, "SubFactor00");
6094 ir_variable
*SubFactor01
= body
.make_temp(btype
, "SubFactor01");
6095 ir_variable
*SubFactor02
= body
.make_temp(btype
, "SubFactor02");
6096 ir_variable
*SubFactor03
= body
.make_temp(btype
, "SubFactor03");
6097 ir_variable
*SubFactor04
= body
.make_temp(btype
, "SubFactor04");
6098 ir_variable
*SubFactor05
= body
.make_temp(btype
, "SubFactor05");
6099 ir_variable
*SubFactor06
= body
.make_temp(btype
, "SubFactor06");
6100 ir_variable
*SubFactor07
= body
.make_temp(btype
, "SubFactor07");
6101 ir_variable
*SubFactor08
= body
.make_temp(btype
, "SubFactor08");
6102 ir_variable
*SubFactor09
= body
.make_temp(btype
, "SubFactor09");
6103 ir_variable
*SubFactor10
= body
.make_temp(btype
, "SubFactor10");
6104 ir_variable
*SubFactor11
= body
.make_temp(btype
, "SubFactor11");
6105 ir_variable
*SubFactor12
= body
.make_temp(btype
, "SubFactor12");
6106 ir_variable
*SubFactor13
= body
.make_temp(btype
, "SubFactor13");
6107 ir_variable
*SubFactor14
= body
.make_temp(btype
, "SubFactor14");
6108 ir_variable
*SubFactor15
= body
.make_temp(btype
, "SubFactor15");
6109 ir_variable
*SubFactor16
= body
.make_temp(btype
, "SubFactor16");
6110 ir_variable
*SubFactor17
= body
.make_temp(btype
, "SubFactor17");
6111 ir_variable
*SubFactor18
= body
.make_temp(btype
, "SubFactor18");
6113 body
.emit(assign(SubFactor00
, sub(mul(matrix_elt(m
, 2, 2), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 2), matrix_elt(m
, 2, 3)))));
6114 body
.emit(assign(SubFactor01
, sub(mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 1), matrix_elt(m
, 2, 3)))));
6115 body
.emit(assign(SubFactor02
, sub(mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 3, 2)), mul(matrix_elt(m
, 3, 1), matrix_elt(m
, 2, 2)))));
6116 body
.emit(assign(SubFactor03
, sub(mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 2, 3)))));
6117 body
.emit(assign(SubFactor04
, sub(mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 3, 2)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 2, 2)))));
6118 body
.emit(assign(SubFactor05
, sub(mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 3, 1)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 2, 1)))));
6119 body
.emit(assign(SubFactor06
, sub(mul(matrix_elt(m
, 1, 2), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 2), matrix_elt(m
, 1, 3)))));
6120 body
.emit(assign(SubFactor07
, sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 1), matrix_elt(m
, 1, 3)))));
6121 body
.emit(assign(SubFactor08
, sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 3, 2)), mul(matrix_elt(m
, 3, 1), matrix_elt(m
, 1, 2)))));
6122 body
.emit(assign(SubFactor09
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 1, 3)))));
6123 body
.emit(assign(SubFactor10
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 3, 2)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 1, 2)))));
6124 body
.emit(assign(SubFactor11
, sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 3, 3)), mul(matrix_elt(m
, 3, 1), matrix_elt(m
, 1, 3)))));
6125 body
.emit(assign(SubFactor12
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 3, 1)), mul(matrix_elt(m
, 3, 0), matrix_elt(m
, 1, 1)))));
6126 body
.emit(assign(SubFactor13
, sub(mul(matrix_elt(m
, 1, 2), matrix_elt(m
, 2, 3)), mul(matrix_elt(m
, 2, 2), matrix_elt(m
, 1, 3)))));
6127 body
.emit(assign(SubFactor14
, sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 2, 3)), mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 1, 3)))));
6128 body
.emit(assign(SubFactor15
, sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 2, 2)), mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 1, 2)))));
6129 body
.emit(assign(SubFactor16
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 3)), mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 1, 3)))));
6130 body
.emit(assign(SubFactor17
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 2)), mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 1, 2)))));
6131 body
.emit(assign(SubFactor18
, sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 1)), mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 1, 1)))));
6133 ir_variable
*adj
= body
.make_temp(btype
== glsl_type::float_type
? glsl_type::mat4_type
: glsl_type::dmat4_type
, "adj");
6134 body
.emit(assign(array_ref(adj
, 0),
6135 add(sub(mul(matrix_elt(m
, 1, 1), SubFactor00
),
6136 mul(matrix_elt(m
, 1, 2), SubFactor01
)),
6137 mul(matrix_elt(m
, 1, 3), SubFactor02
)),
6139 body
.emit(assign(array_ref(adj
, 1), neg(
6140 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor00
),
6141 mul(matrix_elt(m
, 1, 2), SubFactor03
)),
6142 mul(matrix_elt(m
, 1, 3), SubFactor04
))),
6144 body
.emit(assign(array_ref(adj
, 2),
6145 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor01
),
6146 mul(matrix_elt(m
, 1, 1), SubFactor03
)),
6147 mul(matrix_elt(m
, 1, 3), SubFactor05
)),
6149 body
.emit(assign(array_ref(adj
, 3), neg(
6150 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor02
),
6151 mul(matrix_elt(m
, 1, 1), SubFactor04
)),
6152 mul(matrix_elt(m
, 1, 2), SubFactor05
))),
6155 body
.emit(assign(array_ref(adj
, 0), neg(
6156 add(sub(mul(matrix_elt(m
, 0, 1), SubFactor00
),
6157 mul(matrix_elt(m
, 0, 2), SubFactor01
)),
6158 mul(matrix_elt(m
, 0, 3), SubFactor02
))),
6160 body
.emit(assign(array_ref(adj
, 1),
6161 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor00
),
6162 mul(matrix_elt(m
, 0, 2), SubFactor03
)),
6163 mul(matrix_elt(m
, 0, 3), SubFactor04
)),
6165 body
.emit(assign(array_ref(adj
, 2), neg(
6166 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor01
),
6167 mul(matrix_elt(m
, 0, 1), SubFactor03
)),
6168 mul(matrix_elt(m
, 0, 3), SubFactor05
))),
6170 body
.emit(assign(array_ref(adj
, 3),
6171 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor02
),
6172 mul(matrix_elt(m
, 0, 1), SubFactor04
)),
6173 mul(matrix_elt(m
, 0, 2), SubFactor05
)),
6176 body
.emit(assign(array_ref(adj
, 0),
6177 add(sub(mul(matrix_elt(m
, 0, 1), SubFactor06
),
6178 mul(matrix_elt(m
, 0, 2), SubFactor07
)),
6179 mul(matrix_elt(m
, 0, 3), SubFactor08
)),
6181 body
.emit(assign(array_ref(adj
, 1), neg(
6182 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor06
),
6183 mul(matrix_elt(m
, 0, 2), SubFactor09
)),
6184 mul(matrix_elt(m
, 0, 3), SubFactor10
))),
6186 body
.emit(assign(array_ref(adj
, 2),
6187 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor11
),
6188 mul(matrix_elt(m
, 0, 1), SubFactor09
)),
6189 mul(matrix_elt(m
, 0, 3), SubFactor12
)),
6191 body
.emit(assign(array_ref(adj
, 3), neg(
6192 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor08
),
6193 mul(matrix_elt(m
, 0, 1), SubFactor10
)),
6194 mul(matrix_elt(m
, 0, 2), SubFactor12
))),
6197 body
.emit(assign(array_ref(adj
, 0), neg(
6198 add(sub(mul(matrix_elt(m
, 0, 1), SubFactor13
),
6199 mul(matrix_elt(m
, 0, 2), SubFactor14
)),
6200 mul(matrix_elt(m
, 0, 3), SubFactor15
))),
6202 body
.emit(assign(array_ref(adj
, 1),
6203 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor13
),
6204 mul(matrix_elt(m
, 0, 2), SubFactor16
)),
6205 mul(matrix_elt(m
, 0, 3), SubFactor17
)),
6207 body
.emit(assign(array_ref(adj
, 2), neg(
6208 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor14
),
6209 mul(matrix_elt(m
, 0, 1), SubFactor16
)),
6210 mul(matrix_elt(m
, 0, 3), SubFactor18
))),
6212 body
.emit(assign(array_ref(adj
, 3),
6213 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor15
),
6214 mul(matrix_elt(m
, 0, 1), SubFactor17
)),
6215 mul(matrix_elt(m
, 0, 2), SubFactor18
)),
6218 ir_expression
*det
=
6219 add(mul(matrix_elt(m
, 0, 0), matrix_elt(adj
, 0, 0)),
6220 add(mul(matrix_elt(m
, 0, 1), matrix_elt(adj
, 1, 0)),
6221 add(mul(matrix_elt(m
, 0, 2), matrix_elt(adj
, 2, 0)),
6222 mul(matrix_elt(m
, 0, 3), matrix_elt(adj
, 3, 0)))));
6224 body
.emit(ret(div(adj
, det
)));
6230 ir_function_signature
*
6231 builtin_builder::_lessThan(builtin_available_predicate avail
,
6232 const glsl_type
*type
)
6234 return binop(avail
, ir_binop_less
,
6235 glsl_type::bvec(type
->vector_elements
), type
, type
);
6238 ir_function_signature
*
6239 builtin_builder::_lessThanEqual(builtin_available_predicate avail
,
6240 const glsl_type
*type
)
6242 return binop(avail
, ir_binop_gequal
,
6243 glsl_type::bvec(type
->vector_elements
), type
, type
,
6247 ir_function_signature
*
6248 builtin_builder::_greaterThan(builtin_available_predicate avail
,
6249 const glsl_type
*type
)
6251 return binop(avail
, ir_binop_less
,
6252 glsl_type::bvec(type
->vector_elements
), type
, type
,
6256 ir_function_signature
*
6257 builtin_builder::_greaterThanEqual(builtin_available_predicate avail
,
6258 const glsl_type
*type
)
6260 return binop(avail
, ir_binop_gequal
,
6261 glsl_type::bvec(type
->vector_elements
), type
, type
);
6264 ir_function_signature
*
6265 builtin_builder::_equal(builtin_available_predicate avail
,
6266 const glsl_type
*type
)
6268 return binop(avail
, ir_binop_equal
,
6269 glsl_type::bvec(type
->vector_elements
), type
, type
);
6272 ir_function_signature
*
6273 builtin_builder::_notEqual(builtin_available_predicate avail
,
6274 const glsl_type
*type
)
6276 return binop(avail
, ir_binop_nequal
,
6277 glsl_type::bvec(type
->vector_elements
), type
, type
);
6280 ir_function_signature
*
6281 builtin_builder::_any(const glsl_type
*type
)
6283 ir_variable
*v
= in_var(type
, "v");
6284 MAKE_SIG(glsl_type::bool_type
, always_available
, 1, v
);
6286 const unsigned vec_elem
= v
->type
->vector_elements
;
6287 body
.emit(ret(expr(ir_binop_any_nequal
, v
, imm(false, vec_elem
))));
6292 ir_function_signature
*
6293 builtin_builder::_all(const glsl_type
*type
)
6295 ir_variable
*v
= in_var(type
, "v");
6296 MAKE_SIG(glsl_type::bool_type
, always_available
, 1, v
);
6298 const unsigned vec_elem
= v
->type
->vector_elements
;
6299 body
.emit(ret(expr(ir_binop_all_equal
, v
, imm(true, vec_elem
))));
6304 UNOP(not, ir_unop_logic_not
, always_available
)
6307 has_lod(const glsl_type
*sampler_type
)
6309 assert(sampler_type
->is_sampler());
6311 switch (sampler_type
->sampler_dimensionality
) {
6312 case GLSL_SAMPLER_DIM_RECT
:
6313 case GLSL_SAMPLER_DIM_BUF
:
6314 case GLSL_SAMPLER_DIM_MS
:
6321 ir_function_signature
*
6322 builtin_builder::_textureSize(builtin_available_predicate avail
,
6323 const glsl_type
*return_type
,
6324 const glsl_type
*sampler_type
)
6326 ir_variable
*s
= in_var(sampler_type
, "sampler");
6327 /* The sampler always exists; add optional lod later. */
6328 MAKE_SIG(return_type
, avail
, 1, s
);
6330 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_txs
);
6331 tex
->set_sampler(new(mem_ctx
) ir_dereference_variable(s
), return_type
);
6333 if (has_lod(sampler_type
)) {
6334 ir_variable
*lod
= in_var(glsl_type::int_type
, "lod");
6335 sig
->parameters
.push_tail(lod
);
6336 tex
->lod_info
.lod
= var_ref(lod
);
6338 tex
->lod_info
.lod
= imm(0u);
6341 body
.emit(ret(tex
));
6346 ir_function_signature
*
6347 builtin_builder::_textureSamples(builtin_available_predicate avail
,
6348 const glsl_type
*sampler_type
)
6350 ir_variable
*s
= in_var(sampler_type
, "sampler");
6351 MAKE_SIG(glsl_type::int_type
, avail
, 1, s
);
6353 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_texture_samples
);
6354 tex
->set_sampler(new(mem_ctx
) ir_dereference_variable(s
), glsl_type::int_type
);
6355 body
.emit(ret(tex
));
6360 ir_function_signature
*
6361 builtin_builder::_texture(ir_texture_opcode opcode
,
6362 builtin_available_predicate avail
,
6363 const glsl_type
*return_type
,
6364 const glsl_type
*sampler_type
,
6365 const glsl_type
*coord_type
,
6368 ir_variable
*s
= in_var(sampler_type
, "sampler");
6369 ir_variable
*P
= in_var(coord_type
, "P");
6370 /* The sampler and coordinate always exist; add optional parameters later. */
6371 MAKE_SIG(return_type
, avail
, 2, s
, P
);
6373 ir_texture
*tex
= new(mem_ctx
) ir_texture(opcode
);
6374 tex
->set_sampler(var_ref(s
), return_type
);
6376 const int coord_size
= sampler_type
->coordinate_components();
6378 if (coord_size
== coord_type
->vector_elements
) {
6379 tex
->coordinate
= var_ref(P
);
6381 /* The incoming coordinate also has the projector or shadow comparator,
6382 * so we need to swizzle those away.
6384 tex
->coordinate
= swizzle_for_size(P
, coord_size
);
6387 /* The projector is always in the last component. */
6388 if (flags
& TEX_PROJECT
)
6389 tex
->projector
= swizzle(P
, coord_type
->vector_elements
- 1, 1);
6391 if (sampler_type
->sampler_shadow
) {
6392 if (opcode
== ir_tg4
) {
6393 /* gather has refz as a separate parameter, immediately after the
6396 ir_variable
*refz
= in_var(glsl_type::float_type
, "refz");
6397 sig
->parameters
.push_tail(refz
);
6398 tex
->shadow_comparator
= var_ref(refz
);
6400 /* The shadow comparator is normally in the Z component, but a few types
6401 * have sufficiently large coordinates that it's in W.
6403 tex
->shadow_comparator
= swizzle(P
, MAX2(coord_size
, SWIZZLE_Z
), 1);
6407 if (opcode
== ir_txl
) {
6408 ir_variable
*lod
= in_var(glsl_type::float_type
, "lod");
6409 sig
->parameters
.push_tail(lod
);
6410 tex
->lod_info
.lod
= var_ref(lod
);
6411 } else if (opcode
== ir_txd
) {
6412 int grad_size
= coord_size
- (sampler_type
->sampler_array
? 1 : 0);
6413 ir_variable
*dPdx
= in_var(glsl_type::vec(grad_size
), "dPdx");
6414 ir_variable
*dPdy
= in_var(glsl_type::vec(grad_size
), "dPdy");
6415 sig
->parameters
.push_tail(dPdx
);
6416 sig
->parameters
.push_tail(dPdy
);
6417 tex
->lod_info
.grad
.dPdx
= var_ref(dPdx
);
6418 tex
->lod_info
.grad
.dPdy
= var_ref(dPdy
);
6421 if (flags
& (TEX_OFFSET
| TEX_OFFSET_NONCONST
)) {
6422 int offset_size
= coord_size
- (sampler_type
->sampler_array
? 1 : 0);
6423 ir_variable
*offset
=
6424 new(mem_ctx
) ir_variable(glsl_type::ivec(offset_size
), "offset",
6425 (flags
& TEX_OFFSET
) ? ir_var_const_in
: ir_var_function_in
);
6426 sig
->parameters
.push_tail(offset
);
6427 tex
->offset
= var_ref(offset
);
6430 if (flags
& TEX_OFFSET_ARRAY
) {
6431 ir_variable
*offsets
=
6432 new(mem_ctx
) ir_variable(glsl_type::get_array_instance(glsl_type::ivec2_type
, 4),
6433 "offsets", ir_var_const_in
);
6434 sig
->parameters
.push_tail(offsets
);
6435 tex
->offset
= var_ref(offsets
);
6438 if (opcode
== ir_tg4
) {
6439 if (flags
& TEX_COMPONENT
) {
6440 ir_variable
*component
=
6441 new(mem_ctx
) ir_variable(glsl_type::int_type
, "comp", ir_var_const_in
);
6442 sig
->parameters
.push_tail(component
);
6443 tex
->lod_info
.component
= var_ref(component
);
6446 tex
->lod_info
.component
= imm(0);
6450 /* The "bias" parameter comes /after/ the "offset" parameter, which is
6451 * inconsistent with both textureLodOffset and textureGradOffset.
6453 if (opcode
== ir_txb
) {
6454 ir_variable
*bias
= in_var(glsl_type::float_type
, "bias");
6455 sig
->parameters
.push_tail(bias
);
6456 tex
->lod_info
.bias
= var_ref(bias
);
6459 body
.emit(ret(tex
));
6464 ir_function_signature
*
6465 builtin_builder::_textureCubeArrayShadow(ir_texture_opcode opcode
,
6466 builtin_available_predicate avail
,
6467 const glsl_type
*sampler_type
)
6469 ir_variable
*s
= in_var(sampler_type
, "sampler");
6470 ir_variable
*P
= in_var(glsl_type::vec4_type
, "P");
6471 ir_variable
*compare
= in_var(glsl_type::float_type
, "compare");
6472 MAKE_SIG(glsl_type::float_type
, avail
, 3, s
, P
, compare
);
6474 ir_texture
*tex
= new(mem_ctx
) ir_texture(opcode
);
6475 tex
->set_sampler(var_ref(s
), glsl_type::float_type
);
6477 tex
->coordinate
= var_ref(P
);
6478 tex
->shadow_comparator
= var_ref(compare
);
6480 if (opcode
== ir_txb
) {
6481 ir_variable
*bias
= in_var(glsl_type::float_type
, "bias");
6482 sig
->parameters
.push_tail(bias
);
6483 tex
->lod_info
.bias
= var_ref(bias
);
6486 if (opcode
== ir_txl
) {
6487 ir_variable
*lod
= in_var(glsl_type::float_type
, "lod");
6488 sig
->parameters
.push_tail(lod
);
6489 tex
->lod_info
.lod
= var_ref(lod
);
6492 body
.emit(ret(tex
));
6497 ir_function_signature
*
6498 builtin_builder::_texelFetch(builtin_available_predicate avail
,
6499 const glsl_type
*return_type
,
6500 const glsl_type
*sampler_type
,
6501 const glsl_type
*coord_type
,
6502 const glsl_type
*offset_type
)
6504 ir_variable
*s
= in_var(sampler_type
, "sampler");
6505 ir_variable
*P
= in_var(coord_type
, "P");
6506 /* The sampler and coordinate always exist; add optional parameters later. */
6507 MAKE_SIG(return_type
, avail
, 2, s
, P
);
6509 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_txf
);
6510 tex
->coordinate
= var_ref(P
);
6511 tex
->set_sampler(var_ref(s
), return_type
);
6513 if (sampler_type
->sampler_dimensionality
== GLSL_SAMPLER_DIM_MS
) {
6514 ir_variable
*sample
= in_var(glsl_type::int_type
, "sample");
6515 sig
->parameters
.push_tail(sample
);
6516 tex
->lod_info
.sample_index
= var_ref(sample
);
6517 tex
->op
= ir_txf_ms
;
6518 } else if (has_lod(sampler_type
)) {
6519 ir_variable
*lod
= in_var(glsl_type::int_type
, "lod");
6520 sig
->parameters
.push_tail(lod
);
6521 tex
->lod_info
.lod
= var_ref(lod
);
6523 tex
->lod_info
.lod
= imm(0u);
6526 if (offset_type
!= NULL
) {
6527 ir_variable
*offset
=
6528 new(mem_ctx
) ir_variable(offset_type
, "offset", ir_var_const_in
);
6529 sig
->parameters
.push_tail(offset
);
6530 tex
->offset
= var_ref(offset
);
6533 body
.emit(ret(tex
));
6538 ir_function_signature
*
6539 builtin_builder::_EmitVertex()
6541 MAKE_SIG(glsl_type::void_type
, gs_only
, 0);
6543 ir_rvalue
*stream
= new(mem_ctx
) ir_constant(0, 1);
6544 body
.emit(new(mem_ctx
) ir_emit_vertex(stream
));
6549 ir_function_signature
*
6550 builtin_builder::_EmitStreamVertex(builtin_available_predicate avail
,
6551 const glsl_type
*stream_type
)
6553 /* Section 8.12 (Geometry Shader Functions) of the GLSL 4.0 spec says:
6555 * "Emit the current values of output variables to the current output
6556 * primitive on stream stream. The argument to stream must be a constant
6557 * integral expression."
6559 ir_variable
*stream
=
6560 new(mem_ctx
) ir_variable(stream_type
, "stream", ir_var_const_in
);
6562 MAKE_SIG(glsl_type::void_type
, avail
, 1, stream
);
6564 body
.emit(new(mem_ctx
) ir_emit_vertex(var_ref(stream
)));
6569 ir_function_signature
*
6570 builtin_builder::_EndPrimitive()
6572 MAKE_SIG(glsl_type::void_type
, gs_only
, 0);
6574 ir_rvalue
*stream
= new(mem_ctx
) ir_constant(0, 1);
6575 body
.emit(new(mem_ctx
) ir_end_primitive(stream
));
6580 ir_function_signature
*
6581 builtin_builder::_EndStreamPrimitive(builtin_available_predicate avail
,
6582 const glsl_type
*stream_type
)
6584 /* Section 8.12 (Geometry Shader Functions) of the GLSL 4.0 spec says:
6586 * "Completes the current output primitive on stream stream and starts
6587 * a new one. The argument to stream must be a constant integral
6590 ir_variable
*stream
=
6591 new(mem_ctx
) ir_variable(stream_type
, "stream", ir_var_const_in
);
6593 MAKE_SIG(glsl_type::void_type
, avail
, 1, stream
);
6595 body
.emit(new(mem_ctx
) ir_end_primitive(var_ref(stream
)));
6600 ir_function_signature
*
6601 builtin_builder::_barrier()
6603 MAKE_SIG(glsl_type::void_type
, barrier_supported
, 0);
6605 body
.emit(new(mem_ctx
) ir_barrier());
6609 ir_function_signature
*
6610 builtin_builder::_textureQueryLod(builtin_available_predicate avail
,
6611 const glsl_type
*sampler_type
,
6612 const glsl_type
*coord_type
)
6614 ir_variable
*s
= in_var(sampler_type
, "sampler");
6615 ir_variable
*coord
= in_var(coord_type
, "coord");
6616 /* The sampler and coordinate always exist; add optional parameters later. */
6617 MAKE_SIG(glsl_type::vec2_type
, avail
, 2, s
, coord
);
6619 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_lod
);
6620 tex
->coordinate
= var_ref(coord
);
6621 tex
->set_sampler(var_ref(s
), glsl_type::vec2_type
);
6623 body
.emit(ret(tex
));
6628 ir_function_signature
*
6629 builtin_builder::_textureQueryLevels(builtin_available_predicate avail
,
6630 const glsl_type
*sampler_type
)
6632 ir_variable
*s
= in_var(sampler_type
, "sampler");
6633 const glsl_type
*return_type
= glsl_type::int_type
;
6634 MAKE_SIG(return_type
, avail
, 1, s
);
6636 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_query_levels
);
6637 tex
->set_sampler(var_ref(s
), return_type
);
6639 body
.emit(ret(tex
));
6644 ir_function_signature
*
6645 builtin_builder::_textureSamplesIdentical(builtin_available_predicate avail
,
6646 const glsl_type
*sampler_type
,
6647 const glsl_type
*coord_type
)
6649 ir_variable
*s
= in_var(sampler_type
, "sampler");
6650 ir_variable
*P
= in_var(coord_type
, "P");
6651 const glsl_type
*return_type
= glsl_type::bool_type
;
6652 MAKE_SIG(return_type
, avail
, 2, s
, P
);
6654 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_samples_identical
);
6655 tex
->coordinate
= var_ref(P
);
6656 tex
->set_sampler(var_ref(s
), return_type
);
6658 body
.emit(ret(tex
));
6663 UNOP(dFdx
, ir_unop_dFdx
, derivatives
)
6664 UNOP(dFdxCoarse
, ir_unop_dFdx_coarse
, derivative_control
)
6665 UNOP(dFdxFine
, ir_unop_dFdx_fine
, derivative_control
)
6666 UNOP(dFdy
, ir_unop_dFdy
, derivatives
)
6667 UNOP(dFdyCoarse
, ir_unop_dFdy_coarse
, derivative_control
)
6668 UNOP(dFdyFine
, ir_unop_dFdy_fine
, derivative_control
)
6670 ir_function_signature
*
6671 builtin_builder::_fwidth(const glsl_type
*type
)
6673 ir_variable
*p
= in_var(type
, "p");
6674 MAKE_SIG(type
, derivatives
, 1, p
);
6676 body
.emit(ret(add(abs(expr(ir_unop_dFdx
, p
)), abs(expr(ir_unop_dFdy
, p
)))));
6681 ir_function_signature
*
6682 builtin_builder::_fwidthCoarse(const glsl_type
*type
)
6684 ir_variable
*p
= in_var(type
, "p");
6685 MAKE_SIG(type
, derivative_control
, 1, p
);
6687 body
.emit(ret(add(abs(expr(ir_unop_dFdx_coarse
, p
)),
6688 abs(expr(ir_unop_dFdy_coarse
, p
)))));
6693 ir_function_signature
*
6694 builtin_builder::_fwidthFine(const glsl_type
*type
)
6696 ir_variable
*p
= in_var(type
, "p");
6697 MAKE_SIG(type
, derivative_control
, 1, p
);
6699 body
.emit(ret(add(abs(expr(ir_unop_dFdx_fine
, p
)),
6700 abs(expr(ir_unop_dFdy_fine
, p
)))));
6705 ir_function_signature
*
6706 builtin_builder::_noise1(const glsl_type
*type
)
6708 /* From the GLSL 4.60 specification:
6710 * "The noise functions noise1, noise2, noise3, and noise4 have been
6711 * deprecated starting with version 4.4 of GLSL. When not generating
6712 * SPIR-V they are defined to return the value 0.0 or a vector whose
6713 * components are all 0.0. When generating SPIR-V the noise functions
6714 * are not declared and may not be used."
6716 * In earlier versions of the GLSL specification attempt to define some
6717 * sort of statistical noise function. However, the function's
6718 * characteristics have always been such that always returning 0 is
6719 * valid and Mesa has always returned 0 for noise on most drivers.
6721 ir_variable
*p
= in_var(type
, "p");
6722 MAKE_SIG(glsl_type::float_type
, v110
, 1, p
);
6723 body
.emit(ret(imm(glsl_type::float_type
, ir_constant_data())));
6727 ir_function_signature
*
6728 builtin_builder::_noise2(const glsl_type
*type
)
6730 /* See builtin_builder::_noise1 */
6731 ir_variable
*p
= in_var(type
, "p");
6732 MAKE_SIG(glsl_type::vec2_type
, v110
, 1, p
);
6733 body
.emit(ret(imm(glsl_type::vec2_type
, ir_constant_data())));
6737 ir_function_signature
*
6738 builtin_builder::_noise3(const glsl_type
*type
)
6740 /* See builtin_builder::_noise1 */
6741 ir_variable
*p
= in_var(type
, "p");
6742 MAKE_SIG(glsl_type::vec3_type
, v110
, 1, p
);
6743 body
.emit(ret(imm(glsl_type::vec3_type
, ir_constant_data())));
6747 ir_function_signature
*
6748 builtin_builder::_noise4(const glsl_type
*type
)
6750 /* See builtin_builder::_noise1 */
6751 ir_variable
*p
= in_var(type
, "p");
6752 MAKE_SIG(glsl_type::vec4_type
, v110
, 1, p
);
6753 body
.emit(ret(imm(glsl_type::vec4_type
, ir_constant_data())));
6757 ir_function_signature
*
6758 builtin_builder::_bitfieldExtract(const glsl_type
*type
)
6760 bool is_uint
= type
->base_type
== GLSL_TYPE_UINT
;
6761 ir_variable
*value
= in_var(type
, "value");
6762 ir_variable
*offset
= in_var(glsl_type::int_type
, "offset");
6763 ir_variable
*bits
= in_var(glsl_type::int_type
, "bits");
6764 MAKE_SIG(type
, gpu_shader5_or_es31_or_integer_functions
, 3, value
, offset
,
6767 operand cast_offset
= is_uint
? i2u(offset
) : operand(offset
);
6768 operand cast_bits
= is_uint
? i2u(bits
) : operand(bits
);
6770 body
.emit(ret(expr(ir_triop_bitfield_extract
, value
,
6771 swizzle(cast_offset
, SWIZZLE_XXXX
, type
->vector_elements
),
6772 swizzle(cast_bits
, SWIZZLE_XXXX
, type
->vector_elements
))));
6777 ir_function_signature
*
6778 builtin_builder::_bitfieldInsert(const glsl_type
*type
)
6780 bool is_uint
= type
->base_type
== GLSL_TYPE_UINT
;
6781 ir_variable
*base
= in_var(type
, "base");
6782 ir_variable
*insert
= in_var(type
, "insert");
6783 ir_variable
*offset
= in_var(glsl_type::int_type
, "offset");
6784 ir_variable
*bits
= in_var(glsl_type::int_type
, "bits");
6785 MAKE_SIG(type
, gpu_shader5_or_es31_or_integer_functions
, 4, base
, insert
,
6788 operand cast_offset
= is_uint
? i2u(offset
) : operand(offset
);
6789 operand cast_bits
= is_uint
? i2u(bits
) : operand(bits
);
6791 body
.emit(ret(bitfield_insert(base
, insert
,
6792 swizzle(cast_offset
, SWIZZLE_XXXX
, type
->vector_elements
),
6793 swizzle(cast_bits
, SWIZZLE_XXXX
, type
->vector_elements
))));
6798 UNOP(bitfieldReverse
, ir_unop_bitfield_reverse
, gpu_shader5_or_es31_or_integer_functions
)
6800 ir_function_signature
*
6801 builtin_builder::_bitCount(const glsl_type
*type
)
6803 return unop(gpu_shader5_or_es31_or_integer_functions
, ir_unop_bit_count
,
6804 glsl_type::ivec(type
->vector_elements
), type
);
6807 ir_function_signature
*
6808 builtin_builder::_findLSB(const glsl_type
*type
)
6810 return unop(gpu_shader5_or_es31_or_integer_functions
, ir_unop_find_lsb
,
6811 glsl_type::ivec(type
->vector_elements
), type
);
6814 ir_function_signature
*
6815 builtin_builder::_findMSB(const glsl_type
*type
)
6817 return unop(gpu_shader5_or_es31_or_integer_functions
, ir_unop_find_msb
,
6818 glsl_type::ivec(type
->vector_elements
), type
);
6821 ir_function_signature
*
6822 builtin_builder::_countLeadingZeros(builtin_available_predicate avail
,
6823 const glsl_type
*type
)
6825 return unop(avail
, ir_unop_clz
,
6826 glsl_type::uvec(type
->vector_elements
), type
);
6829 ir_function_signature
*
6830 builtin_builder::_countTrailingZeros(builtin_available_predicate avail
,
6831 const glsl_type
*type
)
6833 ir_variable
*a
= in_var(type
, "a");
6834 MAKE_SIG(glsl_type::uvec(type
->vector_elements
), avail
, 1, a
);
6836 body
.emit(ret(ir_builder::min2(
6837 ir_builder::i2u(ir_builder::expr(ir_unop_find_lsb
, a
)),
6843 ir_function_signature
*
6844 builtin_builder::_fma(builtin_available_predicate avail
, const glsl_type
*type
)
6846 ir_variable
*a
= in_var(type
, "a");
6847 ir_variable
*b
= in_var(type
, "b");
6848 ir_variable
*c
= in_var(type
, "c");
6849 MAKE_SIG(type
, avail
, 3, a
, b
, c
);
6851 body
.emit(ret(ir_builder::fma(a
, b
, c
)));
6856 ir_function_signature
*
6857 builtin_builder::_ldexp(const glsl_type
*x_type
, const glsl_type
*exp_type
)
6859 return binop(x_type
->is_double() ? fp64
: gpu_shader5_or_es31_or_integer_functions
,
6860 ir_binop_ldexp
, x_type
, x_type
, exp_type
);
6863 ir_function_signature
*
6864 builtin_builder::_dfrexp(const glsl_type
*x_type
, const glsl_type
*exp_type
)
6866 ir_variable
*x
= in_var(x_type
, "x");
6867 ir_variable
*exponent
= out_var(exp_type
, "exp");
6868 MAKE_SIG(x_type
, fp64
, 2, x
, exponent
);
6870 body
.emit(assign(exponent
, expr(ir_unop_frexp_exp
, x
)));
6872 body
.emit(ret(expr(ir_unop_frexp_sig
, x
)));
6876 ir_function_signature
*
6877 builtin_builder::_frexp(const glsl_type
*x_type
, const glsl_type
*exp_type
)
6879 ir_variable
*x
= in_var(x_type
, "x");
6880 ir_variable
*exponent
= out_var(exp_type
, "exp");
6881 MAKE_SIG(x_type
, gpu_shader5_or_es31_or_integer_functions
, 2, x
, exponent
);
6883 const unsigned vec_elem
= x_type
->vector_elements
;
6884 const glsl_type
*bvec
= glsl_type::get_instance(GLSL_TYPE_BOOL
, vec_elem
, 1);
6885 const glsl_type
*uvec
= glsl_type::get_instance(GLSL_TYPE_UINT
, vec_elem
, 1);
6887 /* Single-precision floating-point values are stored as
6892 * An exponent shift of 23 will shift the mantissa out, leaving only the
6893 * exponent and sign bit (which itself may be zero, if the absolute value
6894 * was taken before the bitcast and shift.
6896 ir_constant
*exponent_shift
= imm(23);
6897 ir_constant
*exponent_bias
= imm(-126, vec_elem
);
6899 ir_constant
*sign_mantissa_mask
= imm(0x807fffffu
, vec_elem
);
6901 /* Exponent of floating-point values in the range [0.5, 1.0). */
6902 ir_constant
*exponent_value
= imm(0x3f000000u
, vec_elem
);
6904 ir_variable
*is_not_zero
= body
.make_temp(bvec
, "is_not_zero");
6905 body
.emit(assign(is_not_zero
, nequal(abs(x
), imm(0.0f
, vec_elem
))));
6907 /* Since abs(x) ensures that the sign bit is zero, we don't need to bitcast
6908 * to unsigned integers to ensure that 1 bits aren't shifted in.
6910 body
.emit(assign(exponent
, rshift(bitcast_f2i(abs(x
)), exponent_shift
)));
6911 body
.emit(assign(exponent
, add(exponent
, csel(is_not_zero
, exponent_bias
,
6912 imm(0, vec_elem
)))));
6914 ir_variable
*bits
= body
.make_temp(uvec
, "bits");
6915 body
.emit(assign(bits
, bitcast_f2u(x
)));
6916 body
.emit(assign(bits
, bit_and(bits
, sign_mantissa_mask
)));
6917 body
.emit(assign(bits
, bit_or(bits
, csel(is_not_zero
, exponent_value
,
6918 imm(0u, vec_elem
)))));
6919 body
.emit(ret(bitcast_u2f(bits
)));
6924 ir_function_signature
*
6925 builtin_builder::_uaddCarry(const glsl_type
*type
)
6927 ir_variable
*x
= in_var(type
, "x");
6928 ir_variable
*y
= in_var(type
, "y");
6929 ir_variable
*carry
= out_var(type
, "carry");
6930 MAKE_SIG(type
, gpu_shader5_or_es31_or_integer_functions
, 3, x
, y
, carry
);
6932 body
.emit(assign(carry
, ir_builder::carry(x
, y
)));
6933 body
.emit(ret(add(x
, y
)));
6938 ir_function_signature
*
6939 builtin_builder::_addSaturate(builtin_available_predicate avail
,
6940 const glsl_type
*type
)
6942 return binop(avail
, ir_binop_add_sat
, type
, type
, type
);
6945 ir_function_signature
*
6946 builtin_builder::_usubBorrow(const glsl_type
*type
)
6948 ir_variable
*x
= in_var(type
, "x");
6949 ir_variable
*y
= in_var(type
, "y");
6950 ir_variable
*borrow
= out_var(type
, "borrow");
6951 MAKE_SIG(type
, gpu_shader5_or_es31_or_integer_functions
, 3, x
, y
, borrow
);
6953 body
.emit(assign(borrow
, ir_builder::borrow(x
, y
)));
6954 body
.emit(ret(sub(x
, y
)));
6959 ir_function_signature
*
6960 builtin_builder::_subtractSaturate(builtin_available_predicate avail
,
6961 const glsl_type
*type
)
6963 return binop(avail
, ir_binop_sub_sat
, type
, type
, type
);
6966 ir_function_signature
*
6967 builtin_builder::_absoluteDifference(builtin_available_predicate avail
,
6968 const glsl_type
*type
)
6970 /* absoluteDifference returns an unsigned type that has the same number of
6971 * bits and number of vector elements as the type of the operands.
6973 return binop(avail
, ir_binop_abs_sub
,
6974 glsl_type::get_instance(glsl_unsigned_base_type_of(type
->base_type
),
6975 type
->vector_elements
, 1),
6979 ir_function_signature
*
6980 builtin_builder::_average(builtin_available_predicate avail
,
6981 const glsl_type
*type
)
6983 return binop(avail
, ir_binop_avg
, type
, type
, type
);
6986 ir_function_signature
*
6987 builtin_builder::_averageRounded(builtin_available_predicate avail
,
6988 const glsl_type
*type
)
6990 return binop(avail
, ir_binop_avg_round
, type
, type
, type
);
6994 * For both imulExtended() and umulExtended() built-ins.
6996 ir_function_signature
*
6997 builtin_builder::_mulExtended(const glsl_type
*type
)
6999 const glsl_type
*mul_type
, *unpack_type
;
7000 ir_expression_operation unpack_op
;
7002 if (type
->base_type
== GLSL_TYPE_INT
) {
7003 unpack_op
= ir_unop_unpack_int_2x32
;
7004 mul_type
= glsl_type::get_instance(GLSL_TYPE_INT64
, type
->vector_elements
, 1);
7005 unpack_type
= glsl_type::ivec2_type
;
7007 unpack_op
= ir_unop_unpack_uint_2x32
;
7008 mul_type
= glsl_type::get_instance(GLSL_TYPE_UINT64
, type
->vector_elements
, 1);
7009 unpack_type
= glsl_type::uvec2_type
;
7012 ir_variable
*x
= in_var(type
, "x");
7013 ir_variable
*y
= in_var(type
, "y");
7014 ir_variable
*msb
= out_var(type
, "msb");
7015 ir_variable
*lsb
= out_var(type
, "lsb");
7016 MAKE_SIG(glsl_type::void_type
, gpu_shader5_or_es31_or_integer_functions
, 4, x
, y
, msb
, lsb
);
7018 ir_variable
*unpack_val
= body
.make_temp(unpack_type
, "_unpack_val");
7020 ir_expression
*mul_res
= new(mem_ctx
) ir_expression(ir_binop_mul
, mul_type
,
7021 new(mem_ctx
)ir_dereference_variable(x
),
7022 new(mem_ctx
)ir_dereference_variable(y
));
7024 if (type
->vector_elements
== 1) {
7025 body
.emit(assign(unpack_val
, expr(unpack_op
, mul_res
)));
7026 body
.emit(assign(msb
, swizzle_y(unpack_val
)));
7027 body
.emit(assign(lsb
, swizzle_x(unpack_val
)));
7029 for (int i
= 0; i
< type
->vector_elements
; i
++) {
7030 body
.emit(assign(unpack_val
, expr(unpack_op
, swizzle(mul_res
, i
, 1))));
7031 body
.emit(assign(array_ref(msb
, i
), swizzle_y(unpack_val
)));
7032 body
.emit(assign(array_ref(lsb
, i
), swizzle_x(unpack_val
)));
7039 ir_function_signature
*
7040 builtin_builder::_multiply32x16(builtin_available_predicate avail
,
7041 const glsl_type
*type
)
7043 return binop(avail
, ir_binop_mul_32x16
, type
, type
, type
);
7046 ir_function_signature
*
7047 builtin_builder::_interpolateAtCentroid(const glsl_type
*type
)
7049 ir_variable
*interpolant
= in_var(type
, "interpolant");
7050 interpolant
->data
.must_be_shader_input
= 1;
7051 MAKE_SIG(type
, fs_interpolate_at
, 1, interpolant
);
7053 body
.emit(ret(interpolate_at_centroid(interpolant
)));
7058 ir_function_signature
*
7059 builtin_builder::_interpolateAtOffset(const glsl_type
*type
)
7061 ir_variable
*interpolant
= in_var(type
, "interpolant");
7062 interpolant
->data
.must_be_shader_input
= 1;
7063 ir_variable
*offset
= in_var(glsl_type::vec2_type
, "offset");
7064 MAKE_SIG(type
, fs_interpolate_at
, 2, interpolant
, offset
);
7066 body
.emit(ret(interpolate_at_offset(interpolant
, offset
)));
7071 ir_function_signature
*
7072 builtin_builder::_interpolateAtSample(const glsl_type
*type
)
7074 ir_variable
*interpolant
= in_var(type
, "interpolant");
7075 interpolant
->data
.must_be_shader_input
= 1;
7076 ir_variable
*sample_num
= in_var(glsl_type::int_type
, "sample_num");
7077 MAKE_SIG(type
, fs_interpolate_at
, 2, interpolant
, sample_num
);
7079 body
.emit(ret(interpolate_at_sample(interpolant
, sample_num
)));
7084 ir_function_signature
*
7085 builtin_builder::_atomic_counter_intrinsic(builtin_available_predicate avail
,
7086 enum ir_intrinsic_id id
)
7088 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "counter");
7089 MAKE_INTRINSIC(glsl_type::uint_type
, id
, avail
, 1, counter
);
7093 ir_function_signature
*
7094 builtin_builder::_atomic_counter_intrinsic1(builtin_available_predicate avail
,
7095 enum ir_intrinsic_id id
)
7097 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "counter");
7098 ir_variable
*data
= in_var(glsl_type::uint_type
, "data");
7099 MAKE_INTRINSIC(glsl_type::uint_type
, id
, avail
, 2, counter
, data
);
7103 ir_function_signature
*
7104 builtin_builder::_atomic_counter_intrinsic2(builtin_available_predicate avail
,
7105 enum ir_intrinsic_id id
)
7107 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "counter");
7108 ir_variable
*compare
= in_var(glsl_type::uint_type
, "compare");
7109 ir_variable
*data
= in_var(glsl_type::uint_type
, "data");
7110 MAKE_INTRINSIC(glsl_type::uint_type
, id
, avail
, 3, counter
, compare
, data
);
7114 ir_function_signature
*
7115 builtin_builder::_atomic_intrinsic2(builtin_available_predicate avail
,
7116 const glsl_type
*type
,
7117 enum ir_intrinsic_id id
)
7119 ir_variable
*atomic
= in_var(type
, "atomic");
7120 ir_variable
*data
= in_var(type
, "data");
7121 MAKE_INTRINSIC(type
, id
, avail
, 2, atomic
, data
);
7125 ir_function_signature
*
7126 builtin_builder::_atomic_intrinsic3(builtin_available_predicate avail
,
7127 const glsl_type
*type
,
7128 enum ir_intrinsic_id id
)
7130 ir_variable
*atomic
= in_var(type
, "atomic");
7131 ir_variable
*data1
= in_var(type
, "data1");
7132 ir_variable
*data2
= in_var(type
, "data2");
7133 MAKE_INTRINSIC(type
, id
, avail
, 3, atomic
, data1
, data2
);
7137 ir_function_signature
*
7138 builtin_builder::_atomic_counter_op(const char *intrinsic
,
7139 builtin_available_predicate avail
)
7141 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "atomic_counter");
7142 MAKE_SIG(glsl_type::uint_type
, avail
, 1, counter
);
7144 ir_variable
*retval
= body
.make_temp(glsl_type::uint_type
, "atomic_retval");
7145 body
.emit(call(shader
->symbols
->get_function(intrinsic
), retval
,
7147 body
.emit(ret(retval
));
7151 ir_function_signature
*
7152 builtin_builder::_atomic_counter_op1(const char *intrinsic
,
7153 builtin_available_predicate avail
)
7155 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "atomic_counter");
7156 ir_variable
*data
= in_var(glsl_type::uint_type
, "data");
7157 MAKE_SIG(glsl_type::uint_type
, avail
, 2, counter
, data
);
7159 ir_variable
*retval
= body
.make_temp(glsl_type::uint_type
, "atomic_retval");
7161 /* Instead of generating an __intrinsic_atomic_sub, generate an
7162 * __intrinsic_atomic_add with the data parameter negated.
7164 if (strcmp("__intrinsic_atomic_sub", intrinsic
) == 0) {
7165 ir_variable
*const neg_data
=
7166 body
.make_temp(glsl_type::uint_type
, "neg_data");
7168 body
.emit(assign(neg_data
, neg(data
)));
7170 exec_list parameters
;
7172 parameters
.push_tail(new(mem_ctx
) ir_dereference_variable(counter
));
7173 parameters
.push_tail(new(mem_ctx
) ir_dereference_variable(neg_data
));
7175 ir_function
*const func
=
7176 shader
->symbols
->get_function("__intrinsic_atomic_add");
7177 ir_instruction
*const c
= call(func
, retval
, parameters
);
7180 assert(parameters
.is_empty());
7184 body
.emit(call(shader
->symbols
->get_function(intrinsic
), retval
,
7188 body
.emit(ret(retval
));
7192 ir_function_signature
*
7193 builtin_builder::_atomic_counter_op2(const char *intrinsic
,
7194 builtin_available_predicate avail
)
7196 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "atomic_counter");
7197 ir_variable
*compare
= in_var(glsl_type::uint_type
, "compare");
7198 ir_variable
*data
= in_var(glsl_type::uint_type
, "data");
7199 MAKE_SIG(glsl_type::uint_type
, avail
, 3, counter
, compare
, data
);
7201 ir_variable
*retval
= body
.make_temp(glsl_type::uint_type
, "atomic_retval");
7202 body
.emit(call(shader
->symbols
->get_function(intrinsic
), retval
,
7204 body
.emit(ret(retval
));
7208 ir_function_signature
*
7209 builtin_builder::_atomic_op2(const char *intrinsic
,
7210 builtin_available_predicate avail
,
7211 const glsl_type
*type
)
7213 ir_variable
*atomic
= in_var(type
, "atomic_var");
7214 ir_variable
*data
= in_var(type
, "atomic_data");
7215 MAKE_SIG(type
, avail
, 2, atomic
, data
);
7217 ir_variable
*retval
= body
.make_temp(type
, "atomic_retval");
7218 body
.emit(call(shader
->symbols
->get_function(intrinsic
), retval
,
7220 body
.emit(ret(retval
));
7224 ir_function_signature
*
7225 builtin_builder::_atomic_op3(const char *intrinsic
,
7226 builtin_available_predicate avail
,
7227 const glsl_type
*type
)
7229 ir_variable
*atomic
= in_var(type
, "atomic_var");
7230 ir_variable
*data1
= in_var(type
, "atomic_data1");
7231 ir_variable
*data2
= in_var(type
, "atomic_data2");
7232 MAKE_SIG(type
, avail
, 3, atomic
, data1
, data2
);
7234 ir_variable
*retval
= body
.make_temp(type
, "atomic_retval");
7235 body
.emit(call(shader
->symbols
->get_function(intrinsic
), retval
,
7237 body
.emit(ret(retval
));
7241 ir_function_signature
*
7242 builtin_builder::_min3(const glsl_type
*type
)
7244 ir_variable
*x
= in_var(type
, "x");
7245 ir_variable
*y
= in_var(type
, "y");
7246 ir_variable
*z
= in_var(type
, "z");
7247 MAKE_SIG(type
, shader_trinary_minmax
, 3, x
, y
, z
);
7249 ir_expression
*min3
= min2(x
, min2(y
,z
));
7250 body
.emit(ret(min3
));
7255 ir_function_signature
*
7256 builtin_builder::_max3(const glsl_type
*type
)
7258 ir_variable
*x
= in_var(type
, "x");
7259 ir_variable
*y
= in_var(type
, "y");
7260 ir_variable
*z
= in_var(type
, "z");
7261 MAKE_SIG(type
, shader_trinary_minmax
, 3, x
, y
, z
);
7263 ir_expression
*max3
= max2(x
, max2(y
,z
));
7264 body
.emit(ret(max3
));
7269 ir_function_signature
*
7270 builtin_builder::_mid3(const glsl_type
*type
)
7272 ir_variable
*x
= in_var(type
, "x");
7273 ir_variable
*y
= in_var(type
, "y");
7274 ir_variable
*z
= in_var(type
, "z");
7275 MAKE_SIG(type
, shader_trinary_minmax
, 3, x
, y
, z
);
7277 ir_expression
*mid3
= max2(min2(x
, y
), max2(min2(x
, z
), min2(y
, z
)));
7278 body
.emit(ret(mid3
));
7283 static builtin_available_predicate
7284 get_image_available_predicate(const glsl_type
*type
, unsigned flags
)
7286 if ((flags
& IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE
) &&
7287 type
->sampled_type
== GLSL_TYPE_FLOAT
)
7288 return shader_image_atomic_exchange_float
;
7290 if ((flags
& IMAGE_FUNCTION_AVAIL_ATOMIC_ADD
) &&
7291 type
->sampled_type
== GLSL_TYPE_FLOAT
)
7292 return shader_image_atomic_add_float
;
7294 else if (flags
& (IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE
|
7295 IMAGE_FUNCTION_AVAIL_ATOMIC_ADD
|
7296 IMAGE_FUNCTION_AVAIL_ATOMIC
))
7297 return shader_image_atomic
;
7299 else if (flags
& IMAGE_FUNCTION_EXT_ONLY
)
7300 return shader_image_load_store_ext
;
7303 return shader_image_load_store
;
7306 ir_function_signature
*
7307 builtin_builder::_image_prototype(const glsl_type
*image_type
,
7308 unsigned num_arguments
,
7311 const glsl_type
*data_type
= glsl_type::get_instance(
7312 image_type
->sampled_type
,
7313 (flags
& IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE
? 4 : 1),
7315 const glsl_type
*ret_type
= (flags
& IMAGE_FUNCTION_RETURNS_VOID
?
7316 glsl_type::void_type
: data_type
);
7318 /* Addressing arguments that are always present. */
7319 ir_variable
*image
= in_var(image_type
, "image");
7320 ir_variable
*coord
= in_var(
7321 glsl_type::ivec(image_type
->coordinate_components()), "coord");
7323 ir_function_signature
*sig
= new_sig(
7324 ret_type
, get_image_available_predicate(image_type
, flags
),
7327 /* Sample index for multisample images. */
7328 if (image_type
->sampler_dimensionality
== GLSL_SAMPLER_DIM_MS
)
7329 sig
->parameters
.push_tail(in_var(glsl_type::int_type
, "sample"));
7331 /* Data arguments. */
7332 for (unsigned i
= 0; i
< num_arguments
; ++i
) {
7333 char *arg_name
= ralloc_asprintf(NULL
, "arg%d", i
);
7334 sig
->parameters
.push_tail(in_var(data_type
, arg_name
));
7335 ralloc_free(arg_name
);
7338 /* Set the maximal set of qualifiers allowed for this image
7339 * built-in. Function calls with arguments having fewer
7340 * qualifiers than present in the prototype are allowed by the
7341 * spec, but not with more, i.e. this will make the compiler
7342 * accept everything that needs to be accepted, and reject cases
7343 * like loads from write-only or stores to read-only images.
7345 image
->data
.memory_read_only
= (flags
& IMAGE_FUNCTION_READ_ONLY
) != 0;
7346 image
->data
.memory_write_only
= (flags
& IMAGE_FUNCTION_WRITE_ONLY
) != 0;
7347 image
->data
.memory_coherent
= true;
7348 image
->data
.memory_volatile
= true;
7349 image
->data
.memory_restrict
= true;
7354 ir_function_signature
*
7355 builtin_builder::_image_size_prototype(const glsl_type
*image_type
,
7356 unsigned /* num_arguments */,
7357 unsigned /* flags */)
7359 const glsl_type
*ret_type
;
7360 unsigned num_components
= image_type
->coordinate_components();
7362 /* From the ARB_shader_image_size extension:
7363 * "Cube images return the dimensions of one face."
7365 if (image_type
->sampler_dimensionality
== GLSL_SAMPLER_DIM_CUBE
&&
7366 !image_type
->sampler_array
) {
7370 /* FIXME: Add the highp precision qualifier for GLES 3.10 when it is
7371 * supported by mesa.
7373 ret_type
= glsl_type::get_instance(GLSL_TYPE_INT
, num_components
, 1);
7375 ir_variable
*image
= in_var(image_type
, "image");
7376 ir_function_signature
*sig
= new_sig(ret_type
, shader_image_size
, 1, image
);
7378 /* Set the maximal set of qualifiers allowed for this image
7379 * built-in. Function calls with arguments having fewer
7380 * qualifiers than present in the prototype are allowed by the
7381 * spec, but not with more, i.e. this will make the compiler
7382 * accept everything that needs to be accepted, and reject cases
7383 * like loads from write-only or stores to read-only images.
7385 image
->data
.memory_read_only
= true;
7386 image
->data
.memory_write_only
= true;
7387 image
->data
.memory_coherent
= true;
7388 image
->data
.memory_volatile
= true;
7389 image
->data
.memory_restrict
= true;
7394 ir_function_signature
*
7395 builtin_builder::_image_samples_prototype(const glsl_type
*image_type
,
7396 unsigned /* num_arguments */,
7397 unsigned /* flags */)
7399 ir_variable
*image
= in_var(image_type
, "image");
7400 ir_function_signature
*sig
=
7401 new_sig(glsl_type::int_type
, shader_samples
, 1, image
);
7403 /* Set the maximal set of qualifiers allowed for this image
7404 * built-in. Function calls with arguments having fewer
7405 * qualifiers than present in the prototype are allowed by the
7406 * spec, but not with more, i.e. this will make the compiler
7407 * accept everything that needs to be accepted, and reject cases
7408 * like loads from write-only or stores to read-only images.
7410 image
->data
.memory_read_only
= true;
7411 image
->data
.memory_write_only
= true;
7412 image
->data
.memory_coherent
= true;
7413 image
->data
.memory_volatile
= true;
7414 image
->data
.memory_restrict
= true;
7419 ir_function_signature
*
7420 builtin_builder::_image(image_prototype_ctr prototype
,
7421 const glsl_type
*image_type
,
7422 const char *intrinsic_name
,
7423 unsigned num_arguments
,
7425 enum ir_intrinsic_id id
)
7427 ir_function_signature
*sig
= (this->*prototype
)(image_type
,
7428 num_arguments
, flags
);
7430 if (flags
& IMAGE_FUNCTION_EMIT_STUB
) {
7431 ir_factory
body(&sig
->body
, mem_ctx
);
7432 ir_function
*f
= shader
->symbols
->get_function(intrinsic_name
);
7434 if (flags
& IMAGE_FUNCTION_RETURNS_VOID
) {
7435 body
.emit(call(f
, NULL
, sig
->parameters
));
7437 ir_variable
*ret_val
=
7438 body
.make_temp(sig
->return_type
, "_ret_val");
7439 body
.emit(call(f
, ret_val
, sig
->parameters
));
7440 body
.emit(ret(ret_val
));
7443 sig
->is_defined
= true;
7446 sig
->intrinsic_id
= id
;
7452 ir_function_signature
*
7453 builtin_builder::_memory_barrier_intrinsic(builtin_available_predicate avail
,
7454 enum ir_intrinsic_id id
)
7456 MAKE_INTRINSIC(glsl_type::void_type
, id
, avail
, 0);
7460 ir_function_signature
*
7461 builtin_builder::_memory_barrier(const char *intrinsic_name
,
7462 builtin_available_predicate avail
)
7464 MAKE_SIG(glsl_type::void_type
, avail
, 0);
7465 body
.emit(call(shader
->symbols
->get_function(intrinsic_name
),
7466 NULL
, sig
->parameters
));
7470 ir_function_signature
*
7471 builtin_builder::_ballot_intrinsic()
7473 ir_variable
*value
= in_var(glsl_type::bool_type
, "value");
7474 MAKE_INTRINSIC(glsl_type::uint64_t_type
, ir_intrinsic_ballot
, shader_ballot
,
7479 ir_function_signature
*
7480 builtin_builder::_ballot()
7482 ir_variable
*value
= in_var(glsl_type::bool_type
, "value");
7484 MAKE_SIG(glsl_type::uint64_t_type
, shader_ballot
, 1, value
);
7485 ir_variable
*retval
= body
.make_temp(glsl_type::uint64_t_type
, "retval");
7487 body
.emit(call(shader
->symbols
->get_function("__intrinsic_ballot"),
7488 retval
, sig
->parameters
));
7489 body
.emit(ret(retval
));
7493 ir_function_signature
*
7494 builtin_builder::_read_first_invocation_intrinsic(const glsl_type
*type
)
7496 ir_variable
*value
= in_var(type
, "value");
7497 MAKE_INTRINSIC(type
, ir_intrinsic_read_first_invocation
, shader_ballot
,
7502 ir_function_signature
*
7503 builtin_builder::_read_first_invocation(const glsl_type
*type
)
7505 ir_variable
*value
= in_var(type
, "value");
7507 MAKE_SIG(type
, shader_ballot
, 1, value
);
7508 ir_variable
*retval
= body
.make_temp(type
, "retval");
7510 body
.emit(call(shader
->symbols
->get_function("__intrinsic_read_first_invocation"),
7511 retval
, sig
->parameters
));
7512 body
.emit(ret(retval
));
7516 ir_function_signature
*
7517 builtin_builder::_read_invocation_intrinsic(const glsl_type
*type
)
7519 ir_variable
*value
= in_var(type
, "value");
7520 ir_variable
*invocation
= in_var(glsl_type::uint_type
, "invocation");
7521 MAKE_INTRINSIC(type
, ir_intrinsic_read_invocation
, shader_ballot
,
7522 2, value
, invocation
);
7526 ir_function_signature
*
7527 builtin_builder::_read_invocation(const glsl_type
*type
)
7529 ir_variable
*value
= in_var(type
, "value");
7530 ir_variable
*invocation
= in_var(glsl_type::uint_type
, "invocation");
7532 MAKE_SIG(type
, shader_ballot
, 2, value
, invocation
);
7533 ir_variable
*retval
= body
.make_temp(type
, "retval");
7535 body
.emit(call(shader
->symbols
->get_function("__intrinsic_read_invocation"),
7536 retval
, sig
->parameters
));
7537 body
.emit(ret(retval
));
7541 ir_function_signature
*
7542 builtin_builder::_invocation_interlock_intrinsic(builtin_available_predicate avail
,
7543 enum ir_intrinsic_id id
)
7545 MAKE_INTRINSIC(glsl_type::void_type
, id
, avail
, 0);
7549 ir_function_signature
*
7550 builtin_builder::_invocation_interlock(const char *intrinsic_name
,
7551 builtin_available_predicate avail
)
7553 MAKE_SIG(glsl_type::void_type
, avail
, 0);
7554 body
.emit(call(shader
->symbols
->get_function(intrinsic_name
),
7555 NULL
, sig
->parameters
));
7559 ir_function_signature
*
7560 builtin_builder::_shader_clock_intrinsic(builtin_available_predicate avail
,
7561 const glsl_type
*type
)
7563 MAKE_INTRINSIC(type
, ir_intrinsic_shader_clock
, avail
, 0);
7567 ir_function_signature
*
7568 builtin_builder::_shader_clock(builtin_available_predicate avail
,
7569 const glsl_type
*type
)
7571 MAKE_SIG(type
, avail
, 0);
7573 ir_variable
*retval
= body
.make_temp(glsl_type::uvec2_type
, "clock_retval");
7575 body
.emit(call(shader
->symbols
->get_function("__intrinsic_shader_clock"),
7576 retval
, sig
->parameters
));
7578 if (type
== glsl_type::uint64_t_type
) {
7579 body
.emit(ret(expr(ir_unop_pack_uint_2x32
, retval
)));
7581 body
.emit(ret(retval
));
7587 ir_function_signature
*
7588 builtin_builder::_vote_intrinsic(builtin_available_predicate avail
,
7589 enum ir_intrinsic_id id
)
7591 ir_variable
*value
= in_var(glsl_type::bool_type
, "value");
7592 MAKE_INTRINSIC(glsl_type::bool_type
, id
, avail
, 1, value
);
7596 ir_function_signature
*
7597 builtin_builder::_vote(const char *intrinsic_name
,
7598 builtin_available_predicate avail
)
7600 ir_variable
*value
= in_var(glsl_type::bool_type
, "value");
7602 MAKE_SIG(glsl_type::bool_type
, avail
, 1, value
);
7604 ir_variable
*retval
= body
.make_temp(glsl_type::bool_type
, "retval");
7606 body
.emit(call(shader
->symbols
->get_function(intrinsic_name
),
7607 retval
, sig
->parameters
));
7608 body
.emit(ret(retval
));
7612 ir_function_signature
*
7613 builtin_builder::_helper_invocation_intrinsic()
7615 MAKE_INTRINSIC(glsl_type::bool_type
, ir_intrinsic_helper_invocation
,
7616 demote_to_helper_invocation
, 0);
7620 ir_function_signature
*
7621 builtin_builder::_helper_invocation()
7623 MAKE_SIG(glsl_type::bool_type
, demote_to_helper_invocation
, 0);
7625 ir_variable
*retval
= body
.make_temp(glsl_type::bool_type
, "retval");
7627 body
.emit(call(shader
->symbols
->get_function("__intrinsic_helper_invocation"),
7628 retval
, sig
->parameters
));
7629 body
.emit(ret(retval
));
7636 /******************************************************************************/
7638 /* The singleton instance of builtin_builder. */
7639 static builtin_builder builtins
;
7640 static mtx_t builtins_lock
= _MTX_INITIALIZER_NP
;
7641 static uint32_t builtin_users
= 0;
7644 * External API (exposing the built-in module to the rest of the compiler):
7648 _mesa_glsl_builtin_functions_init_or_ref()
7650 mtx_lock(&builtins_lock
);
7651 if (builtin_users
++ == 0)
7652 builtins
.initialize();
7653 mtx_unlock(&builtins_lock
);
7657 _mesa_glsl_builtin_functions_decref()
7659 mtx_lock(&builtins_lock
);
7660 assert(builtin_users
!= 0);
7661 if (--builtin_users
== 0)
7663 mtx_unlock(&builtins_lock
);
7666 ir_function_signature
*
7667 _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state
*state
,
7668 const char *name
, exec_list
*actual_parameters
)
7670 ir_function_signature
*s
;
7671 mtx_lock(&builtins_lock
);
7672 s
= builtins
.find(state
, name
, actual_parameters
);
7673 mtx_unlock(&builtins_lock
);
7679 _mesa_glsl_has_builtin_function(_mesa_glsl_parse_state
*state
, const char *name
)
7683 mtx_lock(&builtins_lock
);
7684 f
= builtins
.shader
->symbols
->get_function(name
);
7686 foreach_in_list(ir_function_signature
, sig
, &f
->signatures
) {
7687 if (sig
->is_builtin_available(state
)) {
7693 mtx_unlock(&builtins_lock
);
7699 _mesa_glsl_get_builtin_function_shader()
7701 return builtins
.shader
;
7706 * Get the function signature for main from a shader
7708 ir_function_signature
*
7709 _mesa_get_main_function_signature(glsl_symbol_table
*symbols
)
7711 ir_function
*const f
= symbols
->get_function("main");
7713 exec_list void_parameters
;
7715 /* Look for the 'void main()' signature and ensure that it's defined.
7716 * This keeps the linker from accidentally pick a shader that just
7717 * contains a prototype for main.
7719 * We don't have to check for multiple definitions of main (in multiple
7720 * shaders) because that would have already been caught above.
7722 ir_function_signature
*sig
=
7723 f
->matching_signature(NULL
, &void_parameters
, false);
7724 if ((sig
!= NULL
) && sig
->is_defined
) {