glsl: Add support for integer sampler2DRect variants in GLSL 1.40.
authorEric Anholt <eric@anholt.net>
Mon, 12 Mar 2012 21:07:01 +0000 (14:07 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 15 Mar 2012 23:24:50 +0000 (16:24 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/builtin_types.h
src/glsl/glsl_types.cpp
src/glsl/glsl_types.h

index cc99b1bdeda55aea04ce409525370d0888040491..890c1213fa34c65b33c0d61d60b5ba4bdf7c0bd6 100644 (file)
@@ -259,6 +259,18 @@ const glsl_type *const glsl_type::uvec3_type = & builtin_130_types[2];
 const glsl_type *const glsl_type::uvec4_type = & builtin_130_types[3];
 /*@}*/
 
+
+/** \name Types added in GLSL 1.30
+ */
+/*@{*/
+const glsl_type glsl_type::builtin_140_types[] = {
+   glsl_type(GL_INT_SAMPLER_2D_RECT,
+            GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT, "isampler2DRect"),
+   glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_RECT,
+            GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT, "usampler2DRect"),
+};
+/*@}*/
+
 /** \name Sampler types added by GL_ARB_texture_rectangle
  */
 /*@{*/
index a3271970482e16c2f59a2a0cef0e3b2f49af48fe..4baec4195f909bdb954426c730ea534b727de3a9 100644 (file)
@@ -204,6 +204,16 @@ glsl_type::generate_130_types(glsl_symbol_table *symtab)
 }
 
 
+void
+glsl_type::generate_140_types(glsl_symbol_table *symtab)
+{
+   generate_130_types(symtab);
+
+   add_types_to_symbol_table(symtab, builtin_140_types,
+                            Elements(builtin_140_types), false);
+}
+
+
 void
 glsl_type::generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab,
                                                bool warn)
@@ -258,14 +268,15 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
       glsl_type::generate_130_types(state->symbols);
       break;
    case 140:
-      glsl_type::generate_130_types(state->symbols);
+      glsl_type::generate_140_types(state->symbols);
       break;
    default:
       /* error */
       break;
    }
 
-   if (state->ARB_texture_rectangle_enable) {
+   if (state->ARB_texture_rectangle_enable ||
+       state->language_version >= 140) {
       glsl_type::generate_ARB_texture_rectangle_types(state->symbols,
                                           state->ARB_texture_rectangle_warn);
    }
index 2997c9311499c7b9daa8d208436ae721dfc79efa..8f2a3ff38caad051df0068e820b7d1d943d222cf 100644 (file)
@@ -498,6 +498,7 @@ private:
    static const glsl_type builtin_110_types[];
    static const glsl_type builtin_120_types[];
    static const glsl_type builtin_130_types[];
+   static const glsl_type builtin_140_types[];
    static const glsl_type builtin_ARB_texture_rectangle_types[];
    static const glsl_type builtin_EXT_texture_array_types[];
    static const glsl_type builtin_EXT_texture_buffer_object_types[];
@@ -517,6 +518,7 @@ private:
    static void generate_110_types(glsl_symbol_table *);
    static void generate_120_types(glsl_symbol_table *);
    static void generate_130_types(glsl_symbol_table *);
+   static void generate_140_types(glsl_symbol_table *);
    static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool);
    static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
    static void generate_OES_texture_3D_types(glsl_symbol_table *, bool);