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
);
681 shader_image_atomic(const _mesa_glsl_parse_state
*state
)
683 return (state
->is_version(420, 320) ||
684 state
->ARB_shader_image_load_store_enable
||
685 state
->OES_shader_image_atomic_enable
);
689 shader_image_atomic_exchange_float(const _mesa_glsl_parse_state
*state
)
691 return (state
->is_version(450, 320) ||
692 state
->ARB_ES3_1_compatibility_enable
||
693 state
->OES_shader_image_atomic_enable
||
694 state
->NV_shader_atomic_float_enable
);
698 shader_image_atomic_add_float(const _mesa_glsl_parse_state
*state
)
700 return state
->NV_shader_atomic_float_enable
;
704 shader_image_size(const _mesa_glsl_parse_state
*state
)
706 return state
->is_version(430, 310) ||
707 state
->ARB_shader_image_size_enable
;
711 shader_samples(const _mesa_glsl_parse_state
*state
)
713 return state
->is_version(450, 0) ||
714 state
->ARB_shader_texture_image_samples_enable
;
718 gs_streams(const _mesa_glsl_parse_state
*state
)
720 return gpu_shader5(state
) && gs_only(state
);
724 fp64(const _mesa_glsl_parse_state
*state
)
726 return state
->has_double();
730 int64(const _mesa_glsl_parse_state
*state
)
732 return state
->has_int64();
736 int64_fp64(const _mesa_glsl_parse_state
*state
)
738 return state
->has_int64() && state
->has_double();
742 compute_shader(const _mesa_glsl_parse_state
*state
)
744 return state
->stage
== MESA_SHADER_COMPUTE
;
748 compute_shader_supported(const _mesa_glsl_parse_state
*state
)
750 return state
->has_compute_shader();
754 buffer_atomics_supported(const _mesa_glsl_parse_state
*state
)
756 return compute_shader(state
) || shader_storage_buffer_object(state
);
760 barrier_supported(const _mesa_glsl_parse_state
*state
)
762 return compute_shader(state
) ||
763 state
->stage
== MESA_SHADER_TESS_CTRL
;
767 vote(const _mesa_glsl_parse_state
*state
)
769 return state
->ARB_shader_group_vote_enable
;
773 vote_or_v460_desktop(const _mesa_glsl_parse_state
*state
)
775 return state
->ARB_shader_group_vote_enable
|| v460_desktop(state
);
779 integer_functions_supported(const _mesa_glsl_parse_state
*state
)
781 return state
->extensions
->MESA_shader_integer_functions
;
785 NV_shader_atomic_float_supported(const _mesa_glsl_parse_state
*state
)
787 return state
->extensions
->NV_shader_atomic_float
;
791 shader_atomic_float_add(const _mesa_glsl_parse_state
*state
)
793 return state
->NV_shader_atomic_float_enable
;
797 shader_atomic_float_exchange(const _mesa_glsl_parse_state
*state
)
799 return state
->NV_shader_atomic_float_enable
||
800 state
->INTEL_shader_atomic_float_minmax_enable
;
804 INTEL_shader_atomic_float_minmax_supported(const _mesa_glsl_parse_state
*state
)
806 return state
->extensions
->INTEL_shader_atomic_float_minmax
;
810 shader_atomic_float_minmax(const _mesa_glsl_parse_state
*state
)
812 return state
->INTEL_shader_atomic_float_minmax_enable
;
816 /******************************************************************************/
821 * builtin_builder: A singleton object representing the core of the built-in
824 * It generates IR for every built-in function signature, and organizes them
827 class builtin_builder
{
834 ir_function_signature
*find(_mesa_glsl_parse_state
*state
,
835 const char *name
, exec_list
*actual_parameters
);
838 * A shader to hold all the built-in signatures; created by this module.
840 * This includes signatures for every built-in, regardless of version or
841 * enabled extensions. The availability predicate associated with each
842 * signature allows matching_signature() to filter out the irrelevant ones.
849 void create_shader();
850 void create_intrinsics();
851 void create_builtins();
854 * IR builder helpers:
856 * These convenience functions assist in emitting IR, but don't necessarily
857 * fit in ir_builder itself. Many of them rely on having a mem_ctx class
860 ir_variable
*in_var(const glsl_type
*type
, const char *name
);
861 ir_variable
*out_var(const glsl_type
*type
, const char *name
);
862 ir_constant
*imm(float f
, unsigned vector_elements
=1);
863 ir_constant
*imm(bool b
, unsigned vector_elements
=1);
864 ir_constant
*imm(int i
, unsigned vector_elements
=1);
865 ir_constant
*imm(unsigned u
, unsigned vector_elements
=1);
866 ir_constant
*imm(double d
, unsigned vector_elements
=1);
867 ir_constant
*imm(const glsl_type
*type
, const ir_constant_data
&);
868 ir_dereference_variable
*var_ref(ir_variable
*var
);
869 ir_dereference_array
*array_ref(ir_variable
*var
, int i
);
870 ir_swizzle
*matrix_elt(ir_variable
*var
, int col
, int row
);
872 ir_expression
*asin_expr(ir_variable
*x
, float p0
, float p1
);
873 void do_atan(ir_factory
&body
, const glsl_type
*type
, ir_variable
*res
, operand y_over_x
);
876 * Call function \param f with parameters specified as the linked
877 * list \param params of \c ir_variable objects. \param ret should
878 * point to the ir_variable that will hold the function return
879 * value, or be \c NULL if the function has void return type.
881 ir_call
*call(ir_function
*f
, ir_variable
*ret
, exec_list params
);
883 /** Create a new function and add the given signatures. */
884 void add_function(const char *name
, ...);
886 typedef ir_function_signature
*(builtin_builder::*image_prototype_ctr
)(const glsl_type
*image_type
,
887 unsigned num_arguments
,
891 * Create a new image built-in function for all known image types.
892 * \p flags is a bitfield of \c image_function_flags flags.
894 void add_image_function(const char *name
,
895 const char *intrinsic_name
,
896 image_prototype_ctr prototype
,
897 unsigned num_arguments
,
899 enum ir_intrinsic_id id
);
902 * Create new functions for all known image built-ins and types.
903 * If \p glsl is \c true, use the GLSL built-in names and emit code
904 * to call into the actual compiler intrinsic. If \p glsl is
905 * false, emit a function prototype with no body for each image
908 void add_image_functions(bool glsl
);
910 ir_function_signature
*new_sig(const glsl_type
*return_type
,
911 builtin_available_predicate avail
,
912 int num_params
, ...);
915 * Function signature generators:
918 ir_function_signature
*unop(builtin_available_predicate avail
,
919 ir_expression_operation opcode
,
920 const glsl_type
*return_type
,
921 const glsl_type
*param_type
);
922 ir_function_signature
*binop(builtin_available_predicate avail
,
923 ir_expression_operation opcode
,
924 const glsl_type
*return_type
,
925 const glsl_type
*param0_type
,
926 const glsl_type
*param1_type
,
927 bool swap_operands
= false);
929 #define B0(X) ir_function_signature *_##X();
930 #define B1(X) ir_function_signature *_##X(const glsl_type *);
931 #define B2(X) ir_function_signature *_##X(const glsl_type *, const glsl_type *);
932 #define B3(X) ir_function_signature *_##X(const glsl_type *, const glsl_type *, const glsl_type *);
933 #define BA1(X) ir_function_signature *_##X(builtin_available_predicate, const glsl_type *);
934 #define BA2(X) ir_function_signature *_##X(builtin_available_predicate, const glsl_type *, const glsl_type *);
972 ir_function_signature
*_mix_sel(builtin_available_predicate avail
,
973 const glsl_type
*val_type
,
974 const glsl_type
*blend_type
);
984 BA1(doubleBitsToInt64
)
985 BA1(doubleBitsToUint64
)
986 BA1(int64BitsToDouble
)
987 BA1(uint64BitsToDouble
)
989 ir_function_signature
*_packUnorm2x16(builtin_available_predicate avail
);
990 ir_function_signature
*_packSnorm2x16(builtin_available_predicate avail
);
991 ir_function_signature
*_packUnorm4x8(builtin_available_predicate avail
);
992 ir_function_signature
*_packSnorm4x8(builtin_available_predicate avail
);
993 ir_function_signature
*_unpackUnorm2x16(builtin_available_predicate avail
);
994 ir_function_signature
*_unpackSnorm2x16(builtin_available_predicate avail
);
995 ir_function_signature
*_unpackUnorm4x8(builtin_available_predicate avail
);
996 ir_function_signature
*_unpackSnorm4x8(builtin_available_predicate avail
);
997 ir_function_signature
*_packHalf2x16(builtin_available_predicate avail
);
998 ir_function_signature
*_unpackHalf2x16(builtin_available_predicate avail
);
999 ir_function_signature
*_packDouble2x32(builtin_available_predicate avail
);
1000 ir_function_signature
*_unpackDouble2x32(builtin_available_predicate avail
);
1001 ir_function_signature
*_packInt2x32(builtin_available_predicate avail
);
1002 ir_function_signature
*_unpackInt2x32(builtin_available_predicate avail
);
1003 ir_function_signature
*_packUint2x32(builtin_available_predicate avail
);
1004 ir_function_signature
*_unpackUint2x32(builtin_available_predicate avail
);
1015 BA1(matrixCompMult
);
1017 BA1(determinant_mat2
);
1018 BA1(determinant_mat3
);
1019 BA1(determinant_mat4
);
1027 BA1(greaterThanEqual
);
1034 BA1(textureSamples
);
1036 /** Flags to _texture() */
1037 #define TEX_PROJECT 1
1038 #define TEX_OFFSET 2
1039 #define TEX_COMPONENT 4
1040 #define TEX_OFFSET_NONCONST 8
1041 #define TEX_OFFSET_ARRAY 16
1043 ir_function_signature
*_texture(ir_texture_opcode opcode
,
1044 builtin_available_predicate avail
,
1045 const glsl_type
*return_type
,
1046 const glsl_type
*sampler_type
,
1047 const glsl_type
*coord_type
,
1049 ir_function_signature
*_textureCubeArrayShadow(ir_texture_opcode opcode
,
1050 builtin_available_predicate avail
,
1051 const glsl_type
*x
);
1052 ir_function_signature
*_texelFetch(builtin_available_predicate avail
,
1053 const glsl_type
*return_type
,
1054 const glsl_type
*sampler_type
,
1055 const glsl_type
*coord_type
,
1056 const glsl_type
*offset_type
= NULL
);
1060 ir_function_signature
*_EmitStreamVertex(builtin_available_predicate avail
,
1061 const glsl_type
*stream_type
);
1062 ir_function_signature
*_EndStreamPrimitive(builtin_available_predicate avail
,
1063 const glsl_type
*stream_type
);
1066 BA2(textureQueryLod
);
1067 BA1(textureQueryLevels
);
1068 BA2(textureSamplesIdentical
);
1096 B1(interpolateAtCentroid
)
1097 B1(interpolateAtOffset
)
1098 B1(interpolateAtSample
)
1100 ir_function_signature
*_atomic_counter_intrinsic(builtin_available_predicate avail
,
1101 enum ir_intrinsic_id id
);
1102 ir_function_signature
*_atomic_counter_intrinsic1(builtin_available_predicate avail
,
1103 enum ir_intrinsic_id id
);
1104 ir_function_signature
*_atomic_counter_intrinsic2(builtin_available_predicate avail
,
1105 enum ir_intrinsic_id id
);
1106 ir_function_signature
*_atomic_counter_op(const char *intrinsic
,
1107 builtin_available_predicate avail
);
1108 ir_function_signature
*_atomic_counter_op1(const char *intrinsic
,
1109 builtin_available_predicate avail
);
1110 ir_function_signature
*_atomic_counter_op2(const char *intrinsic
,
1111 builtin_available_predicate avail
);
1113 ir_function_signature
*_atomic_intrinsic2(builtin_available_predicate avail
,
1114 const glsl_type
*type
,
1115 enum ir_intrinsic_id id
);
1116 ir_function_signature
*_atomic_op2(const char *intrinsic
,
1117 builtin_available_predicate avail
,
1118 const glsl_type
*type
);
1119 ir_function_signature
*_atomic_intrinsic3(builtin_available_predicate avail
,
1120 const glsl_type
*type
,
1121 enum ir_intrinsic_id id
);
1122 ir_function_signature
*_atomic_op3(const char *intrinsic
,
1123 builtin_available_predicate avail
,
1124 const glsl_type
*type
);
1130 ir_function_signature
*_image_prototype(const glsl_type
*image_type
,
1131 unsigned num_arguments
,
1133 ir_function_signature
*_image_size_prototype(const glsl_type
*image_type
,
1134 unsigned num_arguments
,
1136 ir_function_signature
*_image_samples_prototype(const glsl_type
*image_type
,
1137 unsigned num_arguments
,
1139 ir_function_signature
*_image(image_prototype_ctr prototype
,
1140 const glsl_type
*image_type
,
1141 const char *intrinsic_name
,
1142 unsigned num_arguments
,
1144 enum ir_intrinsic_id id
);
1146 ir_function_signature
*_memory_barrier_intrinsic(
1147 builtin_available_predicate avail
,
1148 enum ir_intrinsic_id id
);
1149 ir_function_signature
*_memory_barrier(const char *intrinsic_name
,
1150 builtin_available_predicate avail
);
1152 ir_function_signature
*_ballot_intrinsic();
1153 ir_function_signature
*_ballot();
1154 ir_function_signature
*_read_first_invocation_intrinsic(const glsl_type
*type
);
1155 ir_function_signature
*_read_first_invocation(const glsl_type
*type
);
1156 ir_function_signature
*_read_invocation_intrinsic(const glsl_type
*type
);
1157 ir_function_signature
*_read_invocation(const glsl_type
*type
);
1160 ir_function_signature
*_invocation_interlock_intrinsic(
1161 builtin_available_predicate avail
,
1162 enum ir_intrinsic_id id
);
1163 ir_function_signature
*_invocation_interlock(
1164 const char *intrinsic_name
,
1165 builtin_available_predicate avail
);
1167 ir_function_signature
*_shader_clock_intrinsic(builtin_available_predicate avail
,
1168 const glsl_type
*type
);
1169 ir_function_signature
*_shader_clock(builtin_available_predicate avail
,
1170 const glsl_type
*type
);
1172 ir_function_signature
*_vote_intrinsic(builtin_available_predicate avail
,
1173 enum ir_intrinsic_id id
);
1174 ir_function_signature
*_vote(const char *intrinsic_name
,
1175 builtin_available_predicate avail
);
1186 enum image_function_flags
{
1187 IMAGE_FUNCTION_EMIT_STUB
= (1 << 0),
1188 IMAGE_FUNCTION_RETURNS_VOID
= (1 << 1),
1189 IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE
= (1 << 2),
1190 IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
= (1 << 3),
1191 IMAGE_FUNCTION_READ_ONLY
= (1 << 4),
1192 IMAGE_FUNCTION_WRITE_ONLY
= (1 << 5),
1193 IMAGE_FUNCTION_AVAIL_ATOMIC
= (1 << 6),
1194 IMAGE_FUNCTION_MS_ONLY
= (1 << 7),
1195 IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE
= (1 << 8),
1196 IMAGE_FUNCTION_AVAIL_ATOMIC_ADD
= (1 << 9),
1199 } /* anonymous namespace */
1202 * Core builtin_builder functionality:
1205 builtin_builder::builtin_builder()
1211 builtin_builder::~builtin_builder()
1213 ralloc_free(mem_ctx
);
1216 ir_function_signature
*
1217 builtin_builder::find(_mesa_glsl_parse_state
*state
,
1218 const char *name
, exec_list
*actual_parameters
)
1220 /* The shader currently being compiled requested a built-in function;
1221 * it needs to link against builtin_builder::shader in order to get them.
1223 * Even if we don't find a matching signature, we still need to do this so
1224 * that the "no matching signature" error will list potential candidates
1225 * from the available built-ins.
1227 state
->uses_builtin_functions
= true;
1229 ir_function
*f
= shader
->symbols
->get_function(name
);
1233 ir_function_signature
*sig
=
1234 f
->matching_signature(state
, actual_parameters
, true);
1242 builtin_builder::initialize()
1244 /* If already initialized, don't do it again. */
1245 if (mem_ctx
!= NULL
)
1248 mem_ctx
= ralloc_context(NULL
);
1250 create_intrinsics();
1255 builtin_builder::release()
1257 ralloc_free(mem_ctx
);
1260 ralloc_free(shader
);
1265 builtin_builder::create_shader()
1267 /* The target doesn't actually matter. There's no target for generic
1268 * GLSL utility code that could be linked against any stage, so just
1269 * arbitrarily pick GL_VERTEX_SHADER.
1271 shader
= _mesa_new_shader(0, MESA_SHADER_VERTEX
);
1272 shader
->symbols
= new(mem_ctx
) glsl_symbol_table
;
1278 * Create ir_function and ir_function_signature objects for each
1282 builtin_builder::create_intrinsics()
1284 add_function("__intrinsic_atomic_read",
1285 _atomic_counter_intrinsic(shader_atomic_counters
,
1286 ir_intrinsic_atomic_counter_read
),
1288 add_function("__intrinsic_atomic_increment",
1289 _atomic_counter_intrinsic(shader_atomic_counters
,
1290 ir_intrinsic_atomic_counter_increment
),
1292 add_function("__intrinsic_atomic_predecrement",
1293 _atomic_counter_intrinsic(shader_atomic_counters
,
1294 ir_intrinsic_atomic_counter_predecrement
),
1297 add_function("__intrinsic_atomic_add",
1298 _atomic_intrinsic2(buffer_atomics_supported
,
1299 glsl_type::uint_type
,
1300 ir_intrinsic_generic_atomic_add
),
1301 _atomic_intrinsic2(buffer_atomics_supported
,
1302 glsl_type::int_type
,
1303 ir_intrinsic_generic_atomic_add
),
1304 _atomic_intrinsic2(NV_shader_atomic_float_supported
,
1305 glsl_type::float_type
,
1306 ir_intrinsic_generic_atomic_add
),
1307 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1308 ir_intrinsic_atomic_counter_add
),
1310 add_function("__intrinsic_atomic_min",
1311 _atomic_intrinsic2(buffer_atomics_supported
,
1312 glsl_type::uint_type
,
1313 ir_intrinsic_generic_atomic_min
),
1314 _atomic_intrinsic2(buffer_atomics_supported
,
1315 glsl_type::int_type
,
1316 ir_intrinsic_generic_atomic_min
),
1317 _atomic_intrinsic2(INTEL_shader_atomic_float_minmax_supported
,
1318 glsl_type::float_type
,
1319 ir_intrinsic_generic_atomic_min
),
1320 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1321 ir_intrinsic_atomic_counter_min
),
1323 add_function("__intrinsic_atomic_max",
1324 _atomic_intrinsic2(buffer_atomics_supported
,
1325 glsl_type::uint_type
,
1326 ir_intrinsic_generic_atomic_max
),
1327 _atomic_intrinsic2(buffer_atomics_supported
,
1328 glsl_type::int_type
,
1329 ir_intrinsic_generic_atomic_max
),
1330 _atomic_intrinsic2(INTEL_shader_atomic_float_minmax_supported
,
1331 glsl_type::float_type
,
1332 ir_intrinsic_generic_atomic_max
),
1333 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1334 ir_intrinsic_atomic_counter_max
),
1336 add_function("__intrinsic_atomic_and",
1337 _atomic_intrinsic2(buffer_atomics_supported
,
1338 glsl_type::uint_type
,
1339 ir_intrinsic_generic_atomic_and
),
1340 _atomic_intrinsic2(buffer_atomics_supported
,
1341 glsl_type::int_type
,
1342 ir_intrinsic_generic_atomic_and
),
1343 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1344 ir_intrinsic_atomic_counter_and
),
1346 add_function("__intrinsic_atomic_or",
1347 _atomic_intrinsic2(buffer_atomics_supported
,
1348 glsl_type::uint_type
,
1349 ir_intrinsic_generic_atomic_or
),
1350 _atomic_intrinsic2(buffer_atomics_supported
,
1351 glsl_type::int_type
,
1352 ir_intrinsic_generic_atomic_or
),
1353 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1354 ir_intrinsic_atomic_counter_or
),
1356 add_function("__intrinsic_atomic_xor",
1357 _atomic_intrinsic2(buffer_atomics_supported
,
1358 glsl_type::uint_type
,
1359 ir_intrinsic_generic_atomic_xor
),
1360 _atomic_intrinsic2(buffer_atomics_supported
,
1361 glsl_type::int_type
,
1362 ir_intrinsic_generic_atomic_xor
),
1363 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1364 ir_intrinsic_atomic_counter_xor
),
1366 add_function("__intrinsic_atomic_exchange",
1367 _atomic_intrinsic2(buffer_atomics_supported
,
1368 glsl_type::uint_type
,
1369 ir_intrinsic_generic_atomic_exchange
),
1370 _atomic_intrinsic2(buffer_atomics_supported
,
1371 glsl_type::int_type
,
1372 ir_intrinsic_generic_atomic_exchange
),
1373 _atomic_intrinsic2(NV_shader_atomic_float_supported
,
1374 glsl_type::float_type
,
1375 ir_intrinsic_generic_atomic_exchange
),
1376 _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop
,
1377 ir_intrinsic_atomic_counter_exchange
),
1379 add_function("__intrinsic_atomic_comp_swap",
1380 _atomic_intrinsic3(buffer_atomics_supported
,
1381 glsl_type::uint_type
,
1382 ir_intrinsic_generic_atomic_comp_swap
),
1383 _atomic_intrinsic3(buffer_atomics_supported
,
1384 glsl_type::int_type
,
1385 ir_intrinsic_generic_atomic_comp_swap
),
1386 _atomic_intrinsic3(INTEL_shader_atomic_float_minmax_supported
,
1387 glsl_type::float_type
,
1388 ir_intrinsic_generic_atomic_comp_swap
),
1389 _atomic_counter_intrinsic2(shader_atomic_counter_ops_or_v460_desktop
,
1390 ir_intrinsic_atomic_counter_comp_swap
),
1393 add_image_functions(false);
1395 add_function("__intrinsic_memory_barrier",
1396 _memory_barrier_intrinsic(shader_image_load_store
,
1397 ir_intrinsic_memory_barrier
),
1399 add_function("__intrinsic_group_memory_barrier",
1400 _memory_barrier_intrinsic(compute_shader
,
1401 ir_intrinsic_group_memory_barrier
),
1403 add_function("__intrinsic_memory_barrier_atomic_counter",
1404 _memory_barrier_intrinsic(compute_shader_supported
,
1405 ir_intrinsic_memory_barrier_atomic_counter
),
1407 add_function("__intrinsic_memory_barrier_buffer",
1408 _memory_barrier_intrinsic(compute_shader_supported
,
1409 ir_intrinsic_memory_barrier_buffer
),
1411 add_function("__intrinsic_memory_barrier_image",
1412 _memory_barrier_intrinsic(compute_shader_supported
,
1413 ir_intrinsic_memory_barrier_image
),
1415 add_function("__intrinsic_memory_barrier_shared",
1416 _memory_barrier_intrinsic(compute_shader
,
1417 ir_intrinsic_memory_barrier_shared
),
1420 add_function("__intrinsic_begin_invocation_interlock",
1421 _invocation_interlock_intrinsic(
1422 supports_arb_fragment_shader_interlock
,
1423 ir_intrinsic_begin_invocation_interlock
), NULL
);
1425 add_function("__intrinsic_end_invocation_interlock",
1426 _invocation_interlock_intrinsic(
1427 supports_arb_fragment_shader_interlock
,
1428 ir_intrinsic_end_invocation_interlock
), NULL
);
1430 add_function("__intrinsic_shader_clock",
1431 _shader_clock_intrinsic(shader_clock
,
1432 glsl_type::uvec2_type
),
1435 add_function("__intrinsic_vote_all",
1436 _vote_intrinsic(vote_or_v460_desktop
, ir_intrinsic_vote_all
),
1438 add_function("__intrinsic_vote_any",
1439 _vote_intrinsic(vote_or_v460_desktop
, ir_intrinsic_vote_any
),
1441 add_function("__intrinsic_vote_eq",
1442 _vote_intrinsic(vote_or_v460_desktop
, ir_intrinsic_vote_eq
),
1445 add_function("__intrinsic_ballot", _ballot_intrinsic(), NULL
);
1447 add_function("__intrinsic_read_invocation",
1448 _read_invocation_intrinsic(glsl_type::float_type
),
1449 _read_invocation_intrinsic(glsl_type::vec2_type
),
1450 _read_invocation_intrinsic(glsl_type::vec3_type
),
1451 _read_invocation_intrinsic(glsl_type::vec4_type
),
1453 _read_invocation_intrinsic(glsl_type::int_type
),
1454 _read_invocation_intrinsic(glsl_type::ivec2_type
),
1455 _read_invocation_intrinsic(glsl_type::ivec3_type
),
1456 _read_invocation_intrinsic(glsl_type::ivec4_type
),
1458 _read_invocation_intrinsic(glsl_type::uint_type
),
1459 _read_invocation_intrinsic(glsl_type::uvec2_type
),
1460 _read_invocation_intrinsic(glsl_type::uvec3_type
),
1461 _read_invocation_intrinsic(glsl_type::uvec4_type
),
1464 add_function("__intrinsic_read_first_invocation",
1465 _read_first_invocation_intrinsic(glsl_type::float_type
),
1466 _read_first_invocation_intrinsic(glsl_type::vec2_type
),
1467 _read_first_invocation_intrinsic(glsl_type::vec3_type
),
1468 _read_first_invocation_intrinsic(glsl_type::vec4_type
),
1470 _read_first_invocation_intrinsic(glsl_type::int_type
),
1471 _read_first_invocation_intrinsic(glsl_type::ivec2_type
),
1472 _read_first_invocation_intrinsic(glsl_type::ivec3_type
),
1473 _read_first_invocation_intrinsic(glsl_type::ivec4_type
),
1475 _read_first_invocation_intrinsic(glsl_type::uint_type
),
1476 _read_first_invocation_intrinsic(glsl_type::uvec2_type
),
1477 _read_first_invocation_intrinsic(glsl_type::uvec3_type
),
1478 _read_first_invocation_intrinsic(glsl_type::uvec4_type
),
1484 * Create ir_function and ir_function_signature objects for each built-in.
1486 * Contains a list of every available built-in.
1489 builtin_builder::create_builtins()
1492 add_function(#NAME, \
1493 _##NAME(glsl_type::float_type), \
1494 _##NAME(glsl_type::vec2_type), \
1495 _##NAME(glsl_type::vec3_type), \
1496 _##NAME(glsl_type::vec4_type), \
1500 add_function(#NAME, \
1501 _##NAME(always_available, glsl_type::float_type), \
1502 _##NAME(always_available, glsl_type::vec2_type), \
1503 _##NAME(always_available, glsl_type::vec3_type), \
1504 _##NAME(always_available, glsl_type::vec4_type), \
1505 _##NAME(fp64, glsl_type::double_type), \
1506 _##NAME(fp64, glsl_type::dvec2_type), \
1507 _##NAME(fp64, glsl_type::dvec3_type), \
1508 _##NAME(fp64, glsl_type::dvec4_type), \
1511 #define FD130(NAME) \
1512 add_function(#NAME, \
1513 _##NAME(v130, glsl_type::float_type), \
1514 _##NAME(v130, glsl_type::vec2_type), \
1515 _##NAME(v130, glsl_type::vec3_type), \
1516 _##NAME(v130, glsl_type::vec4_type), \
1517 _##NAME(fp64, glsl_type::double_type), \
1518 _##NAME(fp64, glsl_type::dvec2_type), \
1519 _##NAME(fp64, glsl_type::dvec3_type), \
1520 _##NAME(fp64, glsl_type::dvec4_type), \
1523 #define FDGS5(NAME) \
1524 add_function(#NAME, \
1525 _##NAME(gpu_shader5_es, glsl_type::float_type), \
1526 _##NAME(gpu_shader5_es, glsl_type::vec2_type), \
1527 _##NAME(gpu_shader5_es, glsl_type::vec3_type), \
1528 _##NAME(gpu_shader5_es, glsl_type::vec4_type), \
1529 _##NAME(fp64, glsl_type::double_type), \
1530 _##NAME(fp64, glsl_type::dvec2_type), \
1531 _##NAME(fp64, glsl_type::dvec3_type), \
1532 _##NAME(fp64, glsl_type::dvec4_type), \
1536 add_function(#NAME, \
1537 _##NAME(glsl_type::float_type), \
1538 _##NAME(glsl_type::vec2_type), \
1539 _##NAME(glsl_type::vec3_type), \
1540 _##NAME(glsl_type::vec4_type), \
1541 _##NAME(glsl_type::int_type), \
1542 _##NAME(glsl_type::ivec2_type), \
1543 _##NAME(glsl_type::ivec3_type), \
1544 _##NAME(glsl_type::ivec4_type), \
1547 #define FI64(NAME) \
1548 add_function(#NAME, \
1549 _##NAME(always_available, glsl_type::float_type), \
1550 _##NAME(always_available, glsl_type::vec2_type), \
1551 _##NAME(always_available, glsl_type::vec3_type), \
1552 _##NAME(always_available, glsl_type::vec4_type), \
1553 _##NAME(always_available, glsl_type::int_type), \
1554 _##NAME(always_available, glsl_type::ivec2_type), \
1555 _##NAME(always_available, glsl_type::ivec3_type), \
1556 _##NAME(always_available, glsl_type::ivec4_type), \
1557 _##NAME(fp64, glsl_type::double_type), \
1558 _##NAME(fp64, glsl_type::dvec2_type), \
1559 _##NAME(fp64, glsl_type::dvec3_type), \
1560 _##NAME(fp64, glsl_type::dvec4_type), \
1561 _##NAME(int64, glsl_type::int64_t_type), \
1562 _##NAME(int64, glsl_type::i64vec2_type), \
1563 _##NAME(int64, glsl_type::i64vec3_type), \
1564 _##NAME(int64, glsl_type::i64vec4_type), \
1567 #define FIUD_VEC(NAME) \
1568 add_function(#NAME, \
1569 _##NAME(always_available, glsl_type::vec2_type), \
1570 _##NAME(always_available, glsl_type::vec3_type), \
1571 _##NAME(always_available, glsl_type::vec4_type), \
1573 _##NAME(always_available, glsl_type::ivec2_type), \
1574 _##NAME(always_available, glsl_type::ivec3_type), \
1575 _##NAME(always_available, glsl_type::ivec4_type), \
1577 _##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type), \
1578 _##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type), \
1579 _##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type), \
1580 _##NAME(fp64, glsl_type::dvec2_type), \
1581 _##NAME(fp64, glsl_type::dvec3_type), \
1582 _##NAME(fp64, glsl_type::dvec4_type), \
1583 _##NAME(int64, glsl_type::int64_t_type), \
1584 _##NAME(int64, glsl_type::i64vec2_type), \
1585 _##NAME(int64, glsl_type::i64vec3_type), \
1586 _##NAME(int64, glsl_type::i64vec4_type), \
1587 _##NAME(int64, glsl_type::uint64_t_type), \
1588 _##NAME(int64, glsl_type::u64vec2_type), \
1589 _##NAME(int64, glsl_type::u64vec3_type), \
1590 _##NAME(int64, glsl_type::u64vec4_type), \
1594 add_function(#NAME, \
1595 _##NAME(glsl_type::int_type), \
1596 _##NAME(glsl_type::ivec2_type), \
1597 _##NAME(glsl_type::ivec3_type), \
1598 _##NAME(glsl_type::ivec4_type), \
1600 _##NAME(glsl_type::uint_type), \
1601 _##NAME(glsl_type::uvec2_type), \
1602 _##NAME(glsl_type::uvec3_type), \
1603 _##NAME(glsl_type::uvec4_type), \
1606 #define FIUBD_VEC(NAME) \
1607 add_function(#NAME, \
1608 _##NAME(always_available, glsl_type::vec2_type), \
1609 _##NAME(always_available, glsl_type::vec3_type), \
1610 _##NAME(always_available, glsl_type::vec4_type), \
1612 _##NAME(always_available, glsl_type::ivec2_type), \
1613 _##NAME(always_available, glsl_type::ivec3_type), \
1614 _##NAME(always_available, glsl_type::ivec4_type), \
1616 _##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type), \
1617 _##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type), \
1618 _##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type), \
1620 _##NAME(always_available, glsl_type::bvec2_type), \
1621 _##NAME(always_available, glsl_type::bvec3_type), \
1622 _##NAME(always_available, glsl_type::bvec4_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), \
1631 _##NAME(int64, glsl_type::uint64_t_type), \
1632 _##NAME(int64, glsl_type::u64vec2_type), \
1633 _##NAME(int64, glsl_type::u64vec3_type), \
1634 _##NAME(int64, glsl_type::u64vec4_type), \
1637 #define FIUD2_MIXED(NAME) \
1638 add_function(#NAME, \
1639 _##NAME(always_available, glsl_type::float_type, glsl_type::float_type), \
1640 _##NAME(always_available, glsl_type::vec2_type, glsl_type::float_type), \
1641 _##NAME(always_available, glsl_type::vec3_type, glsl_type::float_type), \
1642 _##NAME(always_available, glsl_type::vec4_type, glsl_type::float_type), \
1644 _##NAME(always_available, glsl_type::vec2_type, glsl_type::vec2_type), \
1645 _##NAME(always_available, glsl_type::vec3_type, glsl_type::vec3_type), \
1646 _##NAME(always_available, glsl_type::vec4_type, glsl_type::vec4_type), \
1648 _##NAME(always_available, glsl_type::int_type, glsl_type::int_type), \
1649 _##NAME(always_available, glsl_type::ivec2_type, glsl_type::int_type), \
1650 _##NAME(always_available, glsl_type::ivec3_type, glsl_type::int_type), \
1651 _##NAME(always_available, glsl_type::ivec4_type, glsl_type::int_type), \
1653 _##NAME(always_available, glsl_type::ivec2_type, glsl_type::ivec2_type), \
1654 _##NAME(always_available, glsl_type::ivec3_type, glsl_type::ivec3_type), \
1655 _##NAME(always_available, glsl_type::ivec4_type, glsl_type::ivec4_type), \
1657 _##NAME(v130_or_gpu_shader4, glsl_type::uint_type, glsl_type::uint_type), \
1658 _##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type, glsl_type::uint_type), \
1659 _##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type, glsl_type::uint_type), \
1660 _##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type, glsl_type::uint_type), \
1662 _##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type, glsl_type::uvec2_type), \
1663 _##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type, glsl_type::uvec3_type), \
1664 _##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type, glsl_type::uvec4_type), \
1666 _##NAME(fp64, glsl_type::double_type, glsl_type::double_type), \
1667 _##NAME(fp64, glsl_type::dvec2_type, glsl_type::double_type), \
1668 _##NAME(fp64, glsl_type::dvec3_type, glsl_type::double_type), \
1669 _##NAME(fp64, glsl_type::dvec4_type, glsl_type::double_type), \
1670 _##NAME(fp64, glsl_type::dvec2_type, glsl_type::dvec2_type), \
1671 _##NAME(fp64, glsl_type::dvec3_type, glsl_type::dvec3_type), \
1672 _##NAME(fp64, glsl_type::dvec4_type, glsl_type::dvec4_type), \
1674 _##NAME(int64, glsl_type::int64_t_type, glsl_type::int64_t_type), \
1675 _##NAME(int64, glsl_type::i64vec2_type, glsl_type::int64_t_type), \
1676 _##NAME(int64, glsl_type::i64vec3_type, glsl_type::int64_t_type), \
1677 _##NAME(int64, glsl_type::i64vec4_type, glsl_type::int64_t_type), \
1678 _##NAME(int64, glsl_type::i64vec2_type, glsl_type::i64vec2_type), \
1679 _##NAME(int64, glsl_type::i64vec3_type, glsl_type::i64vec3_type), \
1680 _##NAME(int64, glsl_type::i64vec4_type, glsl_type::i64vec4_type), \
1681 _##NAME(int64, glsl_type::uint64_t_type, glsl_type::uint64_t_type), \
1682 _##NAME(int64, glsl_type::u64vec2_type, glsl_type::uint64_t_type), \
1683 _##NAME(int64, glsl_type::u64vec3_type, glsl_type::uint64_t_type), \
1684 _##NAME(int64, glsl_type::u64vec4_type, glsl_type::uint64_t_type), \
1685 _##NAME(int64, glsl_type::u64vec2_type, glsl_type::u64vec2_type), \
1686 _##NAME(int64, glsl_type::u64vec3_type, glsl_type::u64vec3_type), \
1687 _##NAME(int64, glsl_type::u64vec4_type, glsl_type::u64vec4_type), \
1698 add_function("atan",
1699 _atan(glsl_type::float_type
),
1700 _atan(glsl_type::vec2_type
),
1701 _atan(glsl_type::vec3_type
),
1702 _atan(glsl_type::vec4_type
),
1703 _atan2(glsl_type::float_type
),
1704 _atan2(glsl_type::vec2_type
),
1705 _atan2(glsl_type::vec3_type
),
1706 _atan2(glsl_type::vec4_type
),
1731 add_function("truncate",
1732 _truncate(gpu_shader4
, glsl_type::float_type
),
1733 _truncate(gpu_shader4
, glsl_type::vec2_type
),
1734 _truncate(gpu_shader4
, glsl_type::vec3_type
),
1735 _truncate(gpu_shader4
, glsl_type::vec4_type
),
1740 _mod(always_available
, glsl_type::float_type
, glsl_type::float_type
),
1741 _mod(always_available
, glsl_type::vec2_type
, glsl_type::float_type
),
1742 _mod(always_available
, glsl_type::vec3_type
, glsl_type::float_type
),
1743 _mod(always_available
, glsl_type::vec4_type
, glsl_type::float_type
),
1745 _mod(always_available
, glsl_type::vec2_type
, glsl_type::vec2_type
),
1746 _mod(always_available
, glsl_type::vec3_type
, glsl_type::vec3_type
),
1747 _mod(always_available
, glsl_type::vec4_type
, glsl_type::vec4_type
),
1749 _mod(fp64
, glsl_type::double_type
, glsl_type::double_type
),
1750 _mod(fp64
, glsl_type::dvec2_type
, glsl_type::double_type
),
1751 _mod(fp64
, glsl_type::dvec3_type
, glsl_type::double_type
),
1752 _mod(fp64
, glsl_type::dvec4_type
, glsl_type::double_type
),
1754 _mod(fp64
, glsl_type::dvec2_type
, glsl_type::dvec2_type
),
1755 _mod(fp64
, glsl_type::dvec3_type
, glsl_type::dvec3_type
),
1756 _mod(fp64
, glsl_type::dvec4_type
, glsl_type::dvec4_type
),
1766 _mix_lrp(always_available
, glsl_type::float_type
, glsl_type::float_type
),
1767 _mix_lrp(always_available
, glsl_type::vec2_type
, glsl_type::float_type
),
1768 _mix_lrp(always_available
, glsl_type::vec3_type
, glsl_type::float_type
),
1769 _mix_lrp(always_available
, glsl_type::vec4_type
, glsl_type::float_type
),
1771 _mix_lrp(always_available
, glsl_type::vec2_type
, glsl_type::vec2_type
),
1772 _mix_lrp(always_available
, glsl_type::vec3_type
, glsl_type::vec3_type
),
1773 _mix_lrp(always_available
, glsl_type::vec4_type
, glsl_type::vec4_type
),
1775 _mix_lrp(fp64
, glsl_type::double_type
, glsl_type::double_type
),
1776 _mix_lrp(fp64
, glsl_type::dvec2_type
, glsl_type::double_type
),
1777 _mix_lrp(fp64
, glsl_type::dvec3_type
, glsl_type::double_type
),
1778 _mix_lrp(fp64
, glsl_type::dvec4_type
, glsl_type::double_type
),
1780 _mix_lrp(fp64
, glsl_type::dvec2_type
, glsl_type::dvec2_type
),
1781 _mix_lrp(fp64
, glsl_type::dvec3_type
, glsl_type::dvec3_type
),
1782 _mix_lrp(fp64
, glsl_type::dvec4_type
, glsl_type::dvec4_type
),
1784 _mix_sel(v130
, glsl_type::float_type
, glsl_type::bool_type
),
1785 _mix_sel(v130
, glsl_type::vec2_type
, glsl_type::bvec2_type
),
1786 _mix_sel(v130
, glsl_type::vec3_type
, glsl_type::bvec3_type
),
1787 _mix_sel(v130
, glsl_type::vec4_type
, glsl_type::bvec4_type
),
1789 _mix_sel(fp64
, glsl_type::double_type
, glsl_type::bool_type
),
1790 _mix_sel(fp64
, glsl_type::dvec2_type
, glsl_type::bvec2_type
),
1791 _mix_sel(fp64
, glsl_type::dvec3_type
, glsl_type::bvec3_type
),
1792 _mix_sel(fp64
, glsl_type::dvec4_type
, glsl_type::bvec4_type
),
1794 _mix_sel(shader_integer_mix
, glsl_type::int_type
, glsl_type::bool_type
),
1795 _mix_sel(shader_integer_mix
, glsl_type::ivec2_type
, glsl_type::bvec2_type
),
1796 _mix_sel(shader_integer_mix
, glsl_type::ivec3_type
, glsl_type::bvec3_type
),
1797 _mix_sel(shader_integer_mix
, glsl_type::ivec4_type
, glsl_type::bvec4_type
),
1799 _mix_sel(shader_integer_mix
, glsl_type::uint_type
, glsl_type::bool_type
),
1800 _mix_sel(shader_integer_mix
, glsl_type::uvec2_type
, glsl_type::bvec2_type
),
1801 _mix_sel(shader_integer_mix
, glsl_type::uvec3_type
, glsl_type::bvec3_type
),
1802 _mix_sel(shader_integer_mix
, glsl_type::uvec4_type
, glsl_type::bvec4_type
),
1804 _mix_sel(shader_integer_mix
, glsl_type::bool_type
, glsl_type::bool_type
),
1805 _mix_sel(shader_integer_mix
, glsl_type::bvec2_type
, glsl_type::bvec2_type
),
1806 _mix_sel(shader_integer_mix
, glsl_type::bvec3_type
, glsl_type::bvec3_type
),
1807 _mix_sel(shader_integer_mix
, glsl_type::bvec4_type
, glsl_type::bvec4_type
),
1809 _mix_sel(int64
, glsl_type::int64_t_type
, glsl_type::bool_type
),
1810 _mix_sel(int64
, glsl_type::i64vec2_type
, glsl_type::bvec2_type
),
1811 _mix_sel(int64
, glsl_type::i64vec3_type
, glsl_type::bvec3_type
),
1812 _mix_sel(int64
, glsl_type::i64vec4_type
, glsl_type::bvec4_type
),
1814 _mix_sel(int64
, glsl_type::uint64_t_type
, glsl_type::bool_type
),
1815 _mix_sel(int64
, glsl_type::u64vec2_type
, glsl_type::bvec2_type
),
1816 _mix_sel(int64
, glsl_type::u64vec3_type
, glsl_type::bvec3_type
),
1817 _mix_sel(int64
, glsl_type::u64vec4_type
, glsl_type::bvec4_type
),
1820 add_function("step",
1821 _step(always_available
, glsl_type::float_type
, glsl_type::float_type
),
1822 _step(always_available
, glsl_type::float_type
, glsl_type::vec2_type
),
1823 _step(always_available
, glsl_type::float_type
, glsl_type::vec3_type
),
1824 _step(always_available
, glsl_type::float_type
, glsl_type::vec4_type
),
1826 _step(always_available
, glsl_type::vec2_type
, glsl_type::vec2_type
),
1827 _step(always_available
, glsl_type::vec3_type
, glsl_type::vec3_type
),
1828 _step(always_available
, glsl_type::vec4_type
, glsl_type::vec4_type
),
1829 _step(fp64
, glsl_type::double_type
, glsl_type::double_type
),
1830 _step(fp64
, glsl_type::double_type
, glsl_type::dvec2_type
),
1831 _step(fp64
, glsl_type::double_type
, glsl_type::dvec3_type
),
1832 _step(fp64
, glsl_type::double_type
, glsl_type::dvec4_type
),
1834 _step(fp64
, glsl_type::dvec2_type
, glsl_type::dvec2_type
),
1835 _step(fp64
, glsl_type::dvec3_type
, glsl_type::dvec3_type
),
1836 _step(fp64
, glsl_type::dvec4_type
, glsl_type::dvec4_type
),
1839 add_function("smoothstep",
1840 _smoothstep(always_available
, glsl_type::float_type
, glsl_type::float_type
),
1841 _smoothstep(always_available
, glsl_type::float_type
, glsl_type::vec2_type
),
1842 _smoothstep(always_available
, glsl_type::float_type
, glsl_type::vec3_type
),
1843 _smoothstep(always_available
, glsl_type::float_type
, glsl_type::vec4_type
),
1845 _smoothstep(always_available
, glsl_type::vec2_type
, glsl_type::vec2_type
),
1846 _smoothstep(always_available
, glsl_type::vec3_type
, glsl_type::vec3_type
),
1847 _smoothstep(always_available
, glsl_type::vec4_type
, glsl_type::vec4_type
),
1848 _smoothstep(fp64
, glsl_type::double_type
, glsl_type::double_type
),
1849 _smoothstep(fp64
, glsl_type::double_type
, glsl_type::dvec2_type
),
1850 _smoothstep(fp64
, glsl_type::double_type
, glsl_type::dvec3_type
),
1851 _smoothstep(fp64
, glsl_type::double_type
, glsl_type::dvec4_type
),
1853 _smoothstep(fp64
, glsl_type::dvec2_type
, glsl_type::dvec2_type
),
1854 _smoothstep(fp64
, glsl_type::dvec3_type
, glsl_type::dvec3_type
),
1855 _smoothstep(fp64
, glsl_type::dvec4_type
, glsl_type::dvec4_type
),
1863 add_function("intBitsToFloat",
1864 _intBitsToFloat(glsl_type::int_type
),
1865 _intBitsToFloat(glsl_type::ivec2_type
),
1866 _intBitsToFloat(glsl_type::ivec3_type
),
1867 _intBitsToFloat(glsl_type::ivec4_type
),
1869 add_function("uintBitsToFloat",
1870 _uintBitsToFloat(glsl_type::uint_type
),
1871 _uintBitsToFloat(glsl_type::uvec2_type
),
1872 _uintBitsToFloat(glsl_type::uvec3_type
),
1873 _uintBitsToFloat(glsl_type::uvec4_type
),
1876 add_function("doubleBitsToInt64",
1877 _doubleBitsToInt64(int64_fp64
, glsl_type::double_type
),
1878 _doubleBitsToInt64(int64_fp64
, glsl_type::dvec2_type
),
1879 _doubleBitsToInt64(int64_fp64
, glsl_type::dvec3_type
),
1880 _doubleBitsToInt64(int64_fp64
, glsl_type::dvec4_type
),
1883 add_function("doubleBitsToUint64",
1884 _doubleBitsToUint64(int64_fp64
, glsl_type::double_type
),
1885 _doubleBitsToUint64(int64_fp64
, glsl_type::dvec2_type
),
1886 _doubleBitsToUint64(int64_fp64
, glsl_type::dvec3_type
),
1887 _doubleBitsToUint64(int64_fp64
, glsl_type::dvec4_type
),
1890 add_function("int64BitsToDouble",
1891 _int64BitsToDouble(int64_fp64
, glsl_type::int64_t_type
),
1892 _int64BitsToDouble(int64_fp64
, glsl_type::i64vec2_type
),
1893 _int64BitsToDouble(int64_fp64
, glsl_type::i64vec3_type
),
1894 _int64BitsToDouble(int64_fp64
, glsl_type::i64vec4_type
),
1897 add_function("uint64BitsToDouble",
1898 _uint64BitsToDouble(int64_fp64
, glsl_type::uint64_t_type
),
1899 _uint64BitsToDouble(int64_fp64
, glsl_type::u64vec2_type
),
1900 _uint64BitsToDouble(int64_fp64
, glsl_type::u64vec3_type
),
1901 _uint64BitsToDouble(int64_fp64
, glsl_type::u64vec4_type
),
1904 add_function("packUnorm2x16", _packUnorm2x16(shader_packing_or_es3_or_gpu_shader5
), NULL
);
1905 add_function("packSnorm2x16", _packSnorm2x16(shader_packing_or_es3
), NULL
);
1906 add_function("packUnorm4x8", _packUnorm4x8(shader_packing_or_es31_or_gpu_shader5
), NULL
);
1907 add_function("packSnorm4x8", _packSnorm4x8(shader_packing_or_es31_or_gpu_shader5
), NULL
);
1908 add_function("unpackUnorm2x16", _unpackUnorm2x16(shader_packing_or_es3_or_gpu_shader5
), NULL
);
1909 add_function("unpackSnorm2x16", _unpackSnorm2x16(shader_packing_or_es3
), NULL
);
1910 add_function("unpackUnorm4x8", _unpackUnorm4x8(shader_packing_or_es31_or_gpu_shader5
), NULL
);
1911 add_function("unpackSnorm4x8", _unpackSnorm4x8(shader_packing_or_es31_or_gpu_shader5
), NULL
);
1912 add_function("packHalf2x16", _packHalf2x16(shader_packing_or_es3
), NULL
);
1913 add_function("unpackHalf2x16", _unpackHalf2x16(shader_packing_or_es3
), NULL
);
1914 add_function("packDouble2x32", _packDouble2x32(fp64
), NULL
);
1915 add_function("unpackDouble2x32", _unpackDouble2x32(fp64
), NULL
);
1917 add_function("packInt2x32", _packInt2x32(int64
), NULL
);
1918 add_function("unpackInt2x32", _unpackInt2x32(int64
), NULL
);
1919 add_function("packUint2x32", _packUint2x32(int64
), NULL
);
1920 add_function("unpackUint2x32", _unpackUint2x32(int64
), NULL
);
1926 add_function("cross", _cross(always_available
, glsl_type::vec3_type
),
1927 _cross(fp64
, glsl_type::dvec3_type
), NULL
);
1930 add_function("ftransform", _ftransform(), NULL
);
1935 add_function("matrixCompMult",
1936 _matrixCompMult(always_available
, glsl_type::mat2_type
),
1937 _matrixCompMult(always_available
, glsl_type::mat3_type
),
1938 _matrixCompMult(always_available
, glsl_type::mat4_type
),
1939 _matrixCompMult(always_available
, glsl_type::mat2x3_type
),
1940 _matrixCompMult(always_available
, glsl_type::mat2x4_type
),
1941 _matrixCompMult(always_available
, glsl_type::mat3x2_type
),
1942 _matrixCompMult(always_available
, glsl_type::mat3x4_type
),
1943 _matrixCompMult(always_available
, glsl_type::mat4x2_type
),
1944 _matrixCompMult(always_available
, glsl_type::mat4x3_type
),
1945 _matrixCompMult(fp64
, glsl_type::dmat2_type
),
1946 _matrixCompMult(fp64
, glsl_type::dmat3_type
),
1947 _matrixCompMult(fp64
, glsl_type::dmat4_type
),
1948 _matrixCompMult(fp64
, glsl_type::dmat2x3_type
),
1949 _matrixCompMult(fp64
, glsl_type::dmat2x4_type
),
1950 _matrixCompMult(fp64
, glsl_type::dmat3x2_type
),
1951 _matrixCompMult(fp64
, glsl_type::dmat3x4_type
),
1952 _matrixCompMult(fp64
, glsl_type::dmat4x2_type
),
1953 _matrixCompMult(fp64
, glsl_type::dmat4x3_type
),
1955 add_function("outerProduct",
1956 _outerProduct(v120
, glsl_type::mat2_type
),
1957 _outerProduct(v120
, glsl_type::mat3_type
),
1958 _outerProduct(v120
, glsl_type::mat4_type
),
1959 _outerProduct(v120
, glsl_type::mat2x3_type
),
1960 _outerProduct(v120
, glsl_type::mat2x4_type
),
1961 _outerProduct(v120
, glsl_type::mat3x2_type
),
1962 _outerProduct(v120
, glsl_type::mat3x4_type
),
1963 _outerProduct(v120
, glsl_type::mat4x2_type
),
1964 _outerProduct(v120
, glsl_type::mat4x3_type
),
1965 _outerProduct(fp64
, glsl_type::dmat2_type
),
1966 _outerProduct(fp64
, glsl_type::dmat3_type
),
1967 _outerProduct(fp64
, glsl_type::dmat4_type
),
1968 _outerProduct(fp64
, glsl_type::dmat2x3_type
),
1969 _outerProduct(fp64
, glsl_type::dmat2x4_type
),
1970 _outerProduct(fp64
, glsl_type::dmat3x2_type
),
1971 _outerProduct(fp64
, glsl_type::dmat3x4_type
),
1972 _outerProduct(fp64
, glsl_type::dmat4x2_type
),
1973 _outerProduct(fp64
, glsl_type::dmat4x3_type
),
1975 add_function("determinant",
1976 _determinant_mat2(v120
, glsl_type::mat2_type
),
1977 _determinant_mat3(v120
, glsl_type::mat3_type
),
1978 _determinant_mat4(v120
, glsl_type::mat4_type
),
1979 _determinant_mat2(fp64
, glsl_type::dmat2_type
),
1980 _determinant_mat3(fp64
, glsl_type::dmat3_type
),
1981 _determinant_mat4(fp64
, glsl_type::dmat4_type
),
1984 add_function("inverse",
1985 _inverse_mat2(v140_or_es3
, glsl_type::mat2_type
),
1986 _inverse_mat3(v140_or_es3
, glsl_type::mat3_type
),
1987 _inverse_mat4(v140_or_es3
, glsl_type::mat4_type
),
1988 _inverse_mat2(fp64
, glsl_type::dmat2_type
),
1989 _inverse_mat3(fp64
, glsl_type::dmat3_type
),
1990 _inverse_mat4(fp64
, glsl_type::dmat4_type
),
1992 add_function("transpose",
1993 _transpose(v120
, glsl_type::mat2_type
),
1994 _transpose(v120
, glsl_type::mat3_type
),
1995 _transpose(v120
, glsl_type::mat4_type
),
1996 _transpose(v120
, glsl_type::mat2x3_type
),
1997 _transpose(v120
, glsl_type::mat2x4_type
),
1998 _transpose(v120
, glsl_type::mat3x2_type
),
1999 _transpose(v120
, glsl_type::mat3x4_type
),
2000 _transpose(v120
, glsl_type::mat4x2_type
),
2001 _transpose(v120
, glsl_type::mat4x3_type
),
2002 _transpose(fp64
, glsl_type::dmat2_type
),
2003 _transpose(fp64
, glsl_type::dmat3_type
),
2004 _transpose(fp64
, glsl_type::dmat4_type
),
2005 _transpose(fp64
, glsl_type::dmat2x3_type
),
2006 _transpose(fp64
, glsl_type::dmat2x4_type
),
2007 _transpose(fp64
, glsl_type::dmat3x2_type
),
2008 _transpose(fp64
, glsl_type::dmat3x4_type
),
2009 _transpose(fp64
, glsl_type::dmat4x2_type
),
2010 _transpose(fp64
, glsl_type::dmat4x3_type
),
2013 FIUD_VEC(lessThanEqual
)
2014 FIUD_VEC(greaterThan
)
2015 FIUD_VEC(greaterThanEqual
)
2020 _any(glsl_type::bvec2_type
),
2021 _any(glsl_type::bvec3_type
),
2022 _any(glsl_type::bvec4_type
),
2026 _all(glsl_type::bvec2_type
),
2027 _all(glsl_type::bvec3_type
),
2028 _all(glsl_type::bvec4_type
),
2032 _not(glsl_type::bvec2_type
),
2033 _not(glsl_type::bvec3_type
),
2034 _not(glsl_type::bvec4_type
),
2037 add_function("textureSize",
2038 _textureSize(v130
, glsl_type::int_type
, glsl_type::sampler1D_type
),
2039 _textureSize(v130
, glsl_type::int_type
, glsl_type::isampler1D_type
),
2040 _textureSize(v130
, glsl_type::int_type
, glsl_type::usampler1D_type
),
2042 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler2D_type
),
2043 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::isampler2D_type
),
2044 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::usampler2D_type
),
2046 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::sampler3D_type
),
2047 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::isampler3D_type
),
2048 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::usampler3D_type
),
2050 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::samplerCube_type
),
2051 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::isamplerCube_type
),
2052 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::usamplerCube_type
),
2054 _textureSize(v130
, glsl_type::int_type
, glsl_type::sampler1DShadow_type
),
2055 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler2DShadow_type
),
2056 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::samplerCubeShadow_type
),
2058 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler1DArray_type
),
2059 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::isampler1DArray_type
),
2060 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::usampler1DArray_type
),
2061 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::sampler2DArray_type
),
2062 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::isampler2DArray_type
),
2063 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::usampler2DArray_type
),
2065 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler1DArrayShadow_type
),
2066 _textureSize(v130
, glsl_type::ivec3_type
, glsl_type::sampler2DArrayShadow_type
),
2068 _textureSize(texture_cube_map_array
, glsl_type::ivec3_type
, glsl_type::samplerCubeArray_type
),
2069 _textureSize(texture_cube_map_array
, glsl_type::ivec3_type
, glsl_type::isamplerCubeArray_type
),
2070 _textureSize(texture_cube_map_array
, glsl_type::ivec3_type
, glsl_type::usamplerCubeArray_type
),
2071 _textureSize(texture_cube_map_array
, glsl_type::ivec3_type
, glsl_type::samplerCubeArrayShadow_type
),
2073 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler2DRect_type
),
2074 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::isampler2DRect_type
),
2075 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::usampler2DRect_type
),
2076 _textureSize(v130
, glsl_type::ivec2_type
, glsl_type::sampler2DRectShadow_type
),
2078 _textureSize(texture_buffer
, glsl_type::int_type
, glsl_type::samplerBuffer_type
),
2079 _textureSize(texture_buffer
, glsl_type::int_type
, glsl_type::isamplerBuffer_type
),
2080 _textureSize(texture_buffer
, glsl_type::int_type
, glsl_type::usamplerBuffer_type
),
2081 _textureSize(texture_multisample
, glsl_type::ivec2_type
, glsl_type::sampler2DMS_type
),
2082 _textureSize(texture_multisample
, glsl_type::ivec2_type
, glsl_type::isampler2DMS_type
),
2083 _textureSize(texture_multisample
, glsl_type::ivec2_type
, glsl_type::usampler2DMS_type
),
2085 _textureSize(texture_multisample_array
, glsl_type::ivec3_type
, glsl_type::sampler2DMSArray_type
),
2086 _textureSize(texture_multisample_array
, glsl_type::ivec3_type
, glsl_type::isampler2DMSArray_type
),
2087 _textureSize(texture_multisample_array
, glsl_type::ivec3_type
, glsl_type::usampler2DMSArray_type
),
2090 add_function("textureSize1D",
2091 _textureSize(gpu_shader4
, glsl_type::int_type
, glsl_type::sampler1D_type
),
2092 _textureSize(gpu_shader4_integer
, glsl_type::int_type
, glsl_type::isampler1D_type
),
2093 _textureSize(gpu_shader4_integer
, glsl_type::int_type
, glsl_type::usampler1D_type
),
2096 add_function("textureSize2D",
2097 _textureSize(gpu_shader4
, glsl_type::ivec2_type
, glsl_type::sampler2D_type
),
2098 _textureSize(gpu_shader4_integer
, glsl_type::ivec2_type
, glsl_type::isampler2D_type
),
2099 _textureSize(gpu_shader4_integer
, glsl_type::ivec2_type
, glsl_type::usampler2D_type
),
2102 add_function("textureSize3D",
2103 _textureSize(gpu_shader4
, glsl_type::ivec3_type
, glsl_type::sampler3D_type
),
2104 _textureSize(gpu_shader4_integer
, glsl_type::ivec3_type
, glsl_type::isampler3D_type
),
2105 _textureSize(gpu_shader4_integer
, glsl_type::ivec3_type
, glsl_type::usampler3D_type
),
2108 add_function("textureSizeCube",
2109 _textureSize(gpu_shader4
, glsl_type::ivec2_type
, glsl_type::samplerCube_type
),
2110 _textureSize(gpu_shader4_integer
, glsl_type::ivec2_type
, glsl_type::isamplerCube_type
),
2111 _textureSize(gpu_shader4_integer
, glsl_type::ivec2_type
, glsl_type::usamplerCube_type
),
2114 add_function("textureSize1DArray",
2115 _textureSize(gpu_shader4_array
, glsl_type::ivec2_type
, glsl_type::sampler1DArray_type
),
2116 _textureSize(gpu_shader4_array_integer
, glsl_type::ivec2_type
, glsl_type::isampler1DArray_type
),
2117 _textureSize(gpu_shader4_array_integer
, glsl_type::ivec2_type
, glsl_type::usampler1DArray_type
),
2120 add_function("textureSize2DArray",
2121 _textureSize(gpu_shader4_array
, glsl_type::ivec3_type
, glsl_type::sampler2DArray_type
),
2122 _textureSize(gpu_shader4_array_integer
, glsl_type::ivec3_type
, glsl_type::isampler2DArray_type
),
2123 _textureSize(gpu_shader4_array_integer
, glsl_type::ivec3_type
, glsl_type::usampler2DArray_type
),
2126 add_function("textureSize2DRect",
2127 _textureSize(gpu_shader4_rect
, glsl_type::ivec2_type
, glsl_type::sampler2DRect_type
),
2128 _textureSize(gpu_shader4_rect_integer
, glsl_type::ivec2_type
, glsl_type::isampler2DRect_type
),
2129 _textureSize(gpu_shader4_rect_integer
, glsl_type::ivec2_type
, glsl_type::usampler2DRect_type
),
2132 add_function("textureSizeBuffer",
2133 _textureSize(gpu_shader4_tbo
, glsl_type::int_type
, glsl_type::samplerBuffer_type
),
2134 _textureSize(gpu_shader4_tbo_integer
, glsl_type::int_type
, glsl_type::isamplerBuffer_type
),
2135 _textureSize(gpu_shader4_tbo_integer
, glsl_type::int_type
, glsl_type::usamplerBuffer_type
),
2138 add_function("textureSamples",
2139 _textureSamples(shader_samples
, glsl_type::sampler2DMS_type
),
2140 _textureSamples(shader_samples
, glsl_type::isampler2DMS_type
),
2141 _textureSamples(shader_samples
, glsl_type::usampler2DMS_type
),
2143 _textureSamples(shader_samples
, glsl_type::sampler2DMSArray_type
),
2144 _textureSamples(shader_samples
, glsl_type::isampler2DMSArray_type
),
2145 _textureSamples(shader_samples
, glsl_type::usampler2DMSArray_type
),
2148 add_function("texture",
2149 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
2150 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
2151 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
2153 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
2154 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
2155 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
2157 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
2158 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
2159 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
2161 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
2162 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
2163 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
2165 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
2166 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
2167 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
2169 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
2170 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
2171 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
2173 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
2174 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
2175 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
2177 _texture(ir_tex
, texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
),
2178 _texture(ir_tex
, texture_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
),
2179 _texture(ir_tex
, texture_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
),
2181 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
2182 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
2183 /* samplerCubeArrayShadow is special; it has an extra parameter
2184 * for the shadow comparator since there is no vec5 type.
2186 _textureCubeArrayShadow(ir_tex
, texture_cube_map_array
, glsl_type::samplerCubeArrayShadow_type
),
2188 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
2189 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
),
2190 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
),
2192 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
),
2194 _texture(ir_tex
, texture_external_es3
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec2_type
),
2196 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
2197 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
2198 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
2200 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
2201 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
2202 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
2204 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
2205 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
2206 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
2208 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
2209 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
2210 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
2212 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
2213 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
2214 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
2216 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
2217 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
2218 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
2220 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
2221 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
2222 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
2224 _texture(ir_txb
, derivatives_texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
),
2225 _texture(ir_txb
, derivatives_texture_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
),
2226 _texture(ir_txb
, derivatives_texture_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
),
2228 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
2229 _texture(ir_tex
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
2230 _texture(ir_txb
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
2232 _textureCubeArrayShadow(ir_tex
, v130_or_gpu_shader4_and_tex_cube_map_array
, glsl_type::samplerCubeArrayShadow_type
),
2233 _textureCubeArrayShadow(ir_txb
, v130_or_gpu_shader4_and_tex_cube_map_array
, glsl_type::samplerCubeArrayShadow_type
),
2236 add_function("textureLod",
2237 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
2238 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
2239 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
2241 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
2242 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
2243 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
2245 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
2246 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
2247 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
2249 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
2250 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
2251 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
2253 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
2254 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
2256 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
2257 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
2258 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
2260 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
2261 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
2262 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
2264 _texture(ir_txl
, texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
),
2265 _texture(ir_txl
, texture_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
),
2266 _texture(ir_txl
, texture_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
),
2268 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
2269 _texture(ir_txl
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
2270 _texture(ir_txl
, v130_or_gpu_shader4_and_tex_shadow_lod
, glsl_type::float_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
2271 _textureCubeArrayShadow(ir_txl
, v130_or_gpu_shader4_and_tex_cube_map_array
, glsl_type::samplerCubeArrayShadow_type
),
2274 add_function("textureOffset",
2275 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2276 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2277 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2279 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2280 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2281 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2283 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2284 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2285 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2287 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2288 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2289 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2291 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2293 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2294 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2296 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2297 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2298 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2300 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2301 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2302 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2304 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2305 /* The next one was forgotten in GLSL 1.30 spec. It's from
2306 * EXT_gpu_shader4 originally. It was added in 4.30 with the
2307 * wrong syntax. This was corrected in 4.40. 4.30 indicates
2308 * that it was intended to be included previously, so allow it
2311 _texture(ir_tex
, v130_desktop
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
2313 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2314 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2315 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2317 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2318 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2319 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2321 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2322 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2323 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2325 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2326 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2328 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2329 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2330 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2332 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2333 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2334 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2336 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2337 _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
),
2338 _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
),
2341 add_function("texture1DOffset",
2342 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2343 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2344 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2345 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2346 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2347 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2350 add_function("texture2DOffset",
2351 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2352 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2353 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2354 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2355 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2356 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2359 add_function("texture3DOffset",
2360 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2361 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2362 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2363 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2364 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2365 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2368 add_function("texture2DRectOffset",
2369 _texture(ir_tex
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2370 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2371 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2374 add_function("shadow2DRectOffset",
2375 _texture(ir_tex
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2378 add_function("shadow1DOffset",
2379 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2380 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2383 add_function("shadow2DOffset",
2384 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2385 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2388 add_function("texture1DArrayOffset",
2389 _texture(ir_tex
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2390 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2391 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2392 _texture(ir_txb
, gpu_shader4_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2393 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2394 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2397 add_function("texture2DArrayOffset",
2398 _texture(ir_tex
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2399 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2400 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2401 _texture(ir_txb
, gpu_shader4_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2402 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2403 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2406 add_function("shadow1DArrayOffset",
2407 _texture(ir_tex
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2408 _texture(ir_txb
, gpu_shader4_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2411 add_function("shadow2DArrayOffset",
2412 _texture(ir_tex
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
2415 add_function("textureProj",
2416 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2417 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2418 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2419 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2420 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2421 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2423 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2424 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2425 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2426 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2427 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2428 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2430 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2431 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2432 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2434 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2435 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2437 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2438 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2439 _texture(ir_tex
, texture_external_es3
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2440 _texture(ir_tex
, texture_external_es3
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2442 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2443 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2444 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2445 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2447 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2449 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2450 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2451 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2452 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2453 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2454 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2456 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2457 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2458 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2459 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2460 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2461 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2463 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2464 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2465 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2467 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2468 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2471 add_function("texelFetch",
2472 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::int_type
),
2473 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::int_type
),
2474 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::int_type
),
2476 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::ivec2_type
),
2477 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::ivec2_type
),
2478 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::ivec2_type
),
2480 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::ivec3_type
),
2481 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::ivec3_type
),
2482 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::ivec3_type
),
2484 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::ivec2_type
),
2485 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::ivec2_type
),
2486 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::ivec2_type
),
2488 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::ivec2_type
),
2489 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::ivec2_type
),
2490 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::ivec2_type
),
2492 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::ivec3_type
),
2493 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::ivec3_type
),
2494 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::ivec3_type
),
2496 _texelFetch(texture_buffer
, glsl_type::vec4_type
, glsl_type::samplerBuffer_type
, glsl_type::int_type
),
2497 _texelFetch(texture_buffer
, glsl_type::ivec4_type
, glsl_type::isamplerBuffer_type
, glsl_type::int_type
),
2498 _texelFetch(texture_buffer
, glsl_type::uvec4_type
, glsl_type::usamplerBuffer_type
, glsl_type::int_type
),
2500 _texelFetch(texture_multisample
, glsl_type::vec4_type
, glsl_type::sampler2DMS_type
, glsl_type::ivec2_type
),
2501 _texelFetch(texture_multisample
, glsl_type::ivec4_type
, glsl_type::isampler2DMS_type
, glsl_type::ivec2_type
),
2502 _texelFetch(texture_multisample
, glsl_type::uvec4_type
, glsl_type::usampler2DMS_type
, glsl_type::ivec2_type
),
2504 _texelFetch(texture_multisample_array
, glsl_type::vec4_type
, glsl_type::sampler2DMSArray_type
, glsl_type::ivec3_type
),
2505 _texelFetch(texture_multisample_array
, glsl_type::ivec4_type
, glsl_type::isampler2DMSArray_type
, glsl_type::ivec3_type
),
2506 _texelFetch(texture_multisample_array
, glsl_type::uvec4_type
, glsl_type::usampler2DMSArray_type
, glsl_type::ivec3_type
),
2508 _texelFetch(texture_external_es3
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::ivec2_type
),
2512 add_function("texelFetch1D",
2513 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::int_type
),
2514 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::int_type
),
2515 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::int_type
),
2518 add_function("texelFetch2D",
2519 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::ivec2_type
),
2520 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::ivec2_type
),
2521 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::ivec2_type
),
2524 add_function("texelFetch3D",
2525 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::ivec3_type
),
2526 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::ivec3_type
),
2527 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::ivec3_type
),
2530 add_function("texelFetch2DRect",
2531 _texelFetch(gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::ivec2_type
),
2532 _texelFetch(gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::ivec2_type
),
2533 _texelFetch(gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::ivec2_type
),
2536 add_function("texelFetch1DArray",
2537 _texelFetch(gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::ivec2_type
),
2538 _texelFetch(gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::ivec2_type
),
2539 _texelFetch(gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::ivec2_type
),
2542 add_function("texelFetch2DArray",
2543 _texelFetch(gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::ivec3_type
),
2544 _texelFetch(gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::ivec3_type
),
2545 _texelFetch(gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::ivec3_type
),
2548 add_function("texelFetchBuffer",
2549 _texelFetch(gpu_shader4_tbo
, glsl_type::vec4_type
, glsl_type::samplerBuffer_type
, glsl_type::int_type
),
2550 _texelFetch(gpu_shader4_tbo_integer
, glsl_type::ivec4_type
, glsl_type::isamplerBuffer_type
, glsl_type::int_type
),
2551 _texelFetch(gpu_shader4_tbo_integer
, glsl_type::uvec4_type
, glsl_type::usamplerBuffer_type
, glsl_type::int_type
),
2554 add_function("texelFetchOffset",
2555 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2556 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2557 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2559 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2560 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2561 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2563 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2564 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2565 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2567 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2568 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2569 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2571 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2572 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2573 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2575 _texelFetch(v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2576 _texelFetch(v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2577 _texelFetch(v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2581 add_function("texelFetch1DOffset",
2582 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2583 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2584 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::int_type
, glsl_type::int_type
),
2587 add_function("texelFetch2DOffset",
2588 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2589 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2590 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2593 add_function("texelFetch3DOffset",
2594 _texelFetch(gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2595 _texelFetch(gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2596 _texelFetch(gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::ivec3_type
, glsl_type::ivec3_type
),
2599 add_function("texelFetch2DRectOffset",
2600 _texelFetch(gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2601 _texelFetch(gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2602 _texelFetch(gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::ivec2_type
, glsl_type::ivec2_type
),
2605 add_function("texelFetch1DArrayOffset",
2606 _texelFetch(gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2607 _texelFetch(gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2608 _texelFetch(gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::ivec2_type
, glsl_type::int_type
),
2611 add_function("texelFetch2DArrayOffset",
2612 _texelFetch(gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2613 _texelFetch(gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2614 _texelFetch(gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::ivec3_type
, glsl_type::ivec2_type
),
2617 add_function("textureProjOffset",
2618 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2619 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2620 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2621 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2622 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2623 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2625 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2626 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2627 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2628 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2629 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2630 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2632 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2633 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2634 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2636 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2637 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2639 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2640 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2641 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2642 _texture(ir_tex
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2643 _texture(ir_tex
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2644 _texture(ir_tex
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2646 _texture(ir_tex
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2648 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2649 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2650 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2651 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2652 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2653 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2655 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2656 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2657 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2658 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2659 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2660 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2662 _texture(ir_txb
, v130_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2663 _texture(ir_txb
, v130_derivatives_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2664 _texture(ir_txb
, v130_derivatives_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2666 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2667 _texture(ir_txb
, v130_derivatives_only
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2670 add_function("texture1DProjOffset",
2671 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2672 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2673 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2674 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2675 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2676 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2677 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2678 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2679 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2680 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2681 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2682 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2685 add_function("texture2DProjOffset",
2686 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2687 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2688 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2689 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2690 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2691 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2692 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2693 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2694 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2695 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2696 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2697 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2700 add_function("texture3DProjOffset",
2701 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2702 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2703 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2704 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2705 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2706 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2709 add_function("shadow1DProjOffset",
2710 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2711 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2714 add_function("shadow2DProjOffset",
2715 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2716 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2719 add_function("texture2DRectProjOffset",
2720 _texture(ir_tex
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2721 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2722 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2723 _texture(ir_tex
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2724 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2725 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2728 add_function("shadow2DRectProjOffset",
2729 _texture(ir_tex
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2732 add_function("textureLodOffset",
2733 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2734 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2735 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2737 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2738 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2739 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2741 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2742 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2743 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2745 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2746 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2748 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2749 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2750 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2752 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2753 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2754 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2756 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2757 _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
),
2760 add_function("texture1DLodOffset",
2761 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2762 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2763 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2766 add_function("texture2DLodOffset",
2767 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2768 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2769 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2772 add_function("texture3DLodOffset",
2773 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2774 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2775 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2778 add_function("shadow1DLodOffset",
2779 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2782 add_function("shadow2DLodOffset",
2783 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2786 add_function("texture1DArrayLodOffset",
2787 _texture(ir_txl
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2788 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2789 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2792 add_function("texture2DArrayLodOffset",
2793 _texture(ir_txl
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2794 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2795 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2798 add_function("shadow1DArrayLodOffset",
2799 _texture(ir_txl
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2802 add_function("textureProjLod",
2803 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2804 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2805 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
2806 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2807 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2808 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2810 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2811 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2812 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
2813 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2814 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2815 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2817 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2818 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2819 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2821 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2822 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
2825 add_function("textureProjLodOffset",
2826 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2827 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2828 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2829 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2830 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2831 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2833 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2834 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2835 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2836 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2837 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2838 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2840 _texture(ir_txl
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2841 _texture(ir_txl
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2842 _texture(ir_txl
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2844 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2845 _texture(ir_txl
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2848 add_function("texture1DProjLodOffset",
2849 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2850 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2851 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
2852 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2853 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2854 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2857 add_function("texture2DProjLodOffset",
2858 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2859 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2860 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
2861 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2862 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2863 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2866 add_function("texture3DProjLodOffset",
2867 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2868 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2869 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2872 add_function("shadow1DProjLodOffset",
2873 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2876 add_function("shadow2DProjLodOffset",
2877 _texture(ir_txl
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
2880 add_function("textureGrad",
2881 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
2882 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
2883 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
2885 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
2886 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
2887 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
2889 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
2890 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
2891 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
2893 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
2894 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
2895 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
2897 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
2898 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
),
2899 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
),
2901 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
),
2903 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
2904 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
2905 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
2907 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
2908 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
2909 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
2911 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
2912 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
2913 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
2915 _texture(ir_txd
, texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
),
2916 _texture(ir_txd
, texture_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
),
2917 _texture(ir_txd
, texture_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
),
2919 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
2920 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
2923 add_function("textureGradOffset",
2924 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2925 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2926 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2928 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2929 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2930 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2932 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2933 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2934 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2936 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2937 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2938 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2940 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2942 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2943 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2945 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2946 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2947 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2949 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2950 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2951 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2953 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2954 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
2957 add_function("texture1DGradOffset",
2958 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2959 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2960 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
, TEX_OFFSET
),
2963 add_function("texture2DGradOffset",
2964 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2965 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2966 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2969 add_function("texture3DGradOffset",
2970 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2971 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2972 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2975 add_function("texture2DRectGradOffset",
2976 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2977 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2978 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2981 add_function("shadow2DRectGradOffset",
2982 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2985 add_function("shadow1DGradOffset",
2986 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2989 add_function("shadow2DGradOffset",
2990 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
2993 add_function("texture1DArrayGradOffset",
2994 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2995 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2996 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
, TEX_OFFSET
),
2999 add_function("texture2DArrayGradOffset",
3000 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3001 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3002 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3005 add_function("shadow1DArrayGradOffset",
3006 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3009 add_function("shadow2DArrayGradOffset",
3010 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
, TEX_OFFSET
),
3013 add_function("textureProjGrad",
3014 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3015 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3016 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3017 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3018 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3019 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3021 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3022 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3023 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3024 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3025 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3026 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3028 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3029 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3030 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3032 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3033 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3034 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3035 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3036 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3037 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3039 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3041 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3042 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3045 add_function("textureProjGradOffset",
3046 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3047 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3048 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3049 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3050 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3051 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3053 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3054 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3055 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3056 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3057 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3058 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3060 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3061 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3062 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3064 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3065 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3066 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3067 _texture(ir_txd
, v130
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3068 _texture(ir_txd
, v130
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3069 _texture(ir_txd
, v130
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3071 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3073 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3074 _texture(ir_txd
, v130
, glsl_type::float_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3077 add_function("texture1DProjGradOffset",
3078 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3079 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3080 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
| TEX_OFFSET
),
3081 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3082 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3083 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3086 add_function("texture2DProjGradOffset",
3087 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3088 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3089 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3090 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3091 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3092 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3095 add_function("texture3DProjGradOffset",
3096 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3097 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3098 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3101 add_function("texture2DRectProjGradOffset",
3102 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3103 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3104 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
| TEX_OFFSET
),
3105 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3106 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3107 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3110 add_function("shadow2DRectProjGradOffset",
3111 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3114 add_function("shadow1DProjGradOffset",
3115 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3118 add_function("shadow2DProjGradOffset",
3119 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
| TEX_OFFSET
),
3122 add_function("EmitVertex", _EmitVertex(), NULL
);
3123 add_function("EndPrimitive", _EndPrimitive(), NULL
);
3124 add_function("EmitStreamVertex",
3125 _EmitStreamVertex(gs_streams
, glsl_type::uint_type
),
3126 _EmitStreamVertex(gs_streams
, glsl_type::int_type
),
3128 add_function("EndStreamPrimitive",
3129 _EndStreamPrimitive(gs_streams
, glsl_type::uint_type
),
3130 _EndStreamPrimitive(gs_streams
, glsl_type::int_type
),
3132 add_function("barrier", _barrier(), NULL
);
3134 add_function("textureQueryLOD",
3135 _textureQueryLod(texture_query_lod
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3136 _textureQueryLod(texture_query_lod
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3137 _textureQueryLod(texture_query_lod
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3139 _textureQueryLod(texture_query_lod
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3140 _textureQueryLod(texture_query_lod
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3141 _textureQueryLod(texture_query_lod
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3143 _textureQueryLod(texture_query_lod
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3144 _textureQueryLod(texture_query_lod
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3145 _textureQueryLod(texture_query_lod
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3147 _textureQueryLod(texture_query_lod
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3148 _textureQueryLod(texture_query_lod
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3149 _textureQueryLod(texture_query_lod
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3151 _textureQueryLod(texture_query_lod
, glsl_type::sampler1DArray_type
, glsl_type::float_type
),
3152 _textureQueryLod(texture_query_lod
, glsl_type::isampler1DArray_type
, glsl_type::float_type
),
3153 _textureQueryLod(texture_query_lod
, glsl_type::usampler1DArray_type
, glsl_type::float_type
),
3155 _textureQueryLod(texture_query_lod
, glsl_type::sampler2DArray_type
, glsl_type::vec2_type
),
3156 _textureQueryLod(texture_query_lod
, glsl_type::isampler2DArray_type
, glsl_type::vec2_type
),
3157 _textureQueryLod(texture_query_lod
, glsl_type::usampler2DArray_type
, glsl_type::vec2_type
),
3159 _textureQueryLod(texture_query_lod
, glsl_type::samplerCubeArray_type
, glsl_type::vec3_type
),
3160 _textureQueryLod(texture_query_lod
, glsl_type::isamplerCubeArray_type
, glsl_type::vec3_type
),
3161 _textureQueryLod(texture_query_lod
, glsl_type::usamplerCubeArray_type
, glsl_type::vec3_type
),
3163 _textureQueryLod(texture_query_lod
, glsl_type::sampler1DShadow_type
, glsl_type::float_type
),
3164 _textureQueryLod(texture_query_lod
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
),
3165 _textureQueryLod(texture_query_lod
, glsl_type::samplerCubeShadow_type
, glsl_type::vec3_type
),
3166 _textureQueryLod(texture_query_lod
, glsl_type::sampler1DArrayShadow_type
, glsl_type::float_type
),
3167 _textureQueryLod(texture_query_lod
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec2_type
),
3168 _textureQueryLod(texture_query_lod
, glsl_type::samplerCubeArrayShadow_type
, glsl_type::vec3_type
),
3171 add_function("textureQueryLod",
3172 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3173 _textureQueryLod(v400_derivatives_only
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3174 _textureQueryLod(v400_derivatives_only
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3176 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3177 _textureQueryLod(v400_derivatives_only
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3178 _textureQueryLod(v400_derivatives_only
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3180 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3181 _textureQueryLod(v400_derivatives_only
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3182 _textureQueryLod(v400_derivatives_only
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3184 _textureQueryLod(v400_derivatives_only
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3185 _textureQueryLod(v400_derivatives_only
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3186 _textureQueryLod(v400_derivatives_only
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3188 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler1DArray_type
, glsl_type::float_type
),
3189 _textureQueryLod(v400_derivatives_only
, glsl_type::isampler1DArray_type
, glsl_type::float_type
),
3190 _textureQueryLod(v400_derivatives_only
, glsl_type::usampler1DArray_type
, glsl_type::float_type
),
3192 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler2DArray_type
, glsl_type::vec2_type
),
3193 _textureQueryLod(v400_derivatives_only
, glsl_type::isampler2DArray_type
, glsl_type::vec2_type
),
3194 _textureQueryLod(v400_derivatives_only
, glsl_type::usampler2DArray_type
, glsl_type::vec2_type
),
3196 _textureQueryLod(v400_derivatives_only
, glsl_type::samplerCubeArray_type
, glsl_type::vec3_type
),
3197 _textureQueryLod(v400_derivatives_only
, glsl_type::isamplerCubeArray_type
, glsl_type::vec3_type
),
3198 _textureQueryLod(v400_derivatives_only
, glsl_type::usamplerCubeArray_type
, glsl_type::vec3_type
),
3200 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler1DShadow_type
, glsl_type::float_type
),
3201 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
),
3202 _textureQueryLod(v400_derivatives_only
, glsl_type::samplerCubeShadow_type
, glsl_type::vec3_type
),
3203 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler1DArrayShadow_type
, glsl_type::float_type
),
3204 _textureQueryLod(v400_derivatives_only
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec2_type
),
3205 _textureQueryLod(v400_derivatives_only
, glsl_type::samplerCubeArrayShadow_type
, glsl_type::vec3_type
),
3208 add_function("textureQueryLevels",
3209 _textureQueryLevels(texture_query_levels
, glsl_type::sampler1D_type
),
3210 _textureQueryLevels(texture_query_levels
, glsl_type::sampler2D_type
),
3211 _textureQueryLevels(texture_query_levels
, glsl_type::sampler3D_type
),
3212 _textureQueryLevels(texture_query_levels
, glsl_type::samplerCube_type
),
3213 _textureQueryLevels(texture_query_levels
, glsl_type::sampler1DArray_type
),
3214 _textureQueryLevels(texture_query_levels
, glsl_type::sampler2DArray_type
),
3215 _textureQueryLevels(texture_query_levels
, glsl_type::samplerCubeArray_type
),
3216 _textureQueryLevels(texture_query_levels
, glsl_type::sampler1DShadow_type
),
3217 _textureQueryLevels(texture_query_levels
, glsl_type::sampler2DShadow_type
),
3218 _textureQueryLevels(texture_query_levels
, glsl_type::samplerCubeShadow_type
),
3219 _textureQueryLevels(texture_query_levels
, glsl_type::sampler1DArrayShadow_type
),
3220 _textureQueryLevels(texture_query_levels
, glsl_type::sampler2DArrayShadow_type
),
3221 _textureQueryLevels(texture_query_levels
, glsl_type::samplerCubeArrayShadow_type
),
3223 _textureQueryLevels(texture_query_levels
, glsl_type::isampler1D_type
),
3224 _textureQueryLevels(texture_query_levels
, glsl_type::isampler2D_type
),
3225 _textureQueryLevels(texture_query_levels
, glsl_type::isampler3D_type
),
3226 _textureQueryLevels(texture_query_levels
, glsl_type::isamplerCube_type
),
3227 _textureQueryLevels(texture_query_levels
, glsl_type::isampler1DArray_type
),
3228 _textureQueryLevels(texture_query_levels
, glsl_type::isampler2DArray_type
),
3229 _textureQueryLevels(texture_query_levels
, glsl_type::isamplerCubeArray_type
),
3231 _textureQueryLevels(texture_query_levels
, glsl_type::usampler1D_type
),
3232 _textureQueryLevels(texture_query_levels
, glsl_type::usampler2D_type
),
3233 _textureQueryLevels(texture_query_levels
, glsl_type::usampler3D_type
),
3234 _textureQueryLevels(texture_query_levels
, glsl_type::usamplerCube_type
),
3235 _textureQueryLevels(texture_query_levels
, glsl_type::usampler1DArray_type
),
3236 _textureQueryLevels(texture_query_levels
, glsl_type::usampler2DArray_type
),
3237 _textureQueryLevels(texture_query_levels
, glsl_type::usamplerCubeArray_type
),
3241 add_function("textureSamplesIdenticalEXT",
3242 _textureSamplesIdentical(texture_samples_identical
, glsl_type::sampler2DMS_type
, glsl_type::ivec2_type
),
3243 _textureSamplesIdentical(texture_samples_identical
, glsl_type::isampler2DMS_type
, glsl_type::ivec2_type
),
3244 _textureSamplesIdentical(texture_samples_identical
, glsl_type::usampler2DMS_type
, glsl_type::ivec2_type
),
3246 _textureSamplesIdentical(texture_samples_identical_array
, glsl_type::sampler2DMSArray_type
, glsl_type::ivec3_type
),
3247 _textureSamplesIdentical(texture_samples_identical_array
, glsl_type::isampler2DMSArray_type
, glsl_type::ivec3_type
),
3248 _textureSamplesIdentical(texture_samples_identical_array
, glsl_type::usampler2DMSArray_type
, glsl_type::ivec3_type
),
3251 add_function("texture1D",
3252 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3253 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3254 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3255 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3256 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3257 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3260 add_function("texture1DArray",
3261 _texture(ir_tex
, texture_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
3262 _texture(ir_txb
, texture_array_derivs_only
,glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
3263 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
3264 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
3265 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
3266 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
3269 add_function("texture1DProj",
3270 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3271 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3272 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3273 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3274 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3275 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3276 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3277 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3278 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3279 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3280 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3281 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3284 add_function("texture1DLod",
3285 _texture(ir_txl
, tex1d_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3286 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3287 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3290 add_function("texture1DArrayLod",
3291 _texture(ir_txl
, texture_array_lod
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
3292 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
3293 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
3296 add_function("texture1DProjLod",
3297 _texture(ir_txl
, tex1d_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3298 _texture(ir_txl
, tex1d_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3299 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3300 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3301 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3302 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3305 add_function("texture2D",
3306 _texture(ir_tex
, always_available
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3307 _texture(ir_txb
, derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3308 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3309 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3310 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3311 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3312 _texture(ir_tex
, texture_external
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec2_type
),
3315 add_function("texture2DArray",
3316 _texture(ir_tex
, texture_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
3317 _texture(ir_txb
, texture_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
3318 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
3319 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
3320 _texture(ir_tex
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
3321 _texture(ir_txb
, gpu_shader4_array_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
3324 add_function("texture2DProj",
3325 _texture(ir_tex
, always_available
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3326 _texture(ir_tex
, always_available
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3327 _texture(ir_txb
, derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3328 _texture(ir_txb
, derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3329 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3330 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3331 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3332 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3333 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3334 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3335 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3336 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3337 _texture(ir_tex
, texture_external
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3338 _texture(ir_tex
, texture_external
, glsl_type::vec4_type
, glsl_type::samplerExternalOES_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3341 add_function("texture2DLod",
3342 _texture(ir_txl
, lod_exists_in_stage
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3343 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3344 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3347 add_function("texture2DArrayLod",
3348 _texture(ir_txl
, texture_array_lod
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
3349 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
3350 _texture(ir_txl
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
3353 add_function("texture2DProjLod",
3354 _texture(ir_txl
, lod_exists_in_stage
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3355 _texture(ir_txl
, lod_exists_in_stage
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3356 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3357 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3358 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3359 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3362 add_function("texture3D",
3363 _texture(ir_tex
, tex3d
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3364 _texture(ir_txb
, derivatives_tex3d
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3365 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3366 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3367 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3368 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3371 add_function("texture3DProj",
3372 _texture(ir_tex
, tex3d
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3373 _texture(ir_txb
, derivatives_tex3d
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3374 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3375 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3376 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3377 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3380 add_function("texture3DLod",
3381 _texture(ir_txl
, tex3d_lod
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3382 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3383 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3386 add_function("texture3DProjLod",
3387 _texture(ir_txl
, tex3d_lod
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3388 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3389 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3392 add_function("textureCube",
3393 _texture(ir_tex
, always_available
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3394 _texture(ir_txb
, derivatives_only
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3395 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3396 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3397 _texture(ir_tex
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3398 _texture(ir_txb
, gpu_shader4_integer_derivs_only
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3401 add_function("textureCubeLod",
3402 _texture(ir_txl
, lod_exists_in_stage
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3403 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3404 _texture(ir_txl
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3407 add_function("texture2DRect",
3408 _texture(ir_tex
, texture_rectangle
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
3409 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
),
3410 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
),
3413 add_function("texture2DRectProj",
3414 _texture(ir_tex
, texture_rectangle
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3415 _texture(ir_tex
, texture_rectangle
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3416 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3417 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3418 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3419 _texture(ir_tex
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3422 add_function("shadow1D",
3423 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
3424 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
3427 add_function("shadow1DArray",
3428 _texture(ir_tex
, texture_array
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
3429 _texture(ir_txb
, texture_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
3432 add_function("shadow2D",
3433 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
3434 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
3437 add_function("shadow2DArray",
3438 _texture(ir_tex
, texture_array
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
3439 _texture(ir_txb
, texture_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
3442 add_function("shadow1DProj",
3443 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3444 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3447 add_function("shadow2DArray",
3448 _texture(ir_tex
, texture_array
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
3449 _texture(ir_txb
, texture_array_derivs_only
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
3452 add_function("shadowCube",
3453 _texture(ir_tex
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
3454 _texture(ir_txb
, gpu_shader4_derivs_only
, glsl_type::vec4_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
3457 add_function("shadow2DProj",
3458 _texture(ir_tex
, v110
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3459 _texture(ir_txb
, v110_derivatives_only
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3462 add_function("shadow1DLod",
3463 _texture(ir_txl
, v110_lod
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
3466 add_function("shadow2DLod",
3467 _texture(ir_txl
, v110_lod
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
3470 add_function("shadow1DArrayLod",
3471 _texture(ir_txl
, texture_array_lod
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
3474 add_function("shadow1DProjLod",
3475 _texture(ir_txl
, v110_lod
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3478 add_function("shadow2DProjLod",
3479 _texture(ir_txl
, v110_lod
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3482 add_function("shadow2DRect",
3483 _texture(ir_tex
, texture_rectangle
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
),
3486 add_function("shadow2DRectProj",
3487 _texture(ir_tex
, texture_rectangle
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3490 add_function("texture1DGradARB",
3491 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3494 add_function("texture1DProjGradARB",
3495 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3496 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3499 add_function("texture2DGradARB",
3500 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3503 add_function("texture2DProjGradARB",
3504 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3505 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3508 add_function("texture3DGradARB",
3509 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3512 add_function("texture3DProjGradARB",
3513 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3516 add_function("textureCubeGradARB",
3517 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3520 add_function("shadow1DGradARB",
3521 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
3524 add_function("shadow1DProjGradARB",
3525 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3528 add_function("shadow2DGradARB",
3529 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
3532 add_function("shadow2DProjGradARB",
3533 _texture(ir_txd
, shader_texture_lod
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3536 add_function("texture2DRectGradARB",
3537 _texture(ir_txd
, shader_texture_lod_and_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
3540 add_function("texture2DRectProjGradARB",
3541 _texture(ir_txd
, shader_texture_lod_and_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3542 _texture(ir_txd
, shader_texture_lod_and_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3545 add_function("shadow2DRectGradARB",
3546 _texture(ir_txd
, shader_texture_lod_and_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
),
3549 add_function("shadow2DRectProjGradARB",
3550 _texture(ir_txd
, shader_texture_lod_and_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3553 add_function("texture4",
3554 _texture(ir_tg4
, texture_texture4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3557 add_function("texture1DGrad",
3558 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::float_type
),
3559 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::float_type
),
3560 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::float_type
),
3563 add_function("texture1DProjGrad",
3564 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3565 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3566 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3567 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3568 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec2_type
, TEX_PROJECT
),
3569 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler1D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3572 add_function("texture1DArrayGrad",
3573 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArray_type
, glsl_type::vec2_type
),
3574 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler1DArray_type
, glsl_type::vec2_type
),
3575 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler1DArray_type
, glsl_type::vec2_type
),
3578 add_function("texture2DGrad",
3579 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3580 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3581 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3584 add_function("texture2DProjGrad",
3585 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3586 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3587 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3588 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3589 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3590 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3593 add_function("texture2DArrayGrad",
3594 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
3595 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
3596 _texture(ir_txd
, gpu_shader4_array_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
3599 add_function("texture3DGrad",
3600 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec3_type
),
3601 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec3_type
),
3602 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec3_type
),
3605 add_function("texture3DProjGrad",
3606 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3607 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3608 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usampler3D_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3611 add_function("textureCubeGrad",
3612 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3613 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3614 _texture(ir_txd
, gpu_shader4_integer
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3617 add_function("shadow1DGrad",
3618 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec3_type
),
3621 add_function("shadow1DProjGrad",
3622 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler1DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3625 add_function("shadow1DArrayGrad",
3626 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler1DArrayShadow_type
, glsl_type::vec3_type
),
3629 add_function("shadow2DGrad",
3630 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec3_type
),
3633 add_function("shadow2DProjGrad",
3634 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3637 add_function("shadow2DArrayGrad",
3638 _texture(ir_txd
, gpu_shader4_array
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec4_type
),
3641 add_function("texture2DRectGrad",
3642 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
3643 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
),
3644 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
),
3647 add_function("texture2DRectProjGrad",
3648 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3649 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3650 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3651 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3652 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec3_type
, TEX_PROJECT
),
3653 _texture(ir_txd
, gpu_shader4_rect_integer
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3656 add_function("shadow2DRectGrad",
3657 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec3_type
),
3660 add_function("shadow2DRectProjGrad",
3661 _texture(ir_txd
, gpu_shader4_rect
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec4_type
, TEX_PROJECT
),
3664 add_function("shadowCubeGrad",
3665 _texture(ir_txd
, gpu_shader4
, glsl_type::vec4_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec4_type
),
3668 add_function("textureGather",
3669 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
),
3670 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
),
3671 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
),
3673 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
),
3674 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
),
3675 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
),
3677 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
),
3678 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
),
3679 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
),
3681 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
),
3682 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
),
3683 _texture(ir_tg4
, texture_gather_or_es31
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
),
3685 _texture(ir_tg4
, texture_gather_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArray_type
, glsl_type::vec4_type
),
3686 _texture(ir_tg4
, texture_gather_cube_map_array
, glsl_type::ivec4_type
, glsl_type::isamplerCubeArray_type
, glsl_type::vec4_type
),
3687 _texture(ir_tg4
, texture_gather_cube_map_array
, glsl_type::uvec4_type
, glsl_type::usamplerCubeArray_type
, glsl_type::vec4_type
),
3689 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3690 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3691 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3693 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3694 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3695 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_COMPONENT
),
3697 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3698 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3699 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3701 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::samplerCube_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3702 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::ivec4_type
, glsl_type::isamplerCube_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3703 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::uvec4_type
, glsl_type::usamplerCube_type
, glsl_type::vec3_type
, TEX_COMPONENT
),
3705 _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
),
3706 _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
),
3707 _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
),
3709 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
),
3710 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec3_type
),
3711 _texture(ir_tg4
, gpu_shader5_or_es31
, glsl_type::vec4_type
, glsl_type::samplerCubeShadow_type
, glsl_type::vec3_type
),
3712 _texture(ir_tg4
, gpu_shader5_or_OES_texture_cube_map_array
, glsl_type::vec4_type
, glsl_type::samplerCubeArrayShadow_type
, glsl_type::vec4_type
),
3713 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec2_type
),
3716 add_function("textureGatherOffset",
3717 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3718 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3719 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3721 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3722 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3723 _texture(ir_tg4
, texture_gather_only_or_es31
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3725 _texture(ir_tg4
, es31_not_gs5
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
| TEX_COMPONENT
),
3726 _texture(ir_tg4
, es31_not_gs5
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
| TEX_COMPONENT
),
3727 _texture(ir_tg4
, es31_not_gs5
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET
| TEX_COMPONENT
),
3729 _texture(ir_tg4
, es31_not_gs5
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
| TEX_COMPONENT
),
3730 _texture(ir_tg4
, es31_not_gs5
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
| TEX_COMPONENT
),
3731 _texture(ir_tg4
, es31_not_gs5
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET
| TEX_COMPONENT
),
3733 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3734 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3735 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3737 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
),
3738 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
),
3739 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
),
3741 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3742 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3743 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3745 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3746 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3747 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3749 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3750 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3751 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3753 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3754 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3755 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
| TEX_COMPONENT
),
3757 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3758 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET_NONCONST
),
3759 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec2_type
, TEX_OFFSET_NONCONST
),
3761 _texture(ir_tg4
, es31_not_gs5
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
, TEX_OFFSET
),
3762 _texture(ir_tg4
, es31_not_gs5
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET
),
3765 add_function("textureGatherOffsets",
3766 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3767 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3768 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3770 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3771 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3772 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2D_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3774 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
),
3775 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
),
3776 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
),
3778 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3779 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::ivec4_type
, glsl_type::isampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3780 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::uvec4_type
, glsl_type::usampler2DArray_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3782 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3783 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3784 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3786 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3787 _texture(ir_tg4
, gpu_shader5
, glsl_type::ivec4_type
, glsl_type::isampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3788 _texture(ir_tg4
, gpu_shader5
, glsl_type::uvec4_type
, glsl_type::usampler2DRect_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
| TEX_COMPONENT
),
3790 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DShadow_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3791 _texture(ir_tg4
, gpu_shader5_es
, glsl_type::vec4_type
, glsl_type::sampler2DArrayShadow_type
, glsl_type::vec3_type
, TEX_OFFSET_ARRAY
),
3792 _texture(ir_tg4
, gpu_shader5
, glsl_type::vec4_type
, glsl_type::sampler2DRectShadow_type
, glsl_type::vec2_type
, TEX_OFFSET_ARRAY
),
3817 add_function("ldexp",
3818 _ldexp(glsl_type::float_type
, glsl_type::int_type
),
3819 _ldexp(glsl_type::vec2_type
, glsl_type::ivec2_type
),
3820 _ldexp(glsl_type::vec3_type
, glsl_type::ivec3_type
),
3821 _ldexp(glsl_type::vec4_type
, glsl_type::ivec4_type
),
3822 _ldexp(glsl_type::double_type
, glsl_type::int_type
),
3823 _ldexp(glsl_type::dvec2_type
, glsl_type::ivec2_type
),
3824 _ldexp(glsl_type::dvec3_type
, glsl_type::ivec3_type
),
3825 _ldexp(glsl_type::dvec4_type
, glsl_type::ivec4_type
),
3828 add_function("frexp",
3829 _frexp(glsl_type::float_type
, glsl_type::int_type
),
3830 _frexp(glsl_type::vec2_type
, glsl_type::ivec2_type
),
3831 _frexp(glsl_type::vec3_type
, glsl_type::ivec3_type
),
3832 _frexp(glsl_type::vec4_type
, glsl_type::ivec4_type
),
3833 _dfrexp(glsl_type::double_type
, glsl_type::int_type
),
3834 _dfrexp(glsl_type::dvec2_type
, glsl_type::ivec2_type
),
3835 _dfrexp(glsl_type::dvec3_type
, glsl_type::ivec3_type
),
3836 _dfrexp(glsl_type::dvec4_type
, glsl_type::ivec4_type
),
3838 add_function("uaddCarry",
3839 _uaddCarry(glsl_type::uint_type
),
3840 _uaddCarry(glsl_type::uvec2_type
),
3841 _uaddCarry(glsl_type::uvec3_type
),
3842 _uaddCarry(glsl_type::uvec4_type
),
3844 add_function("usubBorrow",
3845 _usubBorrow(glsl_type::uint_type
),
3846 _usubBorrow(glsl_type::uvec2_type
),
3847 _usubBorrow(glsl_type::uvec3_type
),
3848 _usubBorrow(glsl_type::uvec4_type
),
3850 add_function("imulExtended",
3851 _mulExtended(glsl_type::int_type
),
3852 _mulExtended(glsl_type::ivec2_type
),
3853 _mulExtended(glsl_type::ivec3_type
),
3854 _mulExtended(glsl_type::ivec4_type
),
3856 add_function("umulExtended",
3857 _mulExtended(glsl_type::uint_type
),
3858 _mulExtended(glsl_type::uvec2_type
),
3859 _mulExtended(glsl_type::uvec3_type
),
3860 _mulExtended(glsl_type::uvec4_type
),
3862 add_function("interpolateAtCentroid",
3863 _interpolateAtCentroid(glsl_type::float_type
),
3864 _interpolateAtCentroid(glsl_type::vec2_type
),
3865 _interpolateAtCentroid(glsl_type::vec3_type
),
3866 _interpolateAtCentroid(glsl_type::vec4_type
),
3868 add_function("interpolateAtOffset",
3869 _interpolateAtOffset(glsl_type::float_type
),
3870 _interpolateAtOffset(glsl_type::vec2_type
),
3871 _interpolateAtOffset(glsl_type::vec3_type
),
3872 _interpolateAtOffset(glsl_type::vec4_type
),
3874 add_function("interpolateAtSample",
3875 _interpolateAtSample(glsl_type::float_type
),
3876 _interpolateAtSample(glsl_type::vec2_type
),
3877 _interpolateAtSample(glsl_type::vec3_type
),
3878 _interpolateAtSample(glsl_type::vec4_type
),
3881 add_function("atomicCounter",
3882 _atomic_counter_op("__intrinsic_atomic_read",
3883 shader_atomic_counters
),
3885 add_function("atomicCounterIncrement",
3886 _atomic_counter_op("__intrinsic_atomic_increment",
3887 shader_atomic_counters
),
3889 add_function("atomicCounterDecrement",
3890 _atomic_counter_op("__intrinsic_atomic_predecrement",
3891 shader_atomic_counters
),
3894 add_function("atomicCounterAddARB",
3895 _atomic_counter_op1("__intrinsic_atomic_add",
3896 shader_atomic_counter_ops
),
3898 add_function("atomicCounterSubtractARB",
3899 _atomic_counter_op1("__intrinsic_atomic_sub",
3900 shader_atomic_counter_ops
),
3902 add_function("atomicCounterMinARB",
3903 _atomic_counter_op1("__intrinsic_atomic_min",
3904 shader_atomic_counter_ops
),
3906 add_function("atomicCounterMaxARB",
3907 _atomic_counter_op1("__intrinsic_atomic_max",
3908 shader_atomic_counter_ops
),
3910 add_function("atomicCounterAndARB",
3911 _atomic_counter_op1("__intrinsic_atomic_and",
3912 shader_atomic_counter_ops
),
3914 add_function("atomicCounterOrARB",
3915 _atomic_counter_op1("__intrinsic_atomic_or",
3916 shader_atomic_counter_ops
),
3918 add_function("atomicCounterXorARB",
3919 _atomic_counter_op1("__intrinsic_atomic_xor",
3920 shader_atomic_counter_ops
),
3922 add_function("atomicCounterExchangeARB",
3923 _atomic_counter_op1("__intrinsic_atomic_exchange",
3924 shader_atomic_counter_ops
),
3926 add_function("atomicCounterCompSwapARB",
3927 _atomic_counter_op2("__intrinsic_atomic_comp_swap",
3928 shader_atomic_counter_ops
),
3931 add_function("atomicCounterAdd",
3932 _atomic_counter_op1("__intrinsic_atomic_add",
3935 add_function("atomicCounterSubtract",
3936 _atomic_counter_op1("__intrinsic_atomic_sub",
3939 add_function("atomicCounterMin",
3940 _atomic_counter_op1("__intrinsic_atomic_min",
3943 add_function("atomicCounterMax",
3944 _atomic_counter_op1("__intrinsic_atomic_max",
3947 add_function("atomicCounterAnd",
3948 _atomic_counter_op1("__intrinsic_atomic_and",
3951 add_function("atomicCounterOr",
3952 _atomic_counter_op1("__intrinsic_atomic_or",
3955 add_function("atomicCounterXor",
3956 _atomic_counter_op1("__intrinsic_atomic_xor",
3959 add_function("atomicCounterExchange",
3960 _atomic_counter_op1("__intrinsic_atomic_exchange",
3963 add_function("atomicCounterCompSwap",
3964 _atomic_counter_op2("__intrinsic_atomic_comp_swap",
3968 add_function("atomicAdd",
3969 _atomic_op2("__intrinsic_atomic_add",
3970 buffer_atomics_supported
,
3971 glsl_type::uint_type
),
3972 _atomic_op2("__intrinsic_atomic_add",
3973 buffer_atomics_supported
,
3974 glsl_type::int_type
),
3975 _atomic_op2("__intrinsic_atomic_add",
3976 shader_atomic_float_add
,
3977 glsl_type::float_type
),
3979 add_function("atomicMin",
3980 _atomic_op2("__intrinsic_atomic_min",
3981 buffer_atomics_supported
,
3982 glsl_type::uint_type
),
3983 _atomic_op2("__intrinsic_atomic_min",
3984 buffer_atomics_supported
,
3985 glsl_type::int_type
),
3986 _atomic_op2("__intrinsic_atomic_min",
3987 shader_atomic_float_minmax
,
3988 glsl_type::float_type
),
3990 add_function("atomicMax",
3991 _atomic_op2("__intrinsic_atomic_max",
3992 buffer_atomics_supported
,
3993 glsl_type::uint_type
),
3994 _atomic_op2("__intrinsic_atomic_max",
3995 buffer_atomics_supported
,
3996 glsl_type::int_type
),
3997 _atomic_op2("__intrinsic_atomic_max",
3998 shader_atomic_float_minmax
,
3999 glsl_type::float_type
),
4001 add_function("atomicAnd",
4002 _atomic_op2("__intrinsic_atomic_and",
4003 buffer_atomics_supported
,
4004 glsl_type::uint_type
),
4005 _atomic_op2("__intrinsic_atomic_and",
4006 buffer_atomics_supported
,
4007 glsl_type::int_type
),
4009 add_function("atomicOr",
4010 _atomic_op2("__intrinsic_atomic_or",
4011 buffer_atomics_supported
,
4012 glsl_type::uint_type
),
4013 _atomic_op2("__intrinsic_atomic_or",
4014 buffer_atomics_supported
,
4015 glsl_type::int_type
),
4017 add_function("atomicXor",
4018 _atomic_op2("__intrinsic_atomic_xor",
4019 buffer_atomics_supported
,
4020 glsl_type::uint_type
),
4021 _atomic_op2("__intrinsic_atomic_xor",
4022 buffer_atomics_supported
,
4023 glsl_type::int_type
),
4025 add_function("atomicExchange",
4026 _atomic_op2("__intrinsic_atomic_exchange",
4027 buffer_atomics_supported
,
4028 glsl_type::uint_type
),
4029 _atomic_op2("__intrinsic_atomic_exchange",
4030 buffer_atomics_supported
,
4031 glsl_type::int_type
),
4032 _atomic_op2("__intrinsic_atomic_exchange",
4033 shader_atomic_float_exchange
,
4034 glsl_type::float_type
),
4036 add_function("atomicCompSwap",
4037 _atomic_op3("__intrinsic_atomic_comp_swap",
4038 buffer_atomics_supported
,
4039 glsl_type::uint_type
),
4040 _atomic_op3("__intrinsic_atomic_comp_swap",
4041 buffer_atomics_supported
,
4042 glsl_type::int_type
),
4043 _atomic_op3("__intrinsic_atomic_comp_swap",
4044 shader_atomic_float_minmax
,
4045 glsl_type::float_type
),
4048 add_function("min3",
4049 _min3(glsl_type::float_type
),
4050 _min3(glsl_type::vec2_type
),
4051 _min3(glsl_type::vec3_type
),
4052 _min3(glsl_type::vec4_type
),
4054 _min3(glsl_type::int_type
),
4055 _min3(glsl_type::ivec2_type
),
4056 _min3(glsl_type::ivec3_type
),
4057 _min3(glsl_type::ivec4_type
),
4059 _min3(glsl_type::uint_type
),
4060 _min3(glsl_type::uvec2_type
),
4061 _min3(glsl_type::uvec3_type
),
4062 _min3(glsl_type::uvec4_type
),
4065 add_function("max3",
4066 _max3(glsl_type::float_type
),
4067 _max3(glsl_type::vec2_type
),
4068 _max3(glsl_type::vec3_type
),
4069 _max3(glsl_type::vec4_type
),
4071 _max3(glsl_type::int_type
),
4072 _max3(glsl_type::ivec2_type
),
4073 _max3(glsl_type::ivec3_type
),
4074 _max3(glsl_type::ivec4_type
),
4076 _max3(glsl_type::uint_type
),
4077 _max3(glsl_type::uvec2_type
),
4078 _max3(glsl_type::uvec3_type
),
4079 _max3(glsl_type::uvec4_type
),
4082 add_function("mid3",
4083 _mid3(glsl_type::float_type
),
4084 _mid3(glsl_type::vec2_type
),
4085 _mid3(glsl_type::vec3_type
),
4086 _mid3(glsl_type::vec4_type
),
4088 _mid3(glsl_type::int_type
),
4089 _mid3(glsl_type::ivec2_type
),
4090 _mid3(glsl_type::ivec3_type
),
4091 _mid3(glsl_type::ivec4_type
),
4093 _mid3(glsl_type::uint_type
),
4094 _mid3(glsl_type::uvec2_type
),
4095 _mid3(glsl_type::uvec3_type
),
4096 _mid3(glsl_type::uvec4_type
),
4099 add_image_functions(true);
4101 add_function("memoryBarrier",
4102 _memory_barrier("__intrinsic_memory_barrier",
4103 shader_image_load_store
),
4105 add_function("groupMemoryBarrier",
4106 _memory_barrier("__intrinsic_group_memory_barrier",
4109 add_function("memoryBarrierAtomicCounter",
4110 _memory_barrier("__intrinsic_memory_barrier_atomic_counter",
4111 compute_shader_supported
),
4113 add_function("memoryBarrierBuffer",
4114 _memory_barrier("__intrinsic_memory_barrier_buffer",
4115 compute_shader_supported
),
4117 add_function("memoryBarrierImage",
4118 _memory_barrier("__intrinsic_memory_barrier_image",
4119 compute_shader_supported
),
4121 add_function("memoryBarrierShared",
4122 _memory_barrier("__intrinsic_memory_barrier_shared",
4126 add_function("ballotARB", _ballot(), NULL
);
4128 add_function("readInvocationARB",
4129 _read_invocation(glsl_type::float_type
),
4130 _read_invocation(glsl_type::vec2_type
),
4131 _read_invocation(glsl_type::vec3_type
),
4132 _read_invocation(glsl_type::vec4_type
),
4134 _read_invocation(glsl_type::int_type
),
4135 _read_invocation(glsl_type::ivec2_type
),
4136 _read_invocation(glsl_type::ivec3_type
),
4137 _read_invocation(glsl_type::ivec4_type
),
4139 _read_invocation(glsl_type::uint_type
),
4140 _read_invocation(glsl_type::uvec2_type
),
4141 _read_invocation(glsl_type::uvec3_type
),
4142 _read_invocation(glsl_type::uvec4_type
),
4145 add_function("readFirstInvocationARB",
4146 _read_first_invocation(glsl_type::float_type
),
4147 _read_first_invocation(glsl_type::vec2_type
),
4148 _read_first_invocation(glsl_type::vec3_type
),
4149 _read_first_invocation(glsl_type::vec4_type
),
4151 _read_first_invocation(glsl_type::int_type
),
4152 _read_first_invocation(glsl_type::ivec2_type
),
4153 _read_first_invocation(glsl_type::ivec3_type
),
4154 _read_first_invocation(glsl_type::ivec4_type
),
4156 _read_first_invocation(glsl_type::uint_type
),
4157 _read_first_invocation(glsl_type::uvec2_type
),
4158 _read_first_invocation(glsl_type::uvec3_type
),
4159 _read_first_invocation(glsl_type::uvec4_type
),
4162 add_function("clock2x32ARB",
4163 _shader_clock(shader_clock
,
4164 glsl_type::uvec2_type
),
4167 add_function("clockARB",
4168 _shader_clock(shader_clock_int64
,
4169 glsl_type::uint64_t_type
),
4172 add_function("beginInvocationInterlockARB",
4173 _invocation_interlock(
4174 "__intrinsic_begin_invocation_interlock",
4175 supports_arb_fragment_shader_interlock
),
4178 add_function("endInvocationInterlockARB",
4179 _invocation_interlock(
4180 "__intrinsic_end_invocation_interlock",
4181 supports_arb_fragment_shader_interlock
),
4184 add_function("beginInvocationInterlockNV",
4185 _invocation_interlock(
4186 "__intrinsic_begin_invocation_interlock",
4187 supports_nv_fragment_shader_interlock
),
4190 add_function("endInvocationInterlockNV",
4191 _invocation_interlock(
4192 "__intrinsic_end_invocation_interlock",
4193 supports_nv_fragment_shader_interlock
),
4196 add_function("anyInvocationARB",
4197 _vote("__intrinsic_vote_any", vote
),
4200 add_function("allInvocationsARB",
4201 _vote("__intrinsic_vote_all", vote
),
4204 add_function("allInvocationsEqualARB",
4205 _vote("__intrinsic_vote_eq", vote
),
4208 add_function("anyInvocation",
4209 _vote("__intrinsic_vote_any", v460_desktop
),
4212 add_function("allInvocations",
4213 _vote("__intrinsic_vote_all", v460_desktop
),
4216 add_function("allInvocationsEqual",
4217 _vote("__intrinsic_vote_eq", v460_desktop
),
4220 add_function("__builtin_idiv64",
4221 generate_ir::idiv64(mem_ctx
, integer_functions_supported
),
4224 add_function("__builtin_imod64",
4225 generate_ir::imod64(mem_ctx
, integer_functions_supported
),
4228 add_function("__builtin_sign64",
4229 generate_ir::sign64(mem_ctx
, integer_functions_supported
),
4232 add_function("__builtin_udiv64",
4233 generate_ir::udiv64(mem_ctx
, integer_functions_supported
),
4236 add_function("__builtin_umod64",
4237 generate_ir::umod64(mem_ctx
, integer_functions_supported
),
4240 add_function("__builtin_umul64",
4241 generate_ir::umul64(mem_ctx
, integer_functions_supported
),
4252 builtin_builder::add_function(const char *name
, ...)
4256 ir_function
*f
= new(mem_ctx
) ir_function(name
);
4260 ir_function_signature
*sig
= va_arg(ap
, ir_function_signature
*);
4266 stuff
.push_tail(sig
);
4267 validate_ir_tree(&stuff
);
4270 f
->add_signature(sig
);
4274 shader
->symbols
->add_function(f
);
4278 builtin_builder::add_image_function(const char *name
,
4279 const char *intrinsic_name
,
4280 image_prototype_ctr prototype
,
4281 unsigned num_arguments
,
4283 enum ir_intrinsic_id intrinsic_id
)
4285 static const glsl_type
*const types
[] = {
4286 glsl_type::image1D_type
,
4287 glsl_type::image2D_type
,
4288 glsl_type::image3D_type
,
4289 glsl_type::image2DRect_type
,
4290 glsl_type::imageCube_type
,
4291 glsl_type::imageBuffer_type
,
4292 glsl_type::image1DArray_type
,
4293 glsl_type::image2DArray_type
,
4294 glsl_type::imageCubeArray_type
,
4295 glsl_type::image2DMS_type
,
4296 glsl_type::image2DMSArray_type
,
4297 glsl_type::iimage1D_type
,
4298 glsl_type::iimage2D_type
,
4299 glsl_type::iimage3D_type
,
4300 glsl_type::iimage2DRect_type
,
4301 glsl_type::iimageCube_type
,
4302 glsl_type::iimageBuffer_type
,
4303 glsl_type::iimage1DArray_type
,
4304 glsl_type::iimage2DArray_type
,
4305 glsl_type::iimageCubeArray_type
,
4306 glsl_type::iimage2DMS_type
,
4307 glsl_type::iimage2DMSArray_type
,
4308 glsl_type::uimage1D_type
,
4309 glsl_type::uimage2D_type
,
4310 glsl_type::uimage3D_type
,
4311 glsl_type::uimage2DRect_type
,
4312 glsl_type::uimageCube_type
,
4313 glsl_type::uimageBuffer_type
,
4314 glsl_type::uimage1DArray_type
,
4315 glsl_type::uimage2DArray_type
,
4316 glsl_type::uimageCubeArray_type
,
4317 glsl_type::uimage2DMS_type
,
4318 glsl_type::uimage2DMSArray_type
4321 ir_function
*f
= new(mem_ctx
) ir_function(name
);
4323 for (unsigned i
= 0; i
< ARRAY_SIZE(types
); ++i
) {
4324 if ((types
[i
]->sampled_type
!= GLSL_TYPE_FLOAT
||
4325 (flags
& IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
)) &&
4326 (types
[i
]->sampler_dimensionality
== GLSL_SAMPLER_DIM_MS
||
4327 !(flags
& IMAGE_FUNCTION_MS_ONLY
)))
4328 f
->add_signature(_image(prototype
, types
[i
], intrinsic_name
,
4329 num_arguments
, flags
, intrinsic_id
));
4332 shader
->symbols
->add_function(f
);
4336 builtin_builder::add_image_functions(bool glsl
)
4338 const unsigned flags
= (glsl
? IMAGE_FUNCTION_EMIT_STUB
: 0);
4340 add_image_function(glsl
? "imageLoad" : "__intrinsic_image_load",
4341 "__intrinsic_image_load",
4342 &builtin_builder::_image_prototype
, 0,
4343 (flags
| IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE
|
4344 IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
|
4345 IMAGE_FUNCTION_READ_ONLY
),
4346 ir_intrinsic_image_load
);
4348 add_image_function(glsl
? "imageStore" : "__intrinsic_image_store",
4349 "__intrinsic_image_store",
4350 &builtin_builder::_image_prototype
, 1,
4351 (flags
| IMAGE_FUNCTION_RETURNS_VOID
|
4352 IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE
|
4353 IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
|
4354 IMAGE_FUNCTION_WRITE_ONLY
),
4355 ir_intrinsic_image_store
);
4357 const unsigned atom_flags
= flags
| IMAGE_FUNCTION_AVAIL_ATOMIC
;
4359 add_image_function(glsl
? "imageAtomicAdd" : "__intrinsic_image_atomic_add",
4360 "__intrinsic_image_atomic_add",
4361 &builtin_builder::_image_prototype
, 1,
4362 (flags
| IMAGE_FUNCTION_AVAIL_ATOMIC_ADD
|
4363 IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
),
4364 ir_intrinsic_image_atomic_add
);
4366 add_image_function(glsl
? "imageAtomicMin" : "__intrinsic_image_atomic_min",
4367 "__intrinsic_image_atomic_min",
4368 &builtin_builder::_image_prototype
, 1, atom_flags
,
4369 ir_intrinsic_image_atomic_min
);
4371 add_image_function(glsl
? "imageAtomicMax" : "__intrinsic_image_atomic_max",
4372 "__intrinsic_image_atomic_max",
4373 &builtin_builder::_image_prototype
, 1, atom_flags
,
4374 ir_intrinsic_image_atomic_max
);
4376 add_image_function(glsl
? "imageAtomicAnd" : "__intrinsic_image_atomic_and",
4377 "__intrinsic_image_atomic_and",
4378 &builtin_builder::_image_prototype
, 1, atom_flags
,
4379 ir_intrinsic_image_atomic_and
);
4381 add_image_function(glsl
? "imageAtomicOr" : "__intrinsic_image_atomic_or",
4382 "__intrinsic_image_atomic_or",
4383 &builtin_builder::_image_prototype
, 1, atom_flags
,
4384 ir_intrinsic_image_atomic_or
);
4386 add_image_function(glsl
? "imageAtomicXor" : "__intrinsic_image_atomic_xor",
4387 "__intrinsic_image_atomic_xor",
4388 &builtin_builder::_image_prototype
, 1, atom_flags
,
4389 ir_intrinsic_image_atomic_xor
);
4391 add_image_function((glsl
? "imageAtomicExchange" :
4392 "__intrinsic_image_atomic_exchange"),
4393 "__intrinsic_image_atomic_exchange",
4394 &builtin_builder::_image_prototype
, 1,
4395 (flags
| IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE
|
4396 IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
),
4397 ir_intrinsic_image_atomic_exchange
);
4399 add_image_function((glsl
? "imageAtomicCompSwap" :
4400 "__intrinsic_image_atomic_comp_swap"),
4401 "__intrinsic_image_atomic_comp_swap",
4402 &builtin_builder::_image_prototype
, 2, atom_flags
,
4403 ir_intrinsic_image_atomic_comp_swap
);
4405 add_image_function(glsl
? "imageSize" : "__intrinsic_image_size",
4406 "__intrinsic_image_size",
4407 &builtin_builder::_image_size_prototype
, 1,
4408 flags
| IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
,
4409 ir_intrinsic_image_size
);
4411 add_image_function(glsl
? "imageSamples" : "__intrinsic_image_samples",
4412 "__intrinsic_image_samples",
4413 &builtin_builder::_image_samples_prototype
, 1,
4414 flags
| IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE
|
4415 IMAGE_FUNCTION_MS_ONLY
,
4416 ir_intrinsic_image_samples
);
4420 builtin_builder::in_var(const glsl_type
*type
, const char *name
)
4422 return new(mem_ctx
) ir_variable(type
, name
, ir_var_function_in
);
4426 builtin_builder::out_var(const glsl_type
*type
, const char *name
)
4428 return new(mem_ctx
) ir_variable(type
, name
, ir_var_function_out
);
4432 builtin_builder::imm(bool b
, unsigned vector_elements
)
4434 return new(mem_ctx
) ir_constant(b
, vector_elements
);
4438 builtin_builder::imm(float f
, unsigned vector_elements
)
4440 return new(mem_ctx
) ir_constant(f
, vector_elements
);
4444 builtin_builder::imm(int i
, unsigned vector_elements
)
4446 return new(mem_ctx
) ir_constant(i
, vector_elements
);
4450 builtin_builder::imm(unsigned u
, unsigned vector_elements
)
4452 return new(mem_ctx
) ir_constant(u
, vector_elements
);
4456 builtin_builder::imm(double d
, unsigned vector_elements
)
4458 return new(mem_ctx
) ir_constant(d
, vector_elements
);
4462 builtin_builder::imm(const glsl_type
*type
, const ir_constant_data
&data
)
4464 return new(mem_ctx
) ir_constant(type
, &data
);
4467 #define IMM_FP(type, val) (type->is_double()) ? imm(val) : imm((float)val)
4469 ir_dereference_variable
*
4470 builtin_builder::var_ref(ir_variable
*var
)
4472 return new(mem_ctx
) ir_dereference_variable(var
);
4475 ir_dereference_array
*
4476 builtin_builder::array_ref(ir_variable
*var
, int idx
)
4478 return new(mem_ctx
) ir_dereference_array(var
, imm(idx
));
4481 /** Return an element of a matrix */
4483 builtin_builder::matrix_elt(ir_variable
*var
, int column
, int row
)
4485 return swizzle(array_ref(var
, column
), row
, 1);
4489 * Implementations of built-in functions:
4492 ir_function_signature
*
4493 builtin_builder::new_sig(const glsl_type
*return_type
,
4494 builtin_available_predicate avail
,
4500 ir_function_signature
*sig
=
4501 new(mem_ctx
) ir_function_signature(return_type
, avail
);
4504 va_start(ap
, num_params
);
4505 for (int i
= 0; i
< num_params
; i
++) {
4506 plist
.push_tail(va_arg(ap
, ir_variable
*));
4510 sig
->replace_parameters(&plist
);
4514 #define MAKE_SIG(return_type, avail, ...) \
4515 ir_function_signature *sig = \
4516 new_sig(return_type, avail, __VA_ARGS__); \
4517 ir_factory body(&sig->body, mem_ctx); \
4518 sig->is_defined = true;
4520 #define MAKE_INTRINSIC(return_type, id, avail, ...) \
4521 ir_function_signature *sig = \
4522 new_sig(return_type, avail, __VA_ARGS__); \
4523 sig->intrinsic_id = id;
4525 ir_function_signature
*
4526 builtin_builder::unop(builtin_available_predicate avail
,
4527 ir_expression_operation opcode
,
4528 const glsl_type
*return_type
,
4529 const glsl_type
*param_type
)
4531 ir_variable
*x
= in_var(param_type
, "x");
4532 MAKE_SIG(return_type
, avail
, 1, x
);
4533 body
.emit(ret(expr(opcode
, x
)));
4537 #define UNOP(NAME, OPCODE, AVAIL) \
4538 ir_function_signature * \
4539 builtin_builder::_##NAME(const glsl_type *type) \
4541 return unop(&AVAIL, OPCODE, type, type); \
4544 #define UNOPA(NAME, OPCODE) \
4545 ir_function_signature * \
4546 builtin_builder::_##NAME(builtin_available_predicate avail, const glsl_type *type) \
4548 return unop(avail, OPCODE, type, type); \
4551 ir_function_signature
*
4552 builtin_builder::binop(builtin_available_predicate avail
,
4553 ir_expression_operation opcode
,
4554 const glsl_type
*return_type
,
4555 const glsl_type
*param0_type
,
4556 const glsl_type
*param1_type
,
4559 ir_variable
*x
= in_var(param0_type
, "x");
4560 ir_variable
*y
= in_var(param1_type
, "y");
4561 MAKE_SIG(return_type
, avail
, 2, x
, y
);
4564 body
.emit(ret(expr(opcode
, y
, x
)));
4566 body
.emit(ret(expr(opcode
, x
, y
)));
4571 #define BINOP(NAME, OPCODE, AVAIL) \
4572 ir_function_signature * \
4573 builtin_builder::_##NAME(const glsl_type *return_type, \
4574 const glsl_type *param0_type, \
4575 const glsl_type *param1_type) \
4577 return binop(&AVAIL, OPCODE, return_type, param0_type, param1_type); \
4581 * Angle and Trigonometry Functions @{
4584 ir_function_signature
*
4585 builtin_builder::_radians(const glsl_type
*type
)
4587 ir_variable
*degrees
= in_var(type
, "degrees");
4588 MAKE_SIG(type
, always_available
, 1, degrees
);
4589 body
.emit(ret(mul(degrees
, imm(0.0174532925f
))));
4593 ir_function_signature
*
4594 builtin_builder::_degrees(const glsl_type
*type
)
4596 ir_variable
*radians
= in_var(type
, "radians");
4597 MAKE_SIG(type
, always_available
, 1, radians
);
4598 body
.emit(ret(mul(radians
, imm(57.29578f
))));
4602 UNOP(sin
, ir_unop_sin
, always_available
)
4603 UNOP(cos
, ir_unop_cos
, always_available
)
4605 ir_function_signature
*
4606 builtin_builder::_tan(const glsl_type
*type
)
4608 ir_variable
*theta
= in_var(type
, "theta");
4609 MAKE_SIG(type
, always_available
, 1, theta
);
4610 body
.emit(ret(div(sin(theta
), cos(theta
))));
4615 builtin_builder::asin_expr(ir_variable
*x
, float p0
, float p1
)
4619 mul(sqrt(sub(imm(1.0f
), abs(x
))),
4622 add(imm(M_PI_4f
- 1.0f
),
4625 mul(abs(x
), imm(p1
))))))))));
4629 * Generate a ir_call to a function with a set of parameters
4631 * The input \c params can either be a list of \c ir_variable or a list of
4632 * \c ir_dereference_variable. In the latter case, all nodes will be removed
4633 * from \c params and used directly as the parameters to the generated
4637 builtin_builder::call(ir_function
*f
, ir_variable
*ret
, exec_list params
)
4639 exec_list actual_params
;
4641 foreach_in_list_safe(ir_instruction
, ir
, ¶ms
) {
4642 ir_dereference_variable
*d
= ir
->as_dereference_variable();
4645 actual_params
.push_tail(d
);
4647 ir_variable
*var
= ir
->as_variable();
4648 assert(var
!= NULL
);
4649 actual_params
.push_tail(var_ref(var
));
4653 ir_function_signature
*sig
=
4654 f
->exact_matching_signature(NULL
, &actual_params
);
4658 ir_dereference_variable
*deref
=
4659 (sig
->return_type
->is_void() ? NULL
: var_ref(ret
));
4661 return new(mem_ctx
) ir_call(sig
, deref
, &actual_params
);
4664 ir_function_signature
*
4665 builtin_builder::_asin(const glsl_type
*type
)
4667 ir_variable
*x
= in_var(type
, "x");
4668 MAKE_SIG(type
, always_available
, 1, x
);
4670 body
.emit(ret(asin_expr(x
, 0.086566724f
, -0.03102955f
)));
4675 ir_function_signature
*
4676 builtin_builder::_acos(const glsl_type
*type
)
4678 ir_variable
*x
= in_var(type
, "x");
4679 MAKE_SIG(type
, always_available
, 1, x
);
4681 body
.emit(ret(sub(imm(M_PI_2f
), asin_expr(x
, 0.08132463f
, -0.02363318f
))));
4686 ir_function_signature
*
4687 builtin_builder::_atan2(const glsl_type
*type
)
4689 const unsigned n
= type
->vector_elements
;
4690 ir_variable
*y
= in_var(type
, "y");
4691 ir_variable
*x
= in_var(type
, "x");
4692 MAKE_SIG(type
, always_available
, 2, y
, x
);
4694 /* If we're on the left half-plane rotate the coordinates π/2 clock-wise
4695 * for the y=0 discontinuity to end up aligned with the vertical
4696 * discontinuity of atan(s/t) along t=0. This also makes sure that we
4697 * don't attempt to divide by zero along the vertical line, which may give
4698 * unspecified results on non-GLSL 4.1-capable hardware.
4700 ir_variable
*flip
= body
.make_temp(glsl_type::bvec(n
), "flip");
4701 body
.emit(assign(flip
, gequal(imm(0.0f
, n
), x
)));
4702 ir_variable
*s
= body
.make_temp(type
, "s");
4703 body
.emit(assign(s
, csel(flip
, abs(x
), y
)));
4704 ir_variable
*t
= body
.make_temp(type
, "t");
4705 body
.emit(assign(t
, csel(flip
, y
, abs(x
))));
4707 /* If the magnitude of the denominator exceeds some huge value, scale down
4708 * the arguments in order to prevent the reciprocal operation from flushing
4709 * its result to zero, which would cause precision problems, and for s
4710 * infinite would cause us to return a NaN instead of the correct finite
4713 * If fmin and fmax are respectively the smallest and largest positive
4714 * normalized floating point values representable by the implementation,
4715 * the constants below should be in agreement with:
4718 * scale <= 1 / fmin / fmax (for |t| >= huge)
4720 * In addition scale should be a negative power of two in order to avoid
4721 * loss of precision. The values chosen below should work for most usual
4722 * floating point representations with at least the dynamic range of ATI's
4723 * 24-bit representation.
4725 ir_constant
*huge
= imm(1e18f
, n
);
4726 ir_variable
*scale
= body
.make_temp(type
, "scale");
4727 body
.emit(assign(scale
, csel(gequal(abs(t
), huge
),
4728 imm(0.25f
, n
), imm(1.0f
, n
))));
4729 ir_variable
*rcp_scaled_t
= body
.make_temp(type
, "rcp_scaled_t");
4730 body
.emit(assign(rcp_scaled_t
, rcp(mul(t
, scale
))));
4731 ir_expression
*s_over_t
= mul(mul(s
, scale
), rcp_scaled_t
);
4733 /* For |x| = |y| assume tan = 1 even if infinite (i.e. pretend momentarily
4734 * that ∞/∞ = 1) in order to comply with the rather artificial rules
4735 * inherited from IEEE 754-2008, namely:
4737 * "atan2(±∞, −∞) is ±3π/4
4738 * atan2(±∞, +∞) is ±π/4"
4740 * Note that this is inconsistent with the rules for the neighborhood of
4741 * zero that are based on iterated limits:
4743 * "atan2(±0, −0) is ±π
4744 * atan2(±0, +0) is ±0"
4746 * but GLSL specifically allows implementations to deviate from IEEE rules
4747 * at (0,0), so we take that license (i.e. pretend that 0/0 = 1 here as
4750 ir_expression
*tan
= csel(equal(abs(x
), abs(y
)),
4751 imm(1.0f
, n
), abs(s_over_t
));
4753 /* Calculate the arctangent and fix up the result if we had flipped the
4754 * coordinate system.
4756 ir_variable
*arc
= body
.make_temp(type
, "arc");
4757 do_atan(body
, type
, arc
, tan
);
4758 body
.emit(assign(arc
, add(arc
, mul(b2f(flip
), imm(M_PI_2f
)))));
4760 /* Rather convoluted calculation of the sign of the result. When x < 0 we
4761 * cannot use fsign because we need to be able to distinguish between
4762 * negative and positive zero. Unfortunately we cannot use bitwise
4763 * arithmetic tricks either because of back-ends without integer support.
4764 * When x >= 0 rcp_scaled_t will always be non-negative so this won't be
4765 * able to distinguish between negative and positive zero, but we don't
4766 * care because atan2 is continuous along the whole positive y = 0
4767 * half-line, so it won't affect the result significantly.
4769 body
.emit(ret(csel(less(min2(y
, rcp_scaled_t
), imm(0.0f
, n
)),
4776 builtin_builder::do_atan(ir_factory
&body
, const glsl_type
*type
, ir_variable
*res
, operand y_over_x
)
4779 * range-reduction, first step:
4781 * / y_over_x if |y_over_x| <= 1.0;
4783 * \ 1.0 / y_over_x otherwise
4785 ir_variable
*x
= body
.make_temp(type
, "atan_x");
4786 body
.emit(assign(x
, div(min2(abs(y_over_x
),
4792 * approximate atan by evaluating polynomial:
4794 * x * 0.9999793128310355 - x^3 * 0.3326756418091246 +
4795 * x^5 * 0.1938924977115610 - x^7 * 0.1173503194786851 +
4796 * x^9 * 0.0536813784310406 - x^11 * 0.0121323213173444
4798 ir_variable
*tmp
= body
.make_temp(type
, "atan_tmp");
4799 body
.emit(assign(tmp
, mul(x
, x
)));
4800 body
.emit(assign(tmp
, mul(add(mul(sub(mul(add(mul(sub(mul(add(mul(imm(-0.0121323213173444f
),
4802 imm(0.0536813784310406f
)),
4804 imm(0.1173503194786851f
)),
4806 imm(0.1938924977115610f
)),
4808 imm(0.3326756418091246f
)),
4810 imm(0.9999793128310355f
)),
4813 /* range-reduction fixup */
4814 body
.emit(assign(tmp
, add(tmp
,
4815 mul(b2f(greater(abs(y_over_x
),
4816 imm(1.0f
, type
->components()))),
4822 body
.emit(assign(res
, mul(tmp
, sign(y_over_x
))));
4825 ir_function_signature
*
4826 builtin_builder::_atan(const glsl_type
*type
)
4828 ir_variable
*y_over_x
= in_var(type
, "y_over_x");
4829 MAKE_SIG(type
, always_available
, 1, y_over_x
);
4831 ir_variable
*tmp
= body
.make_temp(type
, "tmp");
4832 do_atan(body
, type
, tmp
, y_over_x
);
4833 body
.emit(ret(tmp
));
4838 ir_function_signature
*
4839 builtin_builder::_sinh(const glsl_type
*type
)
4841 ir_variable
*x
= in_var(type
, "x");
4842 MAKE_SIG(type
, v130
, 1, x
);
4844 /* 0.5 * (e^x - e^(-x)) */
4845 body
.emit(ret(mul(imm(0.5f
), sub(exp(x
), exp(neg(x
))))));
4850 ir_function_signature
*
4851 builtin_builder::_cosh(const glsl_type
*type
)
4853 ir_variable
*x
= in_var(type
, "x");
4854 MAKE_SIG(type
, v130
, 1, x
);
4856 /* 0.5 * (e^x + e^(-x)) */
4857 body
.emit(ret(mul(imm(0.5f
), add(exp(x
), exp(neg(x
))))));
4862 ir_function_signature
*
4863 builtin_builder::_tanh(const glsl_type
*type
)
4865 ir_variable
*x
= in_var(type
, "x");
4866 MAKE_SIG(type
, v130
, 1, x
);
4868 /* tanh(x) := (0.5 * (e^x - e^(-x))) / (0.5 * (e^x + e^(-x)))
4870 * With a little algebra this reduces to (e^2x - 1) / (e^2x + 1)
4872 * Clamp x to (-inf, +10] to avoid precision problems. When x > 10, e^2x
4873 * is so much larger than 1.0 that 1.0 gets flushed to zero in the
4874 * computation e^2x +/- 1 so it can be ignored.
4876 ir_variable
*t
= body
.make_temp(type
, "tmp");
4877 body
.emit(assign(t
, min2(x
, imm(10.0f
))));
4879 body
.emit(ret(div(sub(exp(mul(t
, imm(2.0f
))), imm(1.0f
)),
4880 add(exp(mul(t
, imm(2.0f
))), imm(1.0f
)))));
4885 ir_function_signature
*
4886 builtin_builder::_asinh(const glsl_type
*type
)
4888 ir_variable
*x
= in_var(type
, "x");
4889 MAKE_SIG(type
, v130
, 1, x
);
4891 body
.emit(ret(mul(sign(x
), log(add(abs(x
), sqrt(add(mul(x
, x
),
4896 ir_function_signature
*
4897 builtin_builder::_acosh(const glsl_type
*type
)
4899 ir_variable
*x
= in_var(type
, "x");
4900 MAKE_SIG(type
, v130
, 1, x
);
4902 body
.emit(ret(log(add(x
, sqrt(sub(mul(x
, x
), imm(1.0f
)))))));
4906 ir_function_signature
*
4907 builtin_builder::_atanh(const glsl_type
*type
)
4909 ir_variable
*x
= in_var(type
, "x");
4910 MAKE_SIG(type
, v130
, 1, x
);
4912 body
.emit(ret(mul(imm(0.5f
), log(div(add(imm(1.0f
), x
),
4913 sub(imm(1.0f
), x
))))));
4919 * Exponential Functions @{
4922 ir_function_signature
*
4923 builtin_builder::_pow(const glsl_type
*type
)
4925 return binop(always_available
, ir_binop_pow
, type
, type
, type
);
4928 UNOP(exp
, ir_unop_exp
, always_available
)
4929 UNOP(log
, ir_unop_log
, always_available
)
4930 UNOP(exp2
, ir_unop_exp2
, always_available
)
4931 UNOP(log2
, ir_unop_log2
, always_available
)
4932 UNOPA(sqrt
, ir_unop_sqrt
)
4933 UNOPA(inversesqrt
, ir_unop_rsq
)
4937 UNOPA(abs
, ir_unop_abs
)
4938 UNOPA(sign
, ir_unop_sign
)
4939 UNOPA(floor
, ir_unop_floor
)
4940 UNOPA(truncate
, ir_unop_trunc
)
4941 UNOPA(trunc
, ir_unop_trunc
)
4942 UNOPA(round
, ir_unop_round_even
)
4943 UNOPA(roundEven
, ir_unop_round_even
)
4944 UNOPA(ceil
, ir_unop_ceil
)
4945 UNOPA(fract
, ir_unop_fract
)
4947 ir_function_signature
*
4948 builtin_builder::_mod(builtin_available_predicate avail
,
4949 const glsl_type
*x_type
, const glsl_type
*y_type
)
4951 return binop(avail
, ir_binop_mod
, x_type
, x_type
, y_type
);
4954 ir_function_signature
*
4955 builtin_builder::_modf(builtin_available_predicate avail
, const glsl_type
*type
)
4957 ir_variable
*x
= in_var(type
, "x");
4958 ir_variable
*i
= out_var(type
, "i");
4959 MAKE_SIG(type
, avail
, 2, x
, i
);
4961 ir_variable
*t
= body
.make_temp(type
, "t");
4962 body
.emit(assign(t
, expr(ir_unop_trunc
, x
)));
4963 body
.emit(assign(i
, t
));
4964 body
.emit(ret(sub(x
, t
)));
4969 ir_function_signature
*
4970 builtin_builder::_min(builtin_available_predicate avail
,
4971 const glsl_type
*x_type
, const glsl_type
*y_type
)
4973 return binop(avail
, ir_binop_min
, x_type
, x_type
, y_type
);
4976 ir_function_signature
*
4977 builtin_builder::_max(builtin_available_predicate avail
,
4978 const glsl_type
*x_type
, const glsl_type
*y_type
)
4980 return binop(avail
, ir_binop_max
, x_type
, x_type
, y_type
);
4983 ir_function_signature
*
4984 builtin_builder::_clamp(builtin_available_predicate avail
,
4985 const glsl_type
*val_type
, const glsl_type
*bound_type
)
4987 ir_variable
*x
= in_var(val_type
, "x");
4988 ir_variable
*minVal
= in_var(bound_type
, "minVal");
4989 ir_variable
*maxVal
= in_var(bound_type
, "maxVal");
4990 MAKE_SIG(val_type
, avail
, 3, x
, minVal
, maxVal
);
4992 body
.emit(ret(clamp(x
, minVal
, maxVal
)));
4997 ir_function_signature
*
4998 builtin_builder::_mix_lrp(builtin_available_predicate avail
, const glsl_type
*val_type
, const glsl_type
*blend_type
)
5000 ir_variable
*x
= in_var(val_type
, "x");
5001 ir_variable
*y
= in_var(val_type
, "y");
5002 ir_variable
*a
= in_var(blend_type
, "a");
5003 MAKE_SIG(val_type
, avail
, 3, x
, y
, a
);
5005 body
.emit(ret(lrp(x
, y
, a
)));
5010 ir_function_signature
*
5011 builtin_builder::_mix_sel(builtin_available_predicate avail
,
5012 const glsl_type
*val_type
,
5013 const glsl_type
*blend_type
)
5015 ir_variable
*x
= in_var(val_type
, "x");
5016 ir_variable
*y
= in_var(val_type
, "y");
5017 ir_variable
*a
= in_var(blend_type
, "a");
5018 MAKE_SIG(val_type
, avail
, 3, x
, y
, a
);
5020 /* csel matches the ternary operator in that a selector of true choses the
5021 * first argument. This differs from mix(x, y, false) which choses the
5022 * second argument (to remain consistent with the interpolating version of
5023 * mix() which takes a blend factor from 0.0 to 1.0 where 0.0 is only x.
5025 * To handle the behavior mismatch, reverse the x and y arguments.
5027 body
.emit(ret(csel(a
, y
, x
)));
5032 ir_function_signature
*
5033 builtin_builder::_step(builtin_available_predicate avail
, const glsl_type
*edge_type
, const glsl_type
*x_type
)
5035 ir_variable
*edge
= in_var(edge_type
, "edge");
5036 ir_variable
*x
= in_var(x_type
, "x");
5037 MAKE_SIG(x_type
, avail
, 2, edge
, x
);
5039 ir_variable
*t
= body
.make_temp(x_type
, "t");
5040 if (x_type
->vector_elements
== 1) {
5041 /* Both are floats */
5042 if (edge_type
->is_double())
5043 body
.emit(assign(t
, f2d(b2f(gequal(x
, edge
)))));
5045 body
.emit(assign(t
, b2f(gequal(x
, edge
))));
5046 } else if (edge_type
->vector_elements
== 1) {
5047 /* x is a vector but edge is a float */
5048 for (int i
= 0; i
< x_type
->vector_elements
; i
++) {
5049 if (edge_type
->is_double())
5050 body
.emit(assign(t
, f2d(b2f(gequal(swizzle(x
, i
, 1), edge
))), 1 << i
));
5052 body
.emit(assign(t
, b2f(gequal(swizzle(x
, i
, 1), edge
)), 1 << i
));
5055 /* Both are vectors */
5056 for (int i
= 0; i
< x_type
->vector_elements
; i
++) {
5057 if (edge_type
->is_double())
5058 body
.emit(assign(t
, f2d(b2f(gequal(swizzle(x
, i
, 1), swizzle(edge
, i
, 1)))),
5061 body
.emit(assign(t
, b2f(gequal(swizzle(x
, i
, 1), swizzle(edge
, i
, 1))),
5071 ir_function_signature
*
5072 builtin_builder::_smoothstep(builtin_available_predicate avail
, const glsl_type
*edge_type
, const glsl_type
*x_type
)
5074 ir_variable
*edge0
= in_var(edge_type
, "edge0");
5075 ir_variable
*edge1
= in_var(edge_type
, "edge1");
5076 ir_variable
*x
= in_var(x_type
, "x");
5077 MAKE_SIG(x_type
, avail
, 3, edge0
, edge1
, x
);
5079 /* From the GLSL 1.10 specification:
5082 * t = clamp((x - edge0) / (edge1 - edge0), 0, 1);
5083 * return t * t * (3 - 2 * t);
5086 ir_variable
*t
= body
.make_temp(x_type
, "t");
5087 body
.emit(assign(t
, clamp(div(sub(x
, edge0
), sub(edge1
, edge0
)),
5088 IMM_FP(x_type
, 0.0), IMM_FP(x_type
, 1.0))));
5090 body
.emit(ret(mul(t
, mul(t
, sub(IMM_FP(x_type
, 3.0), mul(IMM_FP(x_type
, 2.0), t
))))));
5095 ir_function_signature
*
5096 builtin_builder::_isnan(builtin_available_predicate avail
, const glsl_type
*type
)
5098 ir_variable
*x
= in_var(type
, "x");
5099 MAKE_SIG(glsl_type::bvec(type
->vector_elements
), avail
, 1, x
);
5101 body
.emit(ret(nequal(x
, x
)));
5106 ir_function_signature
*
5107 builtin_builder::_isinf(builtin_available_predicate avail
, const glsl_type
*type
)
5109 ir_variable
*x
= in_var(type
, "x");
5110 MAKE_SIG(glsl_type::bvec(type
->vector_elements
), avail
, 1, x
);
5112 ir_constant_data infinities
;
5113 for (int i
= 0; i
< type
->vector_elements
; i
++) {
5114 switch (type
->base_type
) {
5115 case GLSL_TYPE_FLOAT
:
5116 infinities
.f
[i
] = INFINITY
;
5118 case GLSL_TYPE_DOUBLE
:
5119 infinities
.d
[i
] = INFINITY
;
5122 unreachable("unknown type");
5126 body
.emit(ret(equal(abs(x
), imm(type
, infinities
))));
5131 ir_function_signature
*
5132 builtin_builder::_floatBitsToInt(const glsl_type
*type
)
5134 ir_variable
*x
= in_var(type
, "x");
5135 MAKE_SIG(glsl_type::ivec(type
->vector_elements
), shader_bit_encoding
, 1, x
);
5136 body
.emit(ret(bitcast_f2i(x
)));
5140 ir_function_signature
*
5141 builtin_builder::_floatBitsToUint(const glsl_type
*type
)
5143 ir_variable
*x
= in_var(type
, "x");
5144 MAKE_SIG(glsl_type::uvec(type
->vector_elements
), shader_bit_encoding
, 1, x
);
5145 body
.emit(ret(bitcast_f2u(x
)));
5149 ir_function_signature
*
5150 builtin_builder::_intBitsToFloat(const glsl_type
*type
)
5152 ir_variable
*x
= in_var(type
, "x");
5153 MAKE_SIG(glsl_type::vec(type
->vector_elements
), shader_bit_encoding
, 1, x
);
5154 body
.emit(ret(bitcast_i2f(x
)));
5158 ir_function_signature
*
5159 builtin_builder::_uintBitsToFloat(const glsl_type
*type
)
5161 ir_variable
*x
= in_var(type
, "x");
5162 MAKE_SIG(glsl_type::vec(type
->vector_elements
), shader_bit_encoding
, 1, x
);
5163 body
.emit(ret(bitcast_u2f(x
)));
5167 ir_function_signature
*
5168 builtin_builder::_doubleBitsToInt64(builtin_available_predicate avail
, const glsl_type
*type
)
5170 ir_variable
*x
= in_var(type
, "x");
5171 MAKE_SIG(glsl_type::i64vec(type
->vector_elements
), avail
, 1, x
);
5172 body
.emit(ret(bitcast_d2i64(x
)));
5176 ir_function_signature
*
5177 builtin_builder::_doubleBitsToUint64(builtin_available_predicate avail
, const glsl_type
*type
)
5179 ir_variable
*x
= in_var(type
, "x");
5180 MAKE_SIG(glsl_type::u64vec(type
->vector_elements
), avail
, 1, x
);
5181 body
.emit(ret(bitcast_d2u64(x
)));
5185 ir_function_signature
*
5186 builtin_builder::_int64BitsToDouble(builtin_available_predicate avail
, const glsl_type
*type
)
5188 ir_variable
*x
= in_var(type
, "x");
5189 MAKE_SIG(glsl_type::dvec(type
->vector_elements
), avail
, 1, x
);
5190 body
.emit(ret(bitcast_i642d(x
)));
5194 ir_function_signature
*
5195 builtin_builder::_uint64BitsToDouble(builtin_available_predicate avail
, const glsl_type
*type
)
5197 ir_variable
*x
= in_var(type
, "x");
5198 MAKE_SIG(glsl_type::dvec(type
->vector_elements
), avail
, 1, x
);
5199 body
.emit(ret(bitcast_u642d(x
)));
5203 ir_function_signature
*
5204 builtin_builder::_packUnorm2x16(builtin_available_predicate avail
)
5206 ir_variable
*v
= in_var(glsl_type::vec2_type
, "v");
5207 MAKE_SIG(glsl_type::uint_type
, avail
, 1, v
);
5208 body
.emit(ret(expr(ir_unop_pack_unorm_2x16
, v
)));
5212 ir_function_signature
*
5213 builtin_builder::_packSnorm2x16(builtin_available_predicate avail
)
5215 ir_variable
*v
= in_var(glsl_type::vec2_type
, "v");
5216 MAKE_SIG(glsl_type::uint_type
, avail
, 1, v
);
5217 body
.emit(ret(expr(ir_unop_pack_snorm_2x16
, v
)));
5221 ir_function_signature
*
5222 builtin_builder::_packUnorm4x8(builtin_available_predicate avail
)
5224 ir_variable
*v
= in_var(glsl_type::vec4_type
, "v");
5225 MAKE_SIG(glsl_type::uint_type
, avail
, 1, v
);
5226 body
.emit(ret(expr(ir_unop_pack_unorm_4x8
, v
)));
5230 ir_function_signature
*
5231 builtin_builder::_packSnorm4x8(builtin_available_predicate avail
)
5233 ir_variable
*v
= in_var(glsl_type::vec4_type
, "v");
5234 MAKE_SIG(glsl_type::uint_type
, avail
, 1, v
);
5235 body
.emit(ret(expr(ir_unop_pack_snorm_4x8
, v
)));
5239 ir_function_signature
*
5240 builtin_builder::_unpackUnorm2x16(builtin_available_predicate avail
)
5242 ir_variable
*p
= in_var(glsl_type::uint_type
, "p");
5243 MAKE_SIG(glsl_type::vec2_type
, avail
, 1, p
);
5244 body
.emit(ret(expr(ir_unop_unpack_unorm_2x16
, p
)));
5248 ir_function_signature
*
5249 builtin_builder::_unpackSnorm2x16(builtin_available_predicate avail
)
5251 ir_variable
*p
= in_var(glsl_type::uint_type
, "p");
5252 MAKE_SIG(glsl_type::vec2_type
, avail
, 1, p
);
5253 body
.emit(ret(expr(ir_unop_unpack_snorm_2x16
, p
)));
5258 ir_function_signature
*
5259 builtin_builder::_unpackUnorm4x8(builtin_available_predicate avail
)
5261 ir_variable
*p
= in_var(glsl_type::uint_type
, "p");
5262 MAKE_SIG(glsl_type::vec4_type
, avail
, 1, p
);
5263 body
.emit(ret(expr(ir_unop_unpack_unorm_4x8
, p
)));
5267 ir_function_signature
*
5268 builtin_builder::_unpackSnorm4x8(builtin_available_predicate avail
)
5270 ir_variable
*p
= in_var(glsl_type::uint_type
, "p");
5271 MAKE_SIG(glsl_type::vec4_type
, avail
, 1, p
);
5272 body
.emit(ret(expr(ir_unop_unpack_snorm_4x8
, p
)));
5276 ir_function_signature
*
5277 builtin_builder::_packHalf2x16(builtin_available_predicate avail
)
5279 ir_variable
*v
= in_var(glsl_type::vec2_type
, "v");
5280 MAKE_SIG(glsl_type::uint_type
, avail
, 1, v
);
5281 body
.emit(ret(expr(ir_unop_pack_half_2x16
, v
)));
5285 ir_function_signature
*
5286 builtin_builder::_unpackHalf2x16(builtin_available_predicate avail
)
5288 ir_variable
*p
= in_var(glsl_type::uint_type
, "p");
5289 MAKE_SIG(glsl_type::vec2_type
, avail
, 1, p
);
5290 body
.emit(ret(expr(ir_unop_unpack_half_2x16
, p
)));
5294 ir_function_signature
*
5295 builtin_builder::_packDouble2x32(builtin_available_predicate avail
)
5297 ir_variable
*v
= in_var(glsl_type::uvec2_type
, "v");
5298 MAKE_SIG(glsl_type::double_type
, avail
, 1, v
);
5299 body
.emit(ret(expr(ir_unop_pack_double_2x32
, v
)));
5303 ir_function_signature
*
5304 builtin_builder::_unpackDouble2x32(builtin_available_predicate avail
)
5306 ir_variable
*p
= in_var(glsl_type::double_type
, "p");
5307 MAKE_SIG(glsl_type::uvec2_type
, avail
, 1, p
);
5308 body
.emit(ret(expr(ir_unop_unpack_double_2x32
, p
)));
5312 ir_function_signature
*
5313 builtin_builder::_packInt2x32(builtin_available_predicate avail
)
5315 ir_variable
*v
= in_var(glsl_type::ivec2_type
, "v");
5316 MAKE_SIG(glsl_type::int64_t_type
, avail
, 1, v
);
5317 body
.emit(ret(expr(ir_unop_pack_int_2x32
, v
)));
5321 ir_function_signature
*
5322 builtin_builder::_unpackInt2x32(builtin_available_predicate avail
)
5324 ir_variable
*p
= in_var(glsl_type::int64_t_type
, "p");
5325 MAKE_SIG(glsl_type::ivec2_type
, avail
, 1, p
);
5326 body
.emit(ret(expr(ir_unop_unpack_int_2x32
, p
)));
5330 ir_function_signature
*
5331 builtin_builder::_packUint2x32(builtin_available_predicate avail
)
5333 ir_variable
*v
= in_var(glsl_type::uvec2_type
, "v");
5334 MAKE_SIG(glsl_type::uint64_t_type
, avail
, 1, v
);
5335 body
.emit(ret(expr(ir_unop_pack_uint_2x32
, v
)));
5339 ir_function_signature
*
5340 builtin_builder::_unpackUint2x32(builtin_available_predicate avail
)
5342 ir_variable
*p
= in_var(glsl_type::uint64_t_type
, "p");
5343 MAKE_SIG(glsl_type::uvec2_type
, avail
, 1, p
);
5344 body
.emit(ret(expr(ir_unop_unpack_uint_2x32
, p
)));
5348 ir_function_signature
*
5349 builtin_builder::_length(builtin_available_predicate avail
, const glsl_type
*type
)
5351 ir_variable
*x
= in_var(type
, "x");
5352 MAKE_SIG(type
->get_base_type(), avail
, 1, x
);
5354 body
.emit(ret(sqrt(dot(x
, x
))));
5359 ir_function_signature
*
5360 builtin_builder::_distance(builtin_available_predicate avail
, const glsl_type
*type
)
5362 ir_variable
*p0
= in_var(type
, "p0");
5363 ir_variable
*p1
= in_var(type
, "p1");
5364 MAKE_SIG(type
->get_base_type(), avail
, 2, p0
, p1
);
5366 if (type
->vector_elements
== 1) {
5367 body
.emit(ret(abs(sub(p0
, p1
))));
5369 ir_variable
*p
= body
.make_temp(type
, "p");
5370 body
.emit(assign(p
, sub(p0
, p1
)));
5371 body
.emit(ret(sqrt(dot(p
, p
))));
5377 ir_function_signature
*
5378 builtin_builder::_dot(builtin_available_predicate avail
, const glsl_type
*type
)
5380 if (type
->vector_elements
== 1)
5381 return binop(avail
, ir_binop_mul
, type
, type
, type
);
5383 return binop(avail
, ir_binop_dot
,
5384 type
->get_base_type(), type
, type
);
5387 ir_function_signature
*
5388 builtin_builder::_cross(builtin_available_predicate avail
, const glsl_type
*type
)
5390 ir_variable
*a
= in_var(type
, "a");
5391 ir_variable
*b
= in_var(type
, "b");
5392 MAKE_SIG(type
, avail
, 2, a
, b
);
5394 int yzx
= MAKE_SWIZZLE4(SWIZZLE_Y
, SWIZZLE_Z
, SWIZZLE_X
, 0);
5395 int zxy
= MAKE_SWIZZLE4(SWIZZLE_Z
, SWIZZLE_X
, SWIZZLE_Y
, 0);
5397 body
.emit(ret(sub(mul(swizzle(a
, yzx
, 3), swizzle(b
, zxy
, 3)),
5398 mul(swizzle(a
, zxy
, 3), swizzle(b
, yzx
, 3)))));
5403 ir_function_signature
*
5404 builtin_builder::_normalize(builtin_available_predicate avail
, const glsl_type
*type
)
5406 ir_variable
*x
= in_var(type
, "x");
5407 MAKE_SIG(type
, avail
, 1, x
);
5409 if (type
->vector_elements
== 1) {
5410 body
.emit(ret(sign(x
)));
5412 body
.emit(ret(mul(x
, rsq(dot(x
, x
)))));
5418 ir_function_signature
*
5419 builtin_builder::_ftransform()
5421 MAKE_SIG(glsl_type::vec4_type
, compatibility_vs_only
, 0);
5423 /* ftransform() refers to global variables, and is always emitted
5424 * directly by ast_function.cpp. Just emit a prototype here so we
5425 * can recognize calls to it.
5430 ir_function_signature
*
5431 builtin_builder::_faceforward(builtin_available_predicate avail
, const glsl_type
*type
)
5433 ir_variable
*N
= in_var(type
, "N");
5434 ir_variable
*I
= in_var(type
, "I");
5435 ir_variable
*Nref
= in_var(type
, "Nref");
5436 MAKE_SIG(type
, avail
, 3, N
, I
, Nref
);
5438 body
.emit(if_tree(less(dot(Nref
, I
), IMM_FP(type
, 0.0)),
5439 ret(N
), ret(neg(N
))));
5444 ir_function_signature
*
5445 builtin_builder::_reflect(builtin_available_predicate avail
, const glsl_type
*type
)
5447 ir_variable
*I
= in_var(type
, "I");
5448 ir_variable
*N
= in_var(type
, "N");
5449 MAKE_SIG(type
, avail
, 2, I
, N
);
5451 /* I - 2 * dot(N, I) * N */
5452 body
.emit(ret(sub(I
, mul(IMM_FP(type
, 2.0), mul(dot(N
, I
), N
)))));
5457 ir_function_signature
*
5458 builtin_builder::_refract(builtin_available_predicate avail
, const glsl_type
*type
)
5460 ir_variable
*I
= in_var(type
, "I");
5461 ir_variable
*N
= in_var(type
, "N");
5462 ir_variable
*eta
= in_var(type
->get_base_type(), "eta");
5463 MAKE_SIG(type
, avail
, 3, I
, N
, eta
);
5465 ir_variable
*n_dot_i
= body
.make_temp(type
->get_base_type(), "n_dot_i");
5466 body
.emit(assign(n_dot_i
, dot(N
, I
)));
5468 /* From the GLSL 1.10 specification:
5469 * k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I))
5471 * return genType(0.0)
5473 * return eta * I - (eta * dot(N, I) + sqrt(k)) * N
5475 ir_variable
*k
= body
.make_temp(type
->get_base_type(), "k");
5476 body
.emit(assign(k
, sub(IMM_FP(type
, 1.0),
5477 mul(eta
, mul(eta
, sub(IMM_FP(type
, 1.0),
5478 mul(n_dot_i
, n_dot_i
)))))));
5479 body
.emit(if_tree(less(k
, IMM_FP(type
, 0.0)),
5480 ret(ir_constant::zero(mem_ctx
, type
)),
5481 ret(sub(mul(eta
, I
),
5482 mul(add(mul(eta
, n_dot_i
), sqrt(k
)), N
)))));
5487 ir_function_signature
*
5488 builtin_builder::_matrixCompMult(builtin_available_predicate avail
, const glsl_type
*type
)
5490 ir_variable
*x
= in_var(type
, "x");
5491 ir_variable
*y
= in_var(type
, "y");
5492 MAKE_SIG(type
, avail
, 2, x
, y
);
5494 ir_variable
*z
= body
.make_temp(type
, "z");
5495 for (int i
= 0; i
< type
->matrix_columns
; i
++) {
5496 body
.emit(assign(array_ref(z
, i
), mul(array_ref(x
, i
), array_ref(y
, i
))));
5503 ir_function_signature
*
5504 builtin_builder::_outerProduct(builtin_available_predicate avail
, const glsl_type
*type
)
5509 if (type
->is_double()) {
5510 r
= in_var(glsl_type::dvec(type
->matrix_columns
), "r");
5511 c
= in_var(glsl_type::dvec(type
->vector_elements
), "c");
5513 r
= in_var(glsl_type::vec(type
->matrix_columns
), "r");
5514 c
= in_var(glsl_type::vec(type
->vector_elements
), "c");
5516 MAKE_SIG(type
, avail
, 2, c
, r
);
5518 ir_variable
*m
= body
.make_temp(type
, "m");
5519 for (int i
= 0; i
< type
->matrix_columns
; i
++) {
5520 body
.emit(assign(array_ref(m
, i
), mul(c
, swizzle(r
, i
, 1))));
5527 ir_function_signature
*
5528 builtin_builder::_transpose(builtin_available_predicate avail
, const glsl_type
*orig_type
)
5530 const glsl_type
*transpose_type
=
5531 glsl_type::get_instance(orig_type
->base_type
,
5532 orig_type
->matrix_columns
,
5533 orig_type
->vector_elements
);
5535 ir_variable
*m
= in_var(orig_type
, "m");
5536 MAKE_SIG(transpose_type
, avail
, 1, m
);
5538 ir_variable
*t
= body
.make_temp(transpose_type
, "t");
5539 for (int i
= 0; i
< orig_type
->matrix_columns
; i
++) {
5540 for (int j
= 0; j
< orig_type
->vector_elements
; j
++) {
5541 body
.emit(assign(array_ref(t
, j
),
5542 matrix_elt(m
, i
, j
),
5551 ir_function_signature
*
5552 builtin_builder::_determinant_mat2(builtin_available_predicate avail
, const glsl_type
*type
)
5554 ir_variable
*m
= in_var(type
, "m");
5555 MAKE_SIG(type
->get_base_type(), avail
, 1, m
);
5557 body
.emit(ret(sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 1, 1)),
5558 mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 0, 1)))));
5563 ir_function_signature
*
5564 builtin_builder::_determinant_mat3(builtin_available_predicate avail
, const glsl_type
*type
)
5566 ir_variable
*m
= in_var(type
, "m");
5567 MAKE_SIG(type
->get_base_type(), avail
, 1, m
);
5570 sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 2, 2)),
5571 mul(matrix_elt(m
, 1, 2), matrix_elt(m
, 2, 1)));
5574 sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 2)),
5575 mul(matrix_elt(m
, 1, 2), matrix_elt(m
, 2, 0)));
5578 sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 1)),
5579 mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 2, 0)));
5581 body
.emit(ret(add(sub(mul(matrix_elt(m
, 0, 0), f1
),
5582 mul(matrix_elt(m
, 0, 1), f2
)),
5583 mul(matrix_elt(m
, 0, 2), f3
))));
5588 ir_function_signature
*
5589 builtin_builder::_determinant_mat4(builtin_available_predicate avail
, const glsl_type
*type
)
5591 ir_variable
*m
= in_var(type
, "m");
5592 const glsl_type
*btype
= type
->get_base_type();
5593 MAKE_SIG(btype
, avail
, 1, m
);
5595 ir_variable
*SubFactor00
= body
.make_temp(btype
, "SubFactor00");
5596 ir_variable
*SubFactor01
= body
.make_temp(btype
, "SubFactor01");
5597 ir_variable
*SubFactor02
= body
.make_temp(btype
, "SubFactor02");
5598 ir_variable
*SubFactor03
= body
.make_temp(btype
, "SubFactor03");
5599 ir_variable
*SubFactor04
= body
.make_temp(btype
, "SubFactor04");
5600 ir_variable
*SubFactor05
= body
.make_temp(btype
, "SubFactor05");
5601 ir_variable
*SubFactor06
= body
.make_temp(btype
, "SubFactor06");
5602 ir_variable
*SubFactor07
= body
.make_temp(btype
, "SubFactor07");
5603 ir_variable
*SubFactor08
= body
.make_temp(btype
, "SubFactor08");
5604 ir_variable
*SubFactor09
= body
.make_temp(btype
, "SubFactor09");
5605 ir_variable
*SubFactor10
= body
.make_temp(btype
, "SubFactor10");
5606 ir_variable
*SubFactor11
= body
.make_temp(btype
, "SubFactor11");
5607 ir_variable
*SubFactor12
= body
.make_temp(btype
, "SubFactor12");
5608 ir_variable
*SubFactor13
= body
.make_temp(btype
, "SubFactor13");
5609 ir_variable
*SubFactor14
= body
.make_temp(btype
, "SubFactor14");
5610 ir_variable
*SubFactor15
= body
.make_temp(btype
, "SubFactor15");
5611 ir_variable
*SubFactor16
= body
.make_temp(btype
, "SubFactor16");
5612 ir_variable
*SubFactor17
= body
.make_temp(btype
, "SubFactor17");
5613 ir_variable
*SubFactor18
= body
.make_temp(btype
, "SubFactor18");
5615 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)))));
5616 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)))));
5617 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)))));
5618 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)))));
5619 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)))));
5620 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)))));
5621 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)))));
5622 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)))));
5623 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)))));
5624 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)))));
5625 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)))));
5626 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)))));
5627 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)))));
5628 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)))));
5629 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)))));
5630 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)))));
5631 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)))));
5632 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)))));
5633 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)))));
5635 ir_variable
*adj_0
= body
.make_temp(btype
== glsl_type::float_type
? glsl_type::vec4_type
: glsl_type::dvec4_type
, "adj_0");
5637 body
.emit(assign(adj_0
,
5638 add(sub(mul(matrix_elt(m
, 1, 1), SubFactor00
),
5639 mul(matrix_elt(m
, 1, 2), SubFactor01
)),
5640 mul(matrix_elt(m
, 1, 3), SubFactor02
)),
5642 body
.emit(assign(adj_0
, neg(
5643 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor00
),
5644 mul(matrix_elt(m
, 1, 2), SubFactor03
)),
5645 mul(matrix_elt(m
, 1, 3), SubFactor04
))),
5647 body
.emit(assign(adj_0
,
5648 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor01
),
5649 mul(matrix_elt(m
, 1, 1), SubFactor03
)),
5650 mul(matrix_elt(m
, 1, 3), SubFactor05
)),
5652 body
.emit(assign(adj_0
, neg(
5653 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor02
),
5654 mul(matrix_elt(m
, 1, 1), SubFactor04
)),
5655 mul(matrix_elt(m
, 1, 2), SubFactor05
))),
5658 body
.emit(ret(dot(array_ref(m
, 0), adj_0
)));
5663 ir_function_signature
*
5664 builtin_builder::_inverse_mat2(builtin_available_predicate avail
, const glsl_type
*type
)
5666 ir_variable
*m
= in_var(type
, "m");
5667 MAKE_SIG(type
, avail
, 1, m
);
5669 ir_variable
*adj
= body
.make_temp(type
, "adj");
5670 body
.emit(assign(array_ref(adj
, 0), matrix_elt(m
, 1, 1), 1 << 0));
5671 body
.emit(assign(array_ref(adj
, 0), neg(matrix_elt(m
, 0, 1)), 1 << 1));
5672 body
.emit(assign(array_ref(adj
, 1), neg(matrix_elt(m
, 1, 0)), 1 << 0));
5673 body
.emit(assign(array_ref(adj
, 1), matrix_elt(m
, 0, 0), 1 << 1));
5675 ir_expression
*det
=
5676 sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 1, 1)),
5677 mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 0, 1)));
5679 body
.emit(ret(div(adj
, det
)));
5683 ir_function_signature
*
5684 builtin_builder::_inverse_mat3(builtin_available_predicate avail
, const glsl_type
*type
)
5686 ir_variable
*m
= in_var(type
, "m");
5687 const glsl_type
*btype
= type
->get_base_type();
5688 MAKE_SIG(type
, avail
, 1, m
);
5690 ir_variable
*f11_22_21_12
= body
.make_temp(btype
, "f11_22_21_12");
5691 ir_variable
*f10_22_20_12
= body
.make_temp(btype
, "f10_22_20_12");
5692 ir_variable
*f10_21_20_11
= body
.make_temp(btype
, "f10_21_20_11");
5694 body
.emit(assign(f11_22_21_12
,
5695 sub(mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 2, 2)),
5696 mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 1, 2)))));
5697 body
.emit(assign(f10_22_20_12
,
5698 sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 2)),
5699 mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 1, 2)))));
5700 body
.emit(assign(f10_21_20_11
,
5701 sub(mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 2, 1)),
5702 mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 1, 1)))));
5704 ir_variable
*adj
= body
.make_temp(type
, "adj");
5705 body
.emit(assign(array_ref(adj
, 0), f11_22_21_12
, WRITEMASK_X
));
5706 body
.emit(assign(array_ref(adj
, 1), neg(f10_22_20_12
), WRITEMASK_X
));
5707 body
.emit(assign(array_ref(adj
, 2), f10_21_20_11
, WRITEMASK_X
));
5709 body
.emit(assign(array_ref(adj
, 0), neg(
5710 sub(mul(matrix_elt(m
, 0, 1), matrix_elt(m
, 2, 2)),
5711 mul(matrix_elt(m
, 2, 1), matrix_elt(m
, 0, 2)))),
5713 body
.emit(assign(array_ref(adj
, 1),
5714 sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 2, 2)),
5715 mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 0, 2))),
5717 body
.emit(assign(array_ref(adj
, 2), neg(
5718 sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 2, 1)),
5719 mul(matrix_elt(m
, 2, 0), matrix_elt(m
, 0, 1)))),
5722 body
.emit(assign(array_ref(adj
, 0),
5723 sub(mul(matrix_elt(m
, 0, 1), matrix_elt(m
, 1, 2)),
5724 mul(matrix_elt(m
, 1, 1), matrix_elt(m
, 0, 2))),
5726 body
.emit(assign(array_ref(adj
, 1), neg(
5727 sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 1, 2)),
5728 mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 0, 2)))),
5730 body
.emit(assign(array_ref(adj
, 2),
5731 sub(mul(matrix_elt(m
, 0, 0), matrix_elt(m
, 1, 1)),
5732 mul(matrix_elt(m
, 1, 0), matrix_elt(m
, 0, 1))),
5735 ir_expression
*det
=
5736 add(sub(mul(matrix_elt(m
, 0, 0), f11_22_21_12
),
5737 mul(matrix_elt(m
, 0, 1), f10_22_20_12
)),
5738 mul(matrix_elt(m
, 0, 2), f10_21_20_11
));
5740 body
.emit(ret(div(adj
, det
)));
5745 ir_function_signature
*
5746 builtin_builder::_inverse_mat4(builtin_available_predicate avail
, const glsl_type
*type
)
5748 ir_variable
*m
= in_var(type
, "m");
5749 const glsl_type
*btype
= type
->get_base_type();
5750 MAKE_SIG(type
, avail
, 1, m
);
5752 ir_variable
*SubFactor00
= body
.make_temp(btype
, "SubFactor00");
5753 ir_variable
*SubFactor01
= body
.make_temp(btype
, "SubFactor01");
5754 ir_variable
*SubFactor02
= body
.make_temp(btype
, "SubFactor02");
5755 ir_variable
*SubFactor03
= body
.make_temp(btype
, "SubFactor03");
5756 ir_variable
*SubFactor04
= body
.make_temp(btype
, "SubFactor04");
5757 ir_variable
*SubFactor05
= body
.make_temp(btype
, "SubFactor05");
5758 ir_variable
*SubFactor06
= body
.make_temp(btype
, "SubFactor06");
5759 ir_variable
*SubFactor07
= body
.make_temp(btype
, "SubFactor07");
5760 ir_variable
*SubFactor08
= body
.make_temp(btype
, "SubFactor08");
5761 ir_variable
*SubFactor09
= body
.make_temp(btype
, "SubFactor09");
5762 ir_variable
*SubFactor10
= body
.make_temp(btype
, "SubFactor10");
5763 ir_variable
*SubFactor11
= body
.make_temp(btype
, "SubFactor11");
5764 ir_variable
*SubFactor12
= body
.make_temp(btype
, "SubFactor12");
5765 ir_variable
*SubFactor13
= body
.make_temp(btype
, "SubFactor13");
5766 ir_variable
*SubFactor14
= body
.make_temp(btype
, "SubFactor14");
5767 ir_variable
*SubFactor15
= body
.make_temp(btype
, "SubFactor15");
5768 ir_variable
*SubFactor16
= body
.make_temp(btype
, "SubFactor16");
5769 ir_variable
*SubFactor17
= body
.make_temp(btype
, "SubFactor17");
5770 ir_variable
*SubFactor18
= body
.make_temp(btype
, "SubFactor18");
5772 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)))));
5773 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)))));
5774 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)))));
5775 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)))));
5776 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)))));
5777 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)))));
5778 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)))));
5779 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)))));
5780 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)))));
5781 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)))));
5782 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)))));
5783 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)))));
5784 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)))));
5785 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)))));
5786 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)))));
5787 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)))));
5788 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)))));
5789 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)))));
5790 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)))));
5792 ir_variable
*adj
= body
.make_temp(btype
== glsl_type::float_type
? glsl_type::mat4_type
: glsl_type::dmat4_type
, "adj");
5793 body
.emit(assign(array_ref(adj
, 0),
5794 add(sub(mul(matrix_elt(m
, 1, 1), SubFactor00
),
5795 mul(matrix_elt(m
, 1, 2), SubFactor01
)),
5796 mul(matrix_elt(m
, 1, 3), SubFactor02
)),
5798 body
.emit(assign(array_ref(adj
, 1), neg(
5799 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor00
),
5800 mul(matrix_elt(m
, 1, 2), SubFactor03
)),
5801 mul(matrix_elt(m
, 1, 3), SubFactor04
))),
5803 body
.emit(assign(array_ref(adj
, 2),
5804 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor01
),
5805 mul(matrix_elt(m
, 1, 1), SubFactor03
)),
5806 mul(matrix_elt(m
, 1, 3), SubFactor05
)),
5808 body
.emit(assign(array_ref(adj
, 3), neg(
5809 add(sub(mul(matrix_elt(m
, 1, 0), SubFactor02
),
5810 mul(matrix_elt(m
, 1, 1), SubFactor04
)),
5811 mul(matrix_elt(m
, 1, 2), SubFactor05
))),
5814 body
.emit(assign(array_ref(adj
, 0), neg(
5815 add(sub(mul(matrix_elt(m
, 0, 1), SubFactor00
),
5816 mul(matrix_elt(m
, 0, 2), SubFactor01
)),
5817 mul(matrix_elt(m
, 0, 3), SubFactor02
))),
5819 body
.emit(assign(array_ref(adj
, 1),
5820 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor00
),
5821 mul(matrix_elt(m
, 0, 2), SubFactor03
)),
5822 mul(matrix_elt(m
, 0, 3), SubFactor04
)),
5824 body
.emit(assign(array_ref(adj
, 2), neg(
5825 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor01
),
5826 mul(matrix_elt(m
, 0, 1), SubFactor03
)),
5827 mul(matrix_elt(m
, 0, 3), SubFactor05
))),
5829 body
.emit(assign(array_ref(adj
, 3),
5830 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor02
),
5831 mul(matrix_elt(m
, 0, 1), SubFactor04
)),
5832 mul(matrix_elt(m
, 0, 2), SubFactor05
)),
5835 body
.emit(assign(array_ref(adj
, 0),
5836 add(sub(mul(matrix_elt(m
, 0, 1), SubFactor06
),
5837 mul(matrix_elt(m
, 0, 2), SubFactor07
)),
5838 mul(matrix_elt(m
, 0, 3), SubFactor08
)),
5840 body
.emit(assign(array_ref(adj
, 1), neg(
5841 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor06
),
5842 mul(matrix_elt(m
, 0, 2), SubFactor09
)),
5843 mul(matrix_elt(m
, 0, 3), SubFactor10
))),
5845 body
.emit(assign(array_ref(adj
, 2),
5846 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor11
),
5847 mul(matrix_elt(m
, 0, 1), SubFactor09
)),
5848 mul(matrix_elt(m
, 0, 3), SubFactor12
)),
5850 body
.emit(assign(array_ref(adj
, 3), neg(
5851 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor08
),
5852 mul(matrix_elt(m
, 0, 1), SubFactor10
)),
5853 mul(matrix_elt(m
, 0, 2), SubFactor12
))),
5856 body
.emit(assign(array_ref(adj
, 0), neg(
5857 add(sub(mul(matrix_elt(m
, 0, 1), SubFactor13
),
5858 mul(matrix_elt(m
, 0, 2), SubFactor14
)),
5859 mul(matrix_elt(m
, 0, 3), SubFactor15
))),
5861 body
.emit(assign(array_ref(adj
, 1),
5862 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor13
),
5863 mul(matrix_elt(m
, 0, 2), SubFactor16
)),
5864 mul(matrix_elt(m
, 0, 3), SubFactor17
)),
5866 body
.emit(assign(array_ref(adj
, 2), neg(
5867 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor14
),
5868 mul(matrix_elt(m
, 0, 1), SubFactor16
)),
5869 mul(matrix_elt(m
, 0, 3), SubFactor18
))),
5871 body
.emit(assign(array_ref(adj
, 3),
5872 add(sub(mul(matrix_elt(m
, 0, 0), SubFactor15
),
5873 mul(matrix_elt(m
, 0, 1), SubFactor17
)),
5874 mul(matrix_elt(m
, 0, 2), SubFactor18
)),
5877 ir_expression
*det
=
5878 add(mul(matrix_elt(m
, 0, 0), matrix_elt(adj
, 0, 0)),
5879 add(mul(matrix_elt(m
, 0, 1), matrix_elt(adj
, 1, 0)),
5880 add(mul(matrix_elt(m
, 0, 2), matrix_elt(adj
, 2, 0)),
5881 mul(matrix_elt(m
, 0, 3), matrix_elt(adj
, 3, 0)))));
5883 body
.emit(ret(div(adj
, det
)));
5889 ir_function_signature
*
5890 builtin_builder::_lessThan(builtin_available_predicate avail
,
5891 const glsl_type
*type
)
5893 return binop(avail
, ir_binop_less
,
5894 glsl_type::bvec(type
->vector_elements
), type
, type
);
5897 ir_function_signature
*
5898 builtin_builder::_lessThanEqual(builtin_available_predicate avail
,
5899 const glsl_type
*type
)
5901 return binop(avail
, ir_binop_gequal
,
5902 glsl_type::bvec(type
->vector_elements
), type
, type
,
5906 ir_function_signature
*
5907 builtin_builder::_greaterThan(builtin_available_predicate avail
,
5908 const glsl_type
*type
)
5910 return binop(avail
, ir_binop_less
,
5911 glsl_type::bvec(type
->vector_elements
), type
, type
,
5915 ir_function_signature
*
5916 builtin_builder::_greaterThanEqual(builtin_available_predicate avail
,
5917 const glsl_type
*type
)
5919 return binop(avail
, ir_binop_gequal
,
5920 glsl_type::bvec(type
->vector_elements
), type
, type
);
5923 ir_function_signature
*
5924 builtin_builder::_equal(builtin_available_predicate avail
,
5925 const glsl_type
*type
)
5927 return binop(avail
, ir_binop_equal
,
5928 glsl_type::bvec(type
->vector_elements
), type
, type
);
5931 ir_function_signature
*
5932 builtin_builder::_notEqual(builtin_available_predicate avail
,
5933 const glsl_type
*type
)
5935 return binop(avail
, ir_binop_nequal
,
5936 glsl_type::bvec(type
->vector_elements
), type
, type
);
5939 ir_function_signature
*
5940 builtin_builder::_any(const glsl_type
*type
)
5942 ir_variable
*v
= in_var(type
, "v");
5943 MAKE_SIG(glsl_type::bool_type
, always_available
, 1, v
);
5945 const unsigned vec_elem
= v
->type
->vector_elements
;
5946 body
.emit(ret(expr(ir_binop_any_nequal
, v
, imm(false, vec_elem
))));
5951 ir_function_signature
*
5952 builtin_builder::_all(const glsl_type
*type
)
5954 ir_variable
*v
= in_var(type
, "v");
5955 MAKE_SIG(glsl_type::bool_type
, always_available
, 1, v
);
5957 const unsigned vec_elem
= v
->type
->vector_elements
;
5958 body
.emit(ret(expr(ir_binop_all_equal
, v
, imm(true, vec_elem
))));
5963 UNOP(not, ir_unop_logic_not
, always_available
)
5966 has_lod(const glsl_type
*sampler_type
)
5968 assert(sampler_type
->is_sampler());
5970 switch (sampler_type
->sampler_dimensionality
) {
5971 case GLSL_SAMPLER_DIM_RECT
:
5972 case GLSL_SAMPLER_DIM_BUF
:
5973 case GLSL_SAMPLER_DIM_MS
:
5980 ir_function_signature
*
5981 builtin_builder::_textureSize(builtin_available_predicate avail
,
5982 const glsl_type
*return_type
,
5983 const glsl_type
*sampler_type
)
5985 ir_variable
*s
= in_var(sampler_type
, "sampler");
5986 /* The sampler always exists; add optional lod later. */
5987 MAKE_SIG(return_type
, avail
, 1, s
);
5989 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_txs
);
5990 tex
->set_sampler(new(mem_ctx
) ir_dereference_variable(s
), return_type
);
5992 if (has_lod(sampler_type
)) {
5993 ir_variable
*lod
= in_var(glsl_type::int_type
, "lod");
5994 sig
->parameters
.push_tail(lod
);
5995 tex
->lod_info
.lod
= var_ref(lod
);
5997 tex
->lod_info
.lod
= imm(0u);
6000 body
.emit(ret(tex
));
6005 ir_function_signature
*
6006 builtin_builder::_textureSamples(builtin_available_predicate avail
,
6007 const glsl_type
*sampler_type
)
6009 ir_variable
*s
= in_var(sampler_type
, "sampler");
6010 MAKE_SIG(glsl_type::int_type
, avail
, 1, s
);
6012 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_texture_samples
);
6013 tex
->set_sampler(new(mem_ctx
) ir_dereference_variable(s
), glsl_type::int_type
);
6014 body
.emit(ret(tex
));
6019 ir_function_signature
*
6020 builtin_builder::_texture(ir_texture_opcode opcode
,
6021 builtin_available_predicate avail
,
6022 const glsl_type
*return_type
,
6023 const glsl_type
*sampler_type
,
6024 const glsl_type
*coord_type
,
6027 ir_variable
*s
= in_var(sampler_type
, "sampler");
6028 ir_variable
*P
= in_var(coord_type
, "P");
6029 /* The sampler and coordinate always exist; add optional parameters later. */
6030 MAKE_SIG(return_type
, avail
, 2, s
, P
);
6032 ir_texture
*tex
= new(mem_ctx
) ir_texture(opcode
);
6033 tex
->set_sampler(var_ref(s
), return_type
);
6035 const int coord_size
= sampler_type
->coordinate_components();
6037 if (coord_size
== coord_type
->vector_elements
) {
6038 tex
->coordinate
= var_ref(P
);
6040 /* The incoming coordinate also has the projector or shadow comparator,
6041 * so we need to swizzle those away.
6043 tex
->coordinate
= swizzle_for_size(P
, coord_size
);
6046 /* The projector is always in the last component. */
6047 if (flags
& TEX_PROJECT
)
6048 tex
->projector
= swizzle(P
, coord_type
->vector_elements
- 1, 1);
6050 if (sampler_type
->sampler_shadow
) {
6051 if (opcode
== ir_tg4
) {
6052 /* gather has refz as a separate parameter, immediately after the
6055 ir_variable
*refz
= in_var(glsl_type::float_type
, "refz");
6056 sig
->parameters
.push_tail(refz
);
6057 tex
->shadow_comparator
= var_ref(refz
);
6059 /* The shadow comparator is normally in the Z component, but a few types
6060 * have sufficiently large coordinates that it's in W.
6062 tex
->shadow_comparator
= swizzle(P
, MAX2(coord_size
, SWIZZLE_Z
), 1);
6066 if (opcode
== ir_txl
) {
6067 ir_variable
*lod
= in_var(glsl_type::float_type
, "lod");
6068 sig
->parameters
.push_tail(lod
);
6069 tex
->lod_info
.lod
= var_ref(lod
);
6070 } else if (opcode
== ir_txd
) {
6071 int grad_size
= coord_size
- (sampler_type
->sampler_array
? 1 : 0);
6072 ir_variable
*dPdx
= in_var(glsl_type::vec(grad_size
), "dPdx");
6073 ir_variable
*dPdy
= in_var(glsl_type::vec(grad_size
), "dPdy");
6074 sig
->parameters
.push_tail(dPdx
);
6075 sig
->parameters
.push_tail(dPdy
);
6076 tex
->lod_info
.grad
.dPdx
= var_ref(dPdx
);
6077 tex
->lod_info
.grad
.dPdy
= var_ref(dPdy
);
6080 if (flags
& (TEX_OFFSET
| TEX_OFFSET_NONCONST
)) {
6081 int offset_size
= coord_size
- (sampler_type
->sampler_array
? 1 : 0);
6082 ir_variable
*offset
=
6083 new(mem_ctx
) ir_variable(glsl_type::ivec(offset_size
), "offset",
6084 (flags
& TEX_OFFSET
) ? ir_var_const_in
: ir_var_function_in
);
6085 sig
->parameters
.push_tail(offset
);
6086 tex
->offset
= var_ref(offset
);
6089 if (flags
& TEX_OFFSET_ARRAY
) {
6090 ir_variable
*offsets
=
6091 new(mem_ctx
) ir_variable(glsl_type::get_array_instance(glsl_type::ivec2_type
, 4),
6092 "offsets", ir_var_const_in
);
6093 sig
->parameters
.push_tail(offsets
);
6094 tex
->offset
= var_ref(offsets
);
6097 if (opcode
== ir_tg4
) {
6098 if (flags
& TEX_COMPONENT
) {
6099 ir_variable
*component
=
6100 new(mem_ctx
) ir_variable(glsl_type::int_type
, "comp", ir_var_const_in
);
6101 sig
->parameters
.push_tail(component
);
6102 tex
->lod_info
.component
= var_ref(component
);
6105 tex
->lod_info
.component
= imm(0);
6109 /* The "bias" parameter comes /after/ the "offset" parameter, which is
6110 * inconsistent with both textureLodOffset and textureGradOffset.
6112 if (opcode
== ir_txb
) {
6113 ir_variable
*bias
= in_var(glsl_type::float_type
, "bias");
6114 sig
->parameters
.push_tail(bias
);
6115 tex
->lod_info
.bias
= var_ref(bias
);
6118 body
.emit(ret(tex
));
6123 ir_function_signature
*
6124 builtin_builder::_textureCubeArrayShadow(ir_texture_opcode opcode
,
6125 builtin_available_predicate avail
,
6126 const glsl_type
*sampler_type
)
6128 ir_variable
*s
= in_var(sampler_type
, "sampler");
6129 ir_variable
*P
= in_var(glsl_type::vec4_type
, "P");
6130 ir_variable
*compare
= in_var(glsl_type::float_type
, "compare");
6131 MAKE_SIG(glsl_type::float_type
, avail
, 3, s
, P
, compare
);
6133 ir_texture
*tex
= new(mem_ctx
) ir_texture(opcode
);
6134 tex
->set_sampler(var_ref(s
), glsl_type::float_type
);
6136 tex
->coordinate
= var_ref(P
);
6137 tex
->shadow_comparator
= var_ref(compare
);
6139 if (opcode
== ir_txb
) {
6140 ir_variable
*bias
= in_var(glsl_type::float_type
, "bias");
6141 sig
->parameters
.push_tail(bias
);
6142 tex
->lod_info
.bias
= var_ref(bias
);
6145 if (opcode
== ir_txl
) {
6146 ir_variable
*lod
= in_var(glsl_type::float_type
, "lod");
6147 sig
->parameters
.push_tail(lod
);
6148 tex
->lod_info
.lod
= var_ref(lod
);
6151 body
.emit(ret(tex
));
6156 ir_function_signature
*
6157 builtin_builder::_texelFetch(builtin_available_predicate avail
,
6158 const glsl_type
*return_type
,
6159 const glsl_type
*sampler_type
,
6160 const glsl_type
*coord_type
,
6161 const glsl_type
*offset_type
)
6163 ir_variable
*s
= in_var(sampler_type
, "sampler");
6164 ir_variable
*P
= in_var(coord_type
, "P");
6165 /* The sampler and coordinate always exist; add optional parameters later. */
6166 MAKE_SIG(return_type
, avail
, 2, s
, P
);
6168 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_txf
);
6169 tex
->coordinate
= var_ref(P
);
6170 tex
->set_sampler(var_ref(s
), return_type
);
6172 if (sampler_type
->sampler_dimensionality
== GLSL_SAMPLER_DIM_MS
) {
6173 ir_variable
*sample
= in_var(glsl_type::int_type
, "sample");
6174 sig
->parameters
.push_tail(sample
);
6175 tex
->lod_info
.sample_index
= var_ref(sample
);
6176 tex
->op
= ir_txf_ms
;
6177 } else if (has_lod(sampler_type
)) {
6178 ir_variable
*lod
= in_var(glsl_type::int_type
, "lod");
6179 sig
->parameters
.push_tail(lod
);
6180 tex
->lod_info
.lod
= var_ref(lod
);
6182 tex
->lod_info
.lod
= imm(0u);
6185 if (offset_type
!= NULL
) {
6186 ir_variable
*offset
=
6187 new(mem_ctx
) ir_variable(offset_type
, "offset", ir_var_const_in
);
6188 sig
->parameters
.push_tail(offset
);
6189 tex
->offset
= var_ref(offset
);
6192 body
.emit(ret(tex
));
6197 ir_function_signature
*
6198 builtin_builder::_EmitVertex()
6200 MAKE_SIG(glsl_type::void_type
, gs_only
, 0);
6202 ir_rvalue
*stream
= new(mem_ctx
) ir_constant(0, 1);
6203 body
.emit(new(mem_ctx
) ir_emit_vertex(stream
));
6208 ir_function_signature
*
6209 builtin_builder::_EmitStreamVertex(builtin_available_predicate avail
,
6210 const glsl_type
*stream_type
)
6212 /* Section 8.12 (Geometry Shader Functions) of the GLSL 4.0 spec says:
6214 * "Emit the current values of output variables to the current output
6215 * primitive on stream stream. The argument to stream must be a constant
6216 * integral expression."
6218 ir_variable
*stream
=
6219 new(mem_ctx
) ir_variable(stream_type
, "stream", ir_var_const_in
);
6221 MAKE_SIG(glsl_type::void_type
, avail
, 1, stream
);
6223 body
.emit(new(mem_ctx
) ir_emit_vertex(var_ref(stream
)));
6228 ir_function_signature
*
6229 builtin_builder::_EndPrimitive()
6231 MAKE_SIG(glsl_type::void_type
, gs_only
, 0);
6233 ir_rvalue
*stream
= new(mem_ctx
) ir_constant(0, 1);
6234 body
.emit(new(mem_ctx
) ir_end_primitive(stream
));
6239 ir_function_signature
*
6240 builtin_builder::_EndStreamPrimitive(builtin_available_predicate avail
,
6241 const glsl_type
*stream_type
)
6243 /* Section 8.12 (Geometry Shader Functions) of the GLSL 4.0 spec says:
6245 * "Completes the current output primitive on stream stream and starts
6246 * a new one. The argument to stream must be a constant integral
6249 ir_variable
*stream
=
6250 new(mem_ctx
) ir_variable(stream_type
, "stream", ir_var_const_in
);
6252 MAKE_SIG(glsl_type::void_type
, avail
, 1, stream
);
6254 body
.emit(new(mem_ctx
) ir_end_primitive(var_ref(stream
)));
6259 ir_function_signature
*
6260 builtin_builder::_barrier()
6262 MAKE_SIG(glsl_type::void_type
, barrier_supported
, 0);
6264 body
.emit(new(mem_ctx
) ir_barrier());
6268 ir_function_signature
*
6269 builtin_builder::_textureQueryLod(builtin_available_predicate avail
,
6270 const glsl_type
*sampler_type
,
6271 const glsl_type
*coord_type
)
6273 ir_variable
*s
= in_var(sampler_type
, "sampler");
6274 ir_variable
*coord
= in_var(coord_type
, "coord");
6275 /* The sampler and coordinate always exist; add optional parameters later. */
6276 MAKE_SIG(glsl_type::vec2_type
, avail
, 2, s
, coord
);
6278 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_lod
);
6279 tex
->coordinate
= var_ref(coord
);
6280 tex
->set_sampler(var_ref(s
), glsl_type::vec2_type
);
6282 body
.emit(ret(tex
));
6287 ir_function_signature
*
6288 builtin_builder::_textureQueryLevels(builtin_available_predicate avail
,
6289 const glsl_type
*sampler_type
)
6291 ir_variable
*s
= in_var(sampler_type
, "sampler");
6292 const glsl_type
*return_type
= glsl_type::int_type
;
6293 MAKE_SIG(return_type
, avail
, 1, s
);
6295 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_query_levels
);
6296 tex
->set_sampler(var_ref(s
), return_type
);
6298 body
.emit(ret(tex
));
6303 ir_function_signature
*
6304 builtin_builder::_textureSamplesIdentical(builtin_available_predicate avail
,
6305 const glsl_type
*sampler_type
,
6306 const glsl_type
*coord_type
)
6308 ir_variable
*s
= in_var(sampler_type
, "sampler");
6309 ir_variable
*P
= in_var(coord_type
, "P");
6310 const glsl_type
*return_type
= glsl_type::bool_type
;
6311 MAKE_SIG(return_type
, avail
, 2, s
, P
);
6313 ir_texture
*tex
= new(mem_ctx
) ir_texture(ir_samples_identical
);
6314 tex
->coordinate
= var_ref(P
);
6315 tex
->set_sampler(var_ref(s
), return_type
);
6317 body
.emit(ret(tex
));
6322 UNOP(dFdx
, ir_unop_dFdx
, derivatives
)
6323 UNOP(dFdxCoarse
, ir_unop_dFdx_coarse
, derivative_control
)
6324 UNOP(dFdxFine
, ir_unop_dFdx_fine
, derivative_control
)
6325 UNOP(dFdy
, ir_unop_dFdy
, derivatives
)
6326 UNOP(dFdyCoarse
, ir_unop_dFdy_coarse
, derivative_control
)
6327 UNOP(dFdyFine
, ir_unop_dFdy_fine
, derivative_control
)
6329 ir_function_signature
*
6330 builtin_builder::_fwidth(const glsl_type
*type
)
6332 ir_variable
*p
= in_var(type
, "p");
6333 MAKE_SIG(type
, derivatives
, 1, p
);
6335 body
.emit(ret(add(abs(expr(ir_unop_dFdx
, p
)), abs(expr(ir_unop_dFdy
, p
)))));
6340 ir_function_signature
*
6341 builtin_builder::_fwidthCoarse(const glsl_type
*type
)
6343 ir_variable
*p
= in_var(type
, "p");
6344 MAKE_SIG(type
, derivative_control
, 1, p
);
6346 body
.emit(ret(add(abs(expr(ir_unop_dFdx_coarse
, p
)),
6347 abs(expr(ir_unop_dFdy_coarse
, p
)))));
6352 ir_function_signature
*
6353 builtin_builder::_fwidthFine(const glsl_type
*type
)
6355 ir_variable
*p
= in_var(type
, "p");
6356 MAKE_SIG(type
, derivative_control
, 1, p
);
6358 body
.emit(ret(add(abs(expr(ir_unop_dFdx_fine
, p
)),
6359 abs(expr(ir_unop_dFdy_fine
, p
)))));
6364 ir_function_signature
*
6365 builtin_builder::_noise1(const glsl_type
*type
)
6367 return unop(v110
, ir_unop_noise
, glsl_type::float_type
, type
);
6370 ir_function_signature
*
6371 builtin_builder::_noise2(const glsl_type
*type
)
6373 ir_variable
*p
= in_var(type
, "p");
6374 MAKE_SIG(glsl_type::vec2_type
, v110
, 1, p
);
6376 ir_constant_data b_offset
;
6377 b_offset
.f
[0] = 601.0f
;
6378 b_offset
.f
[1] = 313.0f
;
6379 b_offset
.f
[2] = 29.0f
;
6380 b_offset
.f
[3] = 277.0f
;
6382 ir_variable
*a
= body
.make_temp(glsl_type::float_type
, "a");
6383 ir_variable
*b
= body
.make_temp(glsl_type::float_type
, "b");
6384 ir_variable
*t
= body
.make_temp(glsl_type::vec2_type
, "t");
6385 body
.emit(assign(a
, expr(ir_unop_noise
, p
)));
6386 body
.emit(assign(b
, expr(ir_unop_noise
, add(p
, imm(type
, b_offset
)))));
6387 body
.emit(assign(t
, a
, WRITEMASK_X
));
6388 body
.emit(assign(t
, b
, WRITEMASK_Y
));
6394 ir_function_signature
*
6395 builtin_builder::_noise3(const glsl_type
*type
)
6397 ir_variable
*p
= in_var(type
, "p");
6398 MAKE_SIG(glsl_type::vec3_type
, v110
, 1, p
);
6400 ir_constant_data b_offset
;
6401 b_offset
.f
[0] = 601.0f
;
6402 b_offset
.f
[1] = 313.0f
;
6403 b_offset
.f
[2] = 29.0f
;
6404 b_offset
.f
[3] = 277.0f
;
6406 ir_constant_data c_offset
;
6407 c_offset
.f
[0] = 1559.0f
;
6408 c_offset
.f
[1] = 113.0f
;
6409 c_offset
.f
[2] = 1861.0f
;
6410 c_offset
.f
[3] = 797.0f
;
6412 ir_variable
*a
= body
.make_temp(glsl_type::float_type
, "a");
6413 ir_variable
*b
= body
.make_temp(glsl_type::float_type
, "b");
6414 ir_variable
*c
= body
.make_temp(glsl_type::float_type
, "c");
6415 ir_variable
*t
= body
.make_temp(glsl_type::vec3_type
, "t");
6416 body
.emit(assign(a
, expr(ir_unop_noise
, p
)));
6417 body
.emit(assign(b
, expr(ir_unop_noise
, add(p
, imm(type
, b_offset
)))));
6418 body
.emit(assign(c
, expr(ir_unop_noise
, add(p
, imm(type
, c_offset
)))));
6419 body
.emit(assign(t
, a
, WRITEMASK_X
));
6420 body
.emit(assign(t
, b
, WRITEMASK_Y
));
6421 body
.emit(assign(t
, c
, WRITEMASK_Z
));
6427 ir_function_signature
*
6428 builtin_builder::_noise4(const glsl_type
*type
)
6430 ir_variable
*p
= in_var(type
, "p");
6431 MAKE_SIG(glsl_type::vec4_type
, v110
, 1, p
);
6433 ir_variable
*_p
= body
.make_temp(type
, "_p");
6435 ir_constant_data p_offset
;
6436 p_offset
.f
[0] = 1559.0f
;
6437 p_offset
.f
[1] = 113.0f
;
6438 p_offset
.f
[2] = 1861.0f
;
6439 p_offset
.f
[3] = 797.0f
;
6441 body
.emit(assign(_p
, add(p
, imm(type
, p_offset
))));
6443 ir_constant_data offset
;
6444 offset
.f
[0] = 601.0f
;
6445 offset
.f
[1] = 313.0f
;
6446 offset
.f
[2] = 29.0f
;
6447 offset
.f
[3] = 277.0f
;
6449 ir_variable
*a
= body
.make_temp(glsl_type::float_type
, "a");
6450 ir_variable
*b
= body
.make_temp(glsl_type::float_type
, "b");
6451 ir_variable
*c
= body
.make_temp(glsl_type::float_type
, "c");
6452 ir_variable
*d
= body
.make_temp(glsl_type::float_type
, "d");
6453 ir_variable
*t
= body
.make_temp(glsl_type::vec4_type
, "t");
6454 body
.emit(assign(a
, expr(ir_unop_noise
, p
)));
6455 body
.emit(assign(b
, expr(ir_unop_noise
, add(p
, imm(type
, offset
)))));
6456 body
.emit(assign(c
, expr(ir_unop_noise
, _p
)));
6457 body
.emit(assign(d
, expr(ir_unop_noise
, add(_p
, imm(type
, offset
)))));
6458 body
.emit(assign(t
, a
, WRITEMASK_X
));
6459 body
.emit(assign(t
, b
, WRITEMASK_Y
));
6460 body
.emit(assign(t
, c
, WRITEMASK_Z
));
6461 body
.emit(assign(t
, d
, WRITEMASK_W
));
6467 ir_function_signature
*
6468 builtin_builder::_bitfieldExtract(const glsl_type
*type
)
6470 bool is_uint
= type
->base_type
== GLSL_TYPE_UINT
;
6471 ir_variable
*value
= in_var(type
, "value");
6472 ir_variable
*offset
= in_var(glsl_type::int_type
, "offset");
6473 ir_variable
*bits
= in_var(glsl_type::int_type
, "bits");
6474 MAKE_SIG(type
, gpu_shader5_or_es31_or_integer_functions
, 3, value
, offset
,
6477 operand cast_offset
= is_uint
? i2u(offset
) : operand(offset
);
6478 operand cast_bits
= is_uint
? i2u(bits
) : operand(bits
);
6480 body
.emit(ret(expr(ir_triop_bitfield_extract
, value
,
6481 swizzle(cast_offset
, SWIZZLE_XXXX
, type
->vector_elements
),
6482 swizzle(cast_bits
, SWIZZLE_XXXX
, type
->vector_elements
))));
6487 ir_function_signature
*
6488 builtin_builder::_bitfieldInsert(const glsl_type
*type
)
6490 bool is_uint
= type
->base_type
== GLSL_TYPE_UINT
;
6491 ir_variable
*base
= in_var(type
, "base");
6492 ir_variable
*insert
= in_var(type
, "insert");
6493 ir_variable
*offset
= in_var(glsl_type::int_type
, "offset");
6494 ir_variable
*bits
= in_var(glsl_type::int_type
, "bits");
6495 MAKE_SIG(type
, gpu_shader5_or_es31_or_integer_functions
, 4, base
, insert
,
6498 operand cast_offset
= is_uint
? i2u(offset
) : operand(offset
);
6499 operand cast_bits
= is_uint
? i2u(bits
) : operand(bits
);
6501 body
.emit(ret(bitfield_insert(base
, insert
,
6502 swizzle(cast_offset
, SWIZZLE_XXXX
, type
->vector_elements
),
6503 swizzle(cast_bits
, SWIZZLE_XXXX
, type
->vector_elements
))));
6508 UNOP(bitfieldReverse
, ir_unop_bitfield_reverse
, gpu_shader5_or_es31_or_integer_functions
)
6510 ir_function_signature
*
6511 builtin_builder::_bitCount(const glsl_type
*type
)
6513 return unop(gpu_shader5_or_es31_or_integer_functions
, ir_unop_bit_count
,
6514 glsl_type::ivec(type
->vector_elements
), type
);
6517 ir_function_signature
*
6518 builtin_builder::_findLSB(const glsl_type
*type
)
6520 return unop(gpu_shader5_or_es31_or_integer_functions
, ir_unop_find_lsb
,
6521 glsl_type::ivec(type
->vector_elements
), type
);
6524 ir_function_signature
*
6525 builtin_builder::_findMSB(const glsl_type
*type
)
6527 return unop(gpu_shader5_or_es31_or_integer_functions
, ir_unop_find_msb
,
6528 glsl_type::ivec(type
->vector_elements
), type
);
6531 ir_function_signature
*
6532 builtin_builder::_fma(builtin_available_predicate avail
, const glsl_type
*type
)
6534 ir_variable
*a
= in_var(type
, "a");
6535 ir_variable
*b
= in_var(type
, "b");
6536 ir_variable
*c
= in_var(type
, "c");
6537 MAKE_SIG(type
, avail
, 3, a
, b
, c
);
6539 body
.emit(ret(ir_builder::fma(a
, b
, c
)));
6544 ir_function_signature
*
6545 builtin_builder::_ldexp(const glsl_type
*x_type
, const glsl_type
*exp_type
)
6547 return binop(x_type
->is_double() ? fp64
: gpu_shader5_or_es31_or_integer_functions
,
6548 ir_binop_ldexp
, x_type
, x_type
, exp_type
);
6551 ir_function_signature
*
6552 builtin_builder::_dfrexp(const glsl_type
*x_type
, const glsl_type
*exp_type
)
6554 ir_variable
*x
= in_var(x_type
, "x");
6555 ir_variable
*exponent
= out_var(exp_type
, "exp");
6556 MAKE_SIG(x_type
, fp64
, 2, x
, exponent
);
6558 body
.emit(assign(exponent
, expr(ir_unop_frexp_exp
, x
)));
6560 body
.emit(ret(expr(ir_unop_frexp_sig
, x
)));
6564 ir_function_signature
*
6565 builtin_builder::_frexp(const glsl_type
*x_type
, const glsl_type
*exp_type
)
6567 ir_variable
*x
= in_var(x_type
, "x");
6568 ir_variable
*exponent
= out_var(exp_type
, "exp");
6569 MAKE_SIG(x_type
, gpu_shader5_or_es31_or_integer_functions
, 2, x
, exponent
);
6571 const unsigned vec_elem
= x_type
->vector_elements
;
6572 const glsl_type
*bvec
= glsl_type::get_instance(GLSL_TYPE_BOOL
, vec_elem
, 1);
6573 const glsl_type
*uvec
= glsl_type::get_instance(GLSL_TYPE_UINT
, vec_elem
, 1);
6575 /* Single-precision floating-point values are stored as
6580 * An exponent shift of 23 will shift the mantissa out, leaving only the
6581 * exponent and sign bit (which itself may be zero, if the absolute value
6582 * was taken before the bitcast and shift.
6584 ir_constant
*exponent_shift
= imm(23);
6585 ir_constant
*exponent_bias
= imm(-126, vec_elem
);
6587 ir_constant
*sign_mantissa_mask
= imm(0x807fffffu
, vec_elem
);
6589 /* Exponent of floating-point values in the range [0.5, 1.0). */
6590 ir_constant
*exponent_value
= imm(0x3f000000u
, vec_elem
);
6592 ir_variable
*is_not_zero
= body
.make_temp(bvec
, "is_not_zero");
6593 body
.emit(assign(is_not_zero
, nequal(abs(x
), imm(0.0f
, vec_elem
))));
6595 /* Since abs(x) ensures that the sign bit is zero, we don't need to bitcast
6596 * to unsigned integers to ensure that 1 bits aren't shifted in.
6598 body
.emit(assign(exponent
, rshift(bitcast_f2i(abs(x
)), exponent_shift
)));
6599 body
.emit(assign(exponent
, add(exponent
, csel(is_not_zero
, exponent_bias
,
6600 imm(0, vec_elem
)))));
6602 ir_variable
*bits
= body
.make_temp(uvec
, "bits");
6603 body
.emit(assign(bits
, bitcast_f2u(x
)));
6604 body
.emit(assign(bits
, bit_and(bits
, sign_mantissa_mask
)));
6605 body
.emit(assign(bits
, bit_or(bits
, csel(is_not_zero
, exponent_value
,
6606 imm(0u, vec_elem
)))));
6607 body
.emit(ret(bitcast_u2f(bits
)));
6612 ir_function_signature
*
6613 builtin_builder::_uaddCarry(const glsl_type
*type
)
6615 ir_variable
*x
= in_var(type
, "x");
6616 ir_variable
*y
= in_var(type
, "y");
6617 ir_variable
*carry
= out_var(type
, "carry");
6618 MAKE_SIG(type
, gpu_shader5_or_es31_or_integer_functions
, 3, x
, y
, carry
);
6620 body
.emit(assign(carry
, ir_builder::carry(x
, y
)));
6621 body
.emit(ret(add(x
, y
)));
6626 ir_function_signature
*
6627 builtin_builder::_usubBorrow(const glsl_type
*type
)
6629 ir_variable
*x
= in_var(type
, "x");
6630 ir_variable
*y
= in_var(type
, "y");
6631 ir_variable
*borrow
= out_var(type
, "borrow");
6632 MAKE_SIG(type
, gpu_shader5_or_es31_or_integer_functions
, 3, x
, y
, borrow
);
6634 body
.emit(assign(borrow
, ir_builder::borrow(x
, y
)));
6635 body
.emit(ret(sub(x
, y
)));
6641 * For both imulExtended() and umulExtended() built-ins.
6643 ir_function_signature
*
6644 builtin_builder::_mulExtended(const glsl_type
*type
)
6646 const glsl_type
*mul_type
, *unpack_type
;
6647 ir_expression_operation unpack_op
;
6649 if (type
->base_type
== GLSL_TYPE_INT
) {
6650 unpack_op
= ir_unop_unpack_int_2x32
;
6651 mul_type
= glsl_type::get_instance(GLSL_TYPE_INT64
, type
->vector_elements
, 1);
6652 unpack_type
= glsl_type::ivec2_type
;
6654 unpack_op
= ir_unop_unpack_uint_2x32
;
6655 mul_type
= glsl_type::get_instance(GLSL_TYPE_UINT64
, type
->vector_elements
, 1);
6656 unpack_type
= glsl_type::uvec2_type
;
6659 ir_variable
*x
= in_var(type
, "x");
6660 ir_variable
*y
= in_var(type
, "y");
6661 ir_variable
*msb
= out_var(type
, "msb");
6662 ir_variable
*lsb
= out_var(type
, "lsb");
6663 MAKE_SIG(glsl_type::void_type
, gpu_shader5_or_es31_or_integer_functions
, 4, x
, y
, msb
, lsb
);
6665 ir_variable
*unpack_val
= body
.make_temp(unpack_type
, "_unpack_val");
6667 ir_expression
*mul_res
= new(mem_ctx
) ir_expression(ir_binop_mul
, mul_type
,
6668 new(mem_ctx
)ir_dereference_variable(x
),
6669 new(mem_ctx
)ir_dereference_variable(y
));
6671 if (type
->vector_elements
== 1) {
6672 body
.emit(assign(unpack_val
, expr(unpack_op
, mul_res
)));
6673 body
.emit(assign(msb
, swizzle_y(unpack_val
)));
6674 body
.emit(assign(lsb
, swizzle_x(unpack_val
)));
6676 for (int i
= 0; i
< type
->vector_elements
; i
++) {
6677 body
.emit(assign(unpack_val
, expr(unpack_op
, swizzle(mul_res
, i
, 1))));
6678 body
.emit(assign(array_ref(msb
, i
), swizzle_y(unpack_val
)));
6679 body
.emit(assign(array_ref(lsb
, i
), swizzle_x(unpack_val
)));
6686 ir_function_signature
*
6687 builtin_builder::_interpolateAtCentroid(const glsl_type
*type
)
6689 ir_variable
*interpolant
= in_var(type
, "interpolant");
6690 interpolant
->data
.must_be_shader_input
= 1;
6691 MAKE_SIG(type
, fs_interpolate_at
, 1, interpolant
);
6693 body
.emit(ret(interpolate_at_centroid(interpolant
)));
6698 ir_function_signature
*
6699 builtin_builder::_interpolateAtOffset(const glsl_type
*type
)
6701 ir_variable
*interpolant
= in_var(type
, "interpolant");
6702 interpolant
->data
.must_be_shader_input
= 1;
6703 ir_variable
*offset
= in_var(glsl_type::vec2_type
, "offset");
6704 MAKE_SIG(type
, fs_interpolate_at
, 2, interpolant
, offset
);
6706 body
.emit(ret(interpolate_at_offset(interpolant
, offset
)));
6711 ir_function_signature
*
6712 builtin_builder::_interpolateAtSample(const glsl_type
*type
)
6714 ir_variable
*interpolant
= in_var(type
, "interpolant");
6715 interpolant
->data
.must_be_shader_input
= 1;
6716 ir_variable
*sample_num
= in_var(glsl_type::int_type
, "sample_num");
6717 MAKE_SIG(type
, fs_interpolate_at
, 2, interpolant
, sample_num
);
6719 body
.emit(ret(interpolate_at_sample(interpolant
, sample_num
)));
6724 ir_function_signature
*
6725 builtin_builder::_atomic_counter_intrinsic(builtin_available_predicate avail
,
6726 enum ir_intrinsic_id id
)
6728 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "counter");
6729 MAKE_INTRINSIC(glsl_type::uint_type
, id
, avail
, 1, counter
);
6733 ir_function_signature
*
6734 builtin_builder::_atomic_counter_intrinsic1(builtin_available_predicate avail
,
6735 enum ir_intrinsic_id id
)
6737 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "counter");
6738 ir_variable
*data
= in_var(glsl_type::uint_type
, "data");
6739 MAKE_INTRINSIC(glsl_type::uint_type
, id
, avail
, 2, counter
, data
);
6743 ir_function_signature
*
6744 builtin_builder::_atomic_counter_intrinsic2(builtin_available_predicate avail
,
6745 enum ir_intrinsic_id id
)
6747 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "counter");
6748 ir_variable
*compare
= in_var(glsl_type::uint_type
, "compare");
6749 ir_variable
*data
= in_var(glsl_type::uint_type
, "data");
6750 MAKE_INTRINSIC(glsl_type::uint_type
, id
, avail
, 3, counter
, compare
, data
);
6754 ir_function_signature
*
6755 builtin_builder::_atomic_intrinsic2(builtin_available_predicate avail
,
6756 const glsl_type
*type
,
6757 enum ir_intrinsic_id id
)
6759 ir_variable
*atomic
= in_var(type
, "atomic");
6760 ir_variable
*data
= in_var(type
, "data");
6761 MAKE_INTRINSIC(type
, id
, avail
, 2, atomic
, data
);
6765 ir_function_signature
*
6766 builtin_builder::_atomic_intrinsic3(builtin_available_predicate avail
,
6767 const glsl_type
*type
,
6768 enum ir_intrinsic_id id
)
6770 ir_variable
*atomic
= in_var(type
, "atomic");
6771 ir_variable
*data1
= in_var(type
, "data1");
6772 ir_variable
*data2
= in_var(type
, "data2");
6773 MAKE_INTRINSIC(type
, id
, avail
, 3, atomic
, data1
, data2
);
6777 ir_function_signature
*
6778 builtin_builder::_atomic_counter_op(const char *intrinsic
,
6779 builtin_available_predicate avail
)
6781 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "atomic_counter");
6782 MAKE_SIG(glsl_type::uint_type
, avail
, 1, counter
);
6784 ir_variable
*retval
= body
.make_temp(glsl_type::uint_type
, "atomic_retval");
6785 body
.emit(call(shader
->symbols
->get_function(intrinsic
), retval
,
6787 body
.emit(ret(retval
));
6791 ir_function_signature
*
6792 builtin_builder::_atomic_counter_op1(const char *intrinsic
,
6793 builtin_available_predicate avail
)
6795 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "atomic_counter");
6796 ir_variable
*data
= in_var(glsl_type::uint_type
, "data");
6797 MAKE_SIG(glsl_type::uint_type
, avail
, 2, counter
, data
);
6799 ir_variable
*retval
= body
.make_temp(glsl_type::uint_type
, "atomic_retval");
6801 /* Instead of generating an __intrinsic_atomic_sub, generate an
6802 * __intrinsic_atomic_add with the data parameter negated.
6804 if (strcmp("__intrinsic_atomic_sub", intrinsic
) == 0) {
6805 ir_variable
*const neg_data
=
6806 body
.make_temp(glsl_type::uint_type
, "neg_data");
6808 body
.emit(assign(neg_data
, neg(data
)));
6810 exec_list parameters
;
6812 parameters
.push_tail(new(mem_ctx
) ir_dereference_variable(counter
));
6813 parameters
.push_tail(new(mem_ctx
) ir_dereference_variable(neg_data
));
6815 ir_function
*const func
=
6816 shader
->symbols
->get_function("__intrinsic_atomic_add");
6817 ir_instruction
*const c
= call(func
, retval
, parameters
);
6820 assert(parameters
.is_empty());
6824 body
.emit(call(shader
->symbols
->get_function(intrinsic
), retval
,
6828 body
.emit(ret(retval
));
6832 ir_function_signature
*
6833 builtin_builder::_atomic_counter_op2(const char *intrinsic
,
6834 builtin_available_predicate avail
)
6836 ir_variable
*counter
= in_var(glsl_type::atomic_uint_type
, "atomic_counter");
6837 ir_variable
*compare
= in_var(glsl_type::uint_type
, "compare");
6838 ir_variable
*data
= in_var(glsl_type::uint_type
, "data");
6839 MAKE_SIG(glsl_type::uint_type
, avail
, 3, counter
, compare
, data
);
6841 ir_variable
*retval
= body
.make_temp(glsl_type::uint_type
, "atomic_retval");
6842 body
.emit(call(shader
->symbols
->get_function(intrinsic
), retval
,
6844 body
.emit(ret(retval
));
6848 ir_function_signature
*
6849 builtin_builder::_atomic_op2(const char *intrinsic
,
6850 builtin_available_predicate avail
,
6851 const glsl_type
*type
)
6853 ir_variable
*atomic
= in_var(type
, "atomic_var");
6854 ir_variable
*data
= in_var(type
, "atomic_data");
6855 MAKE_SIG(type
, avail
, 2, atomic
, data
);
6857 ir_variable
*retval
= body
.make_temp(type
, "atomic_retval");
6858 body
.emit(call(shader
->symbols
->get_function(intrinsic
), retval
,
6860 body
.emit(ret(retval
));
6864 ir_function_signature
*
6865 builtin_builder::_atomic_op3(const char *intrinsic
,
6866 builtin_available_predicate avail
,
6867 const glsl_type
*type
)
6869 ir_variable
*atomic
= in_var(type
, "atomic_var");
6870 ir_variable
*data1
= in_var(type
, "atomic_data1");
6871 ir_variable
*data2
= in_var(type
, "atomic_data2");
6872 MAKE_SIG(type
, avail
, 3, atomic
, data1
, data2
);
6874 ir_variable
*retval
= body
.make_temp(type
, "atomic_retval");
6875 body
.emit(call(shader
->symbols
->get_function(intrinsic
), retval
,
6877 body
.emit(ret(retval
));
6881 ir_function_signature
*
6882 builtin_builder::_min3(const glsl_type
*type
)
6884 ir_variable
*x
= in_var(type
, "x");
6885 ir_variable
*y
= in_var(type
, "y");
6886 ir_variable
*z
= in_var(type
, "z");
6887 MAKE_SIG(type
, shader_trinary_minmax
, 3, x
, y
, z
);
6889 ir_expression
*min3
= min2(x
, min2(y
,z
));
6890 body
.emit(ret(min3
));
6895 ir_function_signature
*
6896 builtin_builder::_max3(const glsl_type
*type
)
6898 ir_variable
*x
= in_var(type
, "x");
6899 ir_variable
*y
= in_var(type
, "y");
6900 ir_variable
*z
= in_var(type
, "z");
6901 MAKE_SIG(type
, shader_trinary_minmax
, 3, x
, y
, z
);
6903 ir_expression
*max3
= max2(x
, max2(y
,z
));
6904 body
.emit(ret(max3
));
6909 ir_function_signature
*
6910 builtin_builder::_mid3(const glsl_type
*type
)
6912 ir_variable
*x
= in_var(type
, "x");
6913 ir_variable
*y
= in_var(type
, "y");
6914 ir_variable
*z
= in_var(type
, "z");
6915 MAKE_SIG(type
, shader_trinary_minmax
, 3, x
, y
, z
);
6917 ir_expression
*mid3
= max2(min2(x
, y
), max2(min2(x
, z
), min2(y
, z
)));
6918 body
.emit(ret(mid3
));
6923 static builtin_available_predicate
6924 get_image_available_predicate(const glsl_type
*type
, unsigned flags
)
6926 if ((flags
& IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE
) &&
6927 type
->sampled_type
== GLSL_TYPE_FLOAT
)
6928 return shader_image_atomic_exchange_float
;
6930 if ((flags
& IMAGE_FUNCTION_AVAIL_ATOMIC_ADD
) &&
6931 type
->sampled_type
== GLSL_TYPE_FLOAT
)
6932 return shader_image_atomic_add_float
;
6934 else if (flags
& (IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE
|
6935 IMAGE_FUNCTION_AVAIL_ATOMIC_ADD
|
6936 IMAGE_FUNCTION_AVAIL_ATOMIC
))
6937 return shader_image_atomic
;
6940 return shader_image_load_store
;
6943 ir_function_signature
*
6944 builtin_builder::_image_prototype(const glsl_type
*image_type
,
6945 unsigned num_arguments
,
6948 const glsl_type
*data_type
= glsl_type::get_instance(
6949 image_type
->sampled_type
,
6950 (flags
& IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE
? 4 : 1),
6952 const glsl_type
*ret_type
= (flags
& IMAGE_FUNCTION_RETURNS_VOID
?
6953 glsl_type::void_type
: data_type
);
6955 /* Addressing arguments that are always present. */
6956 ir_variable
*image
= in_var(image_type
, "image");
6957 ir_variable
*coord
= in_var(
6958 glsl_type::ivec(image_type
->coordinate_components()), "coord");
6960 ir_function_signature
*sig
= new_sig(
6961 ret_type
, get_image_available_predicate(image_type
, flags
),
6964 /* Sample index for multisample images. */
6965 if (image_type
->sampler_dimensionality
== GLSL_SAMPLER_DIM_MS
)
6966 sig
->parameters
.push_tail(in_var(glsl_type::int_type
, "sample"));
6968 /* Data arguments. */
6969 for (unsigned i
= 0; i
< num_arguments
; ++i
) {
6970 char *arg_name
= ralloc_asprintf(NULL
, "arg%d", i
);
6971 sig
->parameters
.push_tail(in_var(data_type
, arg_name
));
6972 ralloc_free(arg_name
);
6975 /* Set the maximal set of qualifiers allowed for this image
6976 * built-in. Function calls with arguments having fewer
6977 * qualifiers than present in the prototype are allowed by the
6978 * spec, but not with more, i.e. this will make the compiler
6979 * accept everything that needs to be accepted, and reject cases
6980 * like loads from write-only or stores to read-only images.
6982 image
->data
.memory_read_only
= (flags
& IMAGE_FUNCTION_READ_ONLY
) != 0;
6983 image
->data
.memory_write_only
= (flags
& IMAGE_FUNCTION_WRITE_ONLY
) != 0;
6984 image
->data
.memory_coherent
= true;
6985 image
->data
.memory_volatile
= true;
6986 image
->data
.memory_restrict
= true;
6991 ir_function_signature
*
6992 builtin_builder::_image_size_prototype(const glsl_type
*image_type
,
6993 unsigned /* num_arguments */,
6994 unsigned /* flags */)
6996 const glsl_type
*ret_type
;
6997 unsigned num_components
= image_type
->coordinate_components();
6999 /* From the ARB_shader_image_size extension:
7000 * "Cube images return the dimensions of one face."
7002 if (image_type
->sampler_dimensionality
== GLSL_SAMPLER_DIM_CUBE
&&
7003 !image_type
->sampler_array
) {
7007 /* FIXME: Add the highp precision qualifier for GLES 3.10 when it is
7008 * supported by mesa.
7010 ret_type
= glsl_type::get_instance(GLSL_TYPE_INT
, num_components
, 1);
7012 ir_variable
*image
= in_var(image_type
, "image");
7013 ir_function_signature
*sig
= new_sig(ret_type
, shader_image_size
, 1, image
);
7015 /* Set the maximal set of qualifiers allowed for this image
7016 * built-in. Function calls with arguments having fewer
7017 * qualifiers than present in the prototype are allowed by the
7018 * spec, but not with more, i.e. this will make the compiler
7019 * accept everything that needs to be accepted, and reject cases
7020 * like loads from write-only or stores to read-only images.
7022 image
->data
.memory_read_only
= true;
7023 image
->data
.memory_write_only
= true;
7024 image
->data
.memory_coherent
= true;
7025 image
->data
.memory_volatile
= true;
7026 image
->data
.memory_restrict
= true;
7031 ir_function_signature
*
7032 builtin_builder::_image_samples_prototype(const glsl_type
*image_type
,
7033 unsigned /* num_arguments */,
7034 unsigned /* flags */)
7036 ir_variable
*image
= in_var(image_type
, "image");
7037 ir_function_signature
*sig
=
7038 new_sig(glsl_type::int_type
, shader_samples
, 1, image
);
7040 /* Set the maximal set of qualifiers allowed for this image
7041 * built-in. Function calls with arguments having fewer
7042 * qualifiers than present in the prototype are allowed by the
7043 * spec, but not with more, i.e. this will make the compiler
7044 * accept everything that needs to be accepted, and reject cases
7045 * like loads from write-only or stores to read-only images.
7047 image
->data
.memory_read_only
= true;
7048 image
->data
.memory_write_only
= true;
7049 image
->data
.memory_coherent
= true;
7050 image
->data
.memory_volatile
= true;
7051 image
->data
.memory_restrict
= true;
7056 ir_function_signature
*
7057 builtin_builder::_image(image_prototype_ctr prototype
,
7058 const glsl_type
*image_type
,
7059 const char *intrinsic_name
,
7060 unsigned num_arguments
,
7062 enum ir_intrinsic_id id
)
7064 ir_function_signature
*sig
= (this->*prototype
)(image_type
,
7065 num_arguments
, flags
);
7067 if (flags
& IMAGE_FUNCTION_EMIT_STUB
) {
7068 ir_factory
body(&sig
->body
, mem_ctx
);
7069 ir_function
*f
= shader
->symbols
->get_function(intrinsic_name
);
7071 if (flags
& IMAGE_FUNCTION_RETURNS_VOID
) {
7072 body
.emit(call(f
, NULL
, sig
->parameters
));
7074 ir_variable
*ret_val
=
7075 body
.make_temp(sig
->return_type
, "_ret_val");
7076 body
.emit(call(f
, ret_val
, sig
->parameters
));
7077 body
.emit(ret(ret_val
));
7080 sig
->is_defined
= true;
7083 sig
->intrinsic_id
= id
;
7089 ir_function_signature
*
7090 builtin_builder::_memory_barrier_intrinsic(builtin_available_predicate avail
,
7091 enum ir_intrinsic_id id
)
7093 MAKE_INTRINSIC(glsl_type::void_type
, id
, avail
, 0);
7097 ir_function_signature
*
7098 builtin_builder::_memory_barrier(const char *intrinsic_name
,
7099 builtin_available_predicate avail
)
7101 MAKE_SIG(glsl_type::void_type
, avail
, 0);
7102 body
.emit(call(shader
->symbols
->get_function(intrinsic_name
),
7103 NULL
, sig
->parameters
));
7107 ir_function_signature
*
7108 builtin_builder::_ballot_intrinsic()
7110 ir_variable
*value
= in_var(glsl_type::bool_type
, "value");
7111 MAKE_INTRINSIC(glsl_type::uint64_t_type
, ir_intrinsic_ballot
, shader_ballot
,
7116 ir_function_signature
*
7117 builtin_builder::_ballot()
7119 ir_variable
*value
= in_var(glsl_type::bool_type
, "value");
7121 MAKE_SIG(glsl_type::uint64_t_type
, shader_ballot
, 1, value
);
7122 ir_variable
*retval
= body
.make_temp(glsl_type::uint64_t_type
, "retval");
7124 body
.emit(call(shader
->symbols
->get_function("__intrinsic_ballot"),
7125 retval
, sig
->parameters
));
7126 body
.emit(ret(retval
));
7130 ir_function_signature
*
7131 builtin_builder::_read_first_invocation_intrinsic(const glsl_type
*type
)
7133 ir_variable
*value
= in_var(type
, "value");
7134 MAKE_INTRINSIC(type
, ir_intrinsic_read_first_invocation
, shader_ballot
,
7139 ir_function_signature
*
7140 builtin_builder::_read_first_invocation(const glsl_type
*type
)
7142 ir_variable
*value
= in_var(type
, "value");
7144 MAKE_SIG(type
, shader_ballot
, 1, value
);
7145 ir_variable
*retval
= body
.make_temp(type
, "retval");
7147 body
.emit(call(shader
->symbols
->get_function("__intrinsic_read_first_invocation"),
7148 retval
, sig
->parameters
));
7149 body
.emit(ret(retval
));
7153 ir_function_signature
*
7154 builtin_builder::_read_invocation_intrinsic(const glsl_type
*type
)
7156 ir_variable
*value
= in_var(type
, "value");
7157 ir_variable
*invocation
= in_var(glsl_type::uint_type
, "invocation");
7158 MAKE_INTRINSIC(type
, ir_intrinsic_read_invocation
, shader_ballot
,
7159 2, value
, invocation
);
7163 ir_function_signature
*
7164 builtin_builder::_read_invocation(const glsl_type
*type
)
7166 ir_variable
*value
= in_var(type
, "value");
7167 ir_variable
*invocation
= in_var(glsl_type::uint_type
, "invocation");
7169 MAKE_SIG(type
, shader_ballot
, 2, value
, invocation
);
7170 ir_variable
*retval
= body
.make_temp(type
, "retval");
7172 body
.emit(call(shader
->symbols
->get_function("__intrinsic_read_invocation"),
7173 retval
, sig
->parameters
));
7174 body
.emit(ret(retval
));
7178 ir_function_signature
*
7179 builtin_builder::_invocation_interlock_intrinsic(builtin_available_predicate avail
,
7180 enum ir_intrinsic_id id
)
7182 MAKE_INTRINSIC(glsl_type::void_type
, id
, avail
, 0);
7186 ir_function_signature
*
7187 builtin_builder::_invocation_interlock(const char *intrinsic_name
,
7188 builtin_available_predicate avail
)
7190 MAKE_SIG(glsl_type::void_type
, avail
, 0);
7191 body
.emit(call(shader
->symbols
->get_function(intrinsic_name
),
7192 NULL
, sig
->parameters
));
7196 ir_function_signature
*
7197 builtin_builder::_shader_clock_intrinsic(builtin_available_predicate avail
,
7198 const glsl_type
*type
)
7200 MAKE_INTRINSIC(type
, ir_intrinsic_shader_clock
, avail
, 0);
7204 ir_function_signature
*
7205 builtin_builder::_shader_clock(builtin_available_predicate avail
,
7206 const glsl_type
*type
)
7208 MAKE_SIG(type
, avail
, 0);
7210 ir_variable
*retval
= body
.make_temp(glsl_type::uvec2_type
, "clock_retval");
7212 body
.emit(call(shader
->symbols
->get_function("__intrinsic_shader_clock"),
7213 retval
, sig
->parameters
));
7215 if (type
== glsl_type::uint64_t_type
) {
7216 body
.emit(ret(expr(ir_unop_pack_uint_2x32
, retval
)));
7218 body
.emit(ret(retval
));
7224 ir_function_signature
*
7225 builtin_builder::_vote_intrinsic(builtin_available_predicate avail
,
7226 enum ir_intrinsic_id id
)
7228 ir_variable
*value
= in_var(glsl_type::bool_type
, "value");
7229 MAKE_INTRINSIC(glsl_type::bool_type
, id
, avail
, 1, value
);
7233 ir_function_signature
*
7234 builtin_builder::_vote(const char *intrinsic_name
,
7235 builtin_available_predicate avail
)
7237 ir_variable
*value
= in_var(glsl_type::bool_type
, "value");
7239 MAKE_SIG(glsl_type::bool_type
, avail
, 1, value
);
7241 ir_variable
*retval
= body
.make_temp(glsl_type::bool_type
, "retval");
7243 body
.emit(call(shader
->symbols
->get_function(intrinsic_name
),
7244 retval
, sig
->parameters
));
7245 body
.emit(ret(retval
));
7251 /******************************************************************************/
7253 /* The singleton instance of builtin_builder. */
7254 static builtin_builder builtins
;
7255 static mtx_t builtins_lock
= _MTX_INITIALIZER_NP
;
7258 * External API (exposing the built-in module to the rest of the compiler):
7262 _mesa_glsl_initialize_builtin_functions()
7264 mtx_lock(&builtins_lock
);
7265 builtins
.initialize();
7266 mtx_unlock(&builtins_lock
);
7270 _mesa_glsl_release_builtin_functions()
7272 mtx_lock(&builtins_lock
);
7274 mtx_unlock(&builtins_lock
);
7277 ir_function_signature
*
7278 _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state
*state
,
7279 const char *name
, exec_list
*actual_parameters
)
7281 ir_function_signature
*s
;
7282 mtx_lock(&builtins_lock
);
7283 s
= builtins
.find(state
, name
, actual_parameters
);
7284 mtx_unlock(&builtins_lock
);
7290 _mesa_glsl_has_builtin_function(_mesa_glsl_parse_state
*state
, const char *name
)
7294 mtx_lock(&builtins_lock
);
7295 f
= builtins
.shader
->symbols
->get_function(name
);
7297 foreach_in_list(ir_function_signature
, sig
, &f
->signatures
) {
7298 if (sig
->is_builtin_available(state
)) {
7304 mtx_unlock(&builtins_lock
);
7310 _mesa_glsl_get_builtin_function_shader()
7312 return builtins
.shader
;
7317 * Get the function signature for main from a shader
7319 ir_function_signature
*
7320 _mesa_get_main_function_signature(glsl_symbol_table
*symbols
)
7322 ir_function
*const f
= symbols
->get_function("main");
7324 exec_list void_parameters
;
7326 /* Look for the 'void main()' signature and ensure that it's defined.
7327 * This keeps the linker from accidentally pick a shader that just
7328 * contains a prototype for main.
7330 * We don't have to check for multiple definitions of main (in multiple
7331 * shaders) because that would have already been caught above.
7333 ir_function_signature
*sig
=
7334 f
->matching_signature(NULL
, &void_parameters
, false);
7335 if ((sig
!= NULL
) && sig
->is_defined
) {