nir/drawpixels: handle load_color0, load_input, load_interpolated_input
[mesa.git] / src / compiler / glsl / builtin_types.cpp
index cae972b5b348524813c757b4dfe53f49219ddf31..d3a28acf27bc55592678e986c9e615517d9be5b4 100644 (file)
@@ -37,6 +37,7 @@
 #include "compiler/glsl_types.h"
 #include "glsl_parser_extras.h"
 #include "util/macros.h"
+#include "main/mtypes.h"
 
 /**
  * Declarations of type flyweights (glsl_type::_foo_type) and
@@ -52,9 +53,9 @@
       &glsl_type::_struct_##NAME##_type;
 
 static const struct glsl_struct_field gl_DepthRangeParameters_fields[] = {
-   glsl_struct_field(glsl_type::float_type, "near"),
-   glsl_struct_field(glsl_type::float_type, "far"),
-   glsl_struct_field(glsl_type::float_type, "diff"),
+   glsl_struct_field(glsl_type::float_type, GLSL_PRECISION_HIGH, "near"),
+   glsl_struct_field(glsl_type::float_type, GLSL_PRECISION_HIGH, "far"),
+   glsl_struct_field(glsl_type::float_type, GLSL_PRECISION_HIGH, "diff"),
 };
 
 static const struct glsl_struct_field gl_PointParameters_fields[] = {
@@ -288,7 +289,7 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
    /* Add deprecated structure types.  While these were deprecated in 1.30,
     * they're still present.  We've removed them in 1.40+ (OpenGL 3.1+).
     */
-   if (state->compat_shader) {
+   if (state->compat_shader || state->ARB_compatibility_enable) {
       for (unsigned i = 0; i < ARRAY_SIZE(deprecated_types); i++) {
          add_type(symbols, deprecated_types[i]);
       }
@@ -324,6 +325,52 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
       add_type(symbols, glsl_type::sampler2DRectShadow_type);
    }
 
+   if (state->EXT_gpu_shader4_enable) {
+      add_type(symbols, glsl_type::uint_type);
+      add_type(symbols, glsl_type::uvec2_type);
+      add_type(symbols, glsl_type::uvec3_type);
+      add_type(symbols, glsl_type::uvec4_type);
+
+      add_type(symbols, glsl_type::samplerCubeShadow_type);
+
+      if (state->ctx->Extensions.EXT_texture_array) {
+         add_type(symbols, glsl_type::sampler1DArray_type);
+         add_type(symbols, glsl_type::sampler2DArray_type);
+         add_type(symbols, glsl_type::sampler1DArrayShadow_type);
+         add_type(symbols, glsl_type::sampler2DArrayShadow_type);
+      }
+      if (state->ctx->Extensions.EXT_texture_buffer_object) {
+         add_type(symbols, glsl_type::samplerBuffer_type);
+      }
+
+      if (state->ctx->Extensions.EXT_texture_integer) {
+         add_type(symbols, glsl_type::isampler1D_type);
+         add_type(symbols, glsl_type::isampler2D_type);
+         add_type(symbols, glsl_type::isampler3D_type);
+         add_type(symbols, glsl_type::isamplerCube_type);
+
+         add_type(symbols, glsl_type::usampler1D_type);
+         add_type(symbols, glsl_type::usampler2D_type);
+         add_type(symbols, glsl_type::usampler3D_type);
+         add_type(symbols, glsl_type::usamplerCube_type);
+
+         if (state->ctx->Extensions.NV_texture_rectangle) {
+            add_type(symbols, glsl_type::isampler2DRect_type);
+            add_type(symbols, glsl_type::usampler2DRect_type);
+         }
+         if (state->ctx->Extensions.EXT_texture_array) {
+            add_type(symbols, glsl_type::isampler1DArray_type);
+            add_type(symbols, glsl_type::isampler2DArray_type);
+            add_type(symbols, glsl_type::usampler1DArray_type);
+            add_type(symbols, glsl_type::usampler2DArray_type);
+         }
+         if (state->ctx->Extensions.EXT_texture_buffer_object) {
+            add_type(symbols, glsl_type::isamplerBuffer_type);
+            add_type(symbols, glsl_type::usamplerBuffer_type);
+         }
+      }
+   }
+
    if (state->EXT_texture_array_enable) {
       add_type(symbols, glsl_type::sampler1DArray_type);
       add_type(symbols, glsl_type::sampler2DArray_type);
@@ -331,7 +378,8 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
       add_type(symbols, glsl_type::sampler2DArrayShadow_type);
    }
 
-   if (state->OES_EGL_image_external_enable) {
+   if (state->OES_EGL_image_external_enable ||
+       state->OES_EGL_image_external_essl3_enable) {
       add_type(symbols, glsl_type::samplerExternalOES_type);
    }
 
@@ -410,7 +458,8 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
       add_type(symbols, glsl_type::dmat4x3_type);
    }
 
-   if (state->ARB_gpu_shader_int64_enable) {
+   if (state->ARB_gpu_shader_int64_enable ||
+       state->AMD_gpu_shader_int64_enable) {
       add_type(symbols, glsl_type::int64_t_type);
       add_type(symbols, glsl_type::i64vec2_type);
       add_type(symbols, glsl_type::i64vec3_type);