glsl_type: Don't have two versions of a type with the same name
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 6 Aug 2010 00:29:15 +0000 (17:29 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 6 Aug 2010 00:29:15 +0000 (17:29 -0700)
Previously some sampler types were duplicated in GLSL 1.30 and
GL_EXT_texture_array.  This resulted in not being able to find the
built-in sampler functions when the extension was used.  When the
built-in functions were compiled, they bound to the 1.30 version.
This caused a type mismatch when trying to find the function.  It also
resulted in a confusing error message:

0:0(0): error: no matching function for call to `texture2DArray(sampler2DArray, vec3)'
0:0(0): error: candidates are: vec4 texture2DArray(sampler2DArray, vec3)

0:0(0): error:                 vec4 texture2DArray(sampler2DArray, vec3, float)

src/glsl/builtin_types.h
src/glsl/glsl_types.cpp

index bd8f8b583a55985ef06dd2305fbd28827d0b20fe..bfa4f3f5408f75690deee85070cc21bb3127e9fd 100644 (file)
@@ -212,23 +212,17 @@ const glsl_type glsl_type::builtin_130_types[] = {
    glsl_type(GL_UNSIGNED_INT_VEC3, GLSL_TYPE_UINT, 3, 1, "uvec3"),
    glsl_type(GL_UNSIGNED_INT_VEC4, GLSL_TYPE_UINT, 4, 1, "uvec4"),
 
-   /* 1D and 2D texture arrays */
-   glsl_type(GL_SAMPLER_1D_ARRAY,
-            GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"),
+   /* 1D and 2D texture arrays - several of these are included only in
+    * builtin_EXT_texture_array_types.
+    */
    glsl_type(GL_INT_SAMPLER_1D_ARRAY,
             GLSL_SAMPLER_DIM_1D, 0, 1,   GLSL_TYPE_INT, "isampler1DArray"),
    glsl_type(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY,
             GLSL_SAMPLER_DIM_1D, 0, 1,  GLSL_TYPE_UINT, "usampler1DArray"),
-   glsl_type(GL_SAMPLER_1D_ARRAY_SHADOW,
-            GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"),
-   glsl_type(GL_SAMPLER_2D_ARRAY,
-            GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"),
    glsl_type(GL_INT_SAMPLER_2D_ARRAY,
             GLSL_SAMPLER_DIM_2D, 0, 1,   GLSL_TYPE_INT, "isampler2DArray"),
    glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY,
             GLSL_SAMPLER_DIM_2D, 0, 1,  GLSL_TYPE_UINT, "usampler2DArray"),
-   glsl_type(GL_SAMPLER_2D_ARRAY_SHADOW,
-            GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"),
 
    /* cube shadow samplers */
    glsl_type(GL_SAMPLER_CUBE_SHADOW,
index 88f305ac254b2dea9bb31ef04dc6cd439082af84..03f84603b55e8aa46ef9c855b0214f376c75a3de 100644 (file)
@@ -144,6 +144,7 @@ glsl_type::generate_130_types(glsl_symbol_table *symtab)
 
    add_types_to_symbol_table(symtab, builtin_130_types,
                             Elements(builtin_130_types), false);
+   generate_EXT_texture_array_types(symtab, false);
 }