From 3645b77b7162913b504a49fc42d785fde27df3f3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Mar 2012 14:07:01 -0700 Subject: [PATCH] glsl: Add support for integer sampler2DRect variants in GLSL 1.40. Reviewed-by: Kenneth Graunke --- 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 cc99b1bdeda..890c1213fa3 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 a3271970482..4baec4195f9 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -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); } diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 2997c931149..8f2a3ff38ca 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); -- 2.30.2