[Mesa-dev] [PATCH 7/9] glsl: Add support for integer sampler2DRect variants in GLSL 1.40.

Eric Anholt eric at anholt.net
Mon Mar 12 18:08:20 PDT 2012


---
 src/glsl/builtin_types.h |   12 ++++++++++++
 src/glsl/glsl_types.cpp  |   15 +++++++++++++--
 src/glsl/glsl_types.h    |    2 ++
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h
index cc99b1b..890c121 100644
--- a/src/glsl/builtin_types.h
+++ b/src/glsl/builtin_types.h
@@ -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
  */
 /*@{*/
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index a327197..4baec41 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -205,6 +205,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);
    }
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 2997c93..8f2a3ff 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -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);
-- 
1.7.9.1



More information about the mesa-dev mailing list