aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/glsl')
-rw-r--r--mesalib/src/glsl/builtin_types.h15
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-parse.y3
-rw-r--r--mesalib/src/glsl/glsl_lexer.ll29
-rw-r--r--mesalib/src/glsl/glsl_parser.yy12
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp1
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h2
-rw-r--r--mesalib/src/glsl/glsl_types.cpp16
-rw-r--r--mesalib/src/glsl/glsl_types.h2
-rw-r--r--mesalib/src/glsl/standalone_scaffolding.cpp1
9 files changed, 75 insertions, 6 deletions
diff --git a/mesalib/src/glsl/builtin_types.h b/mesalib/src/glsl/builtin_types.h
index d75c56261..92427d8e7 100644
--- a/mesalib/src/glsl/builtin_types.h
+++ b/mesalib/src/glsl/builtin_types.h
@@ -327,3 +327,18 @@ const glsl_type glsl_type::builtin_OES_EGL_image_external_types[] = {
GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT, "samplerExternalOES"),
};
/*@}*/
+
+/** \name Sampler types added by GL_ARB_texture_cube_map_array
+ */
+/*@{*/
+const glsl_type glsl_type::builtin_ARB_texture_cube_map_array_types[] = {
+ glsl_type(GL_SAMPLER_CUBE_MAP_ARRAY,
+ GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_FLOAT, "samplerCubeArray"),
+ glsl_type(GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW,
+ GLSL_SAMPLER_DIM_CUBE, 1, 1, GLSL_TYPE_FLOAT, "samplerCubeArrayShadow"),
+ glsl_type(GL_INT_SAMPLER_CUBE_MAP_ARRAY,
+ GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_INT, "isamplerCubeArray"),
+ glsl_type(GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY,
+ GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT, "usamplerCubeArray"),
+};
+/*@}*/
diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y
index ffb48e330..40c43c63e 100644
--- a/mesalib/src/glsl/glcpp/glcpp-parse.y
+++ b/mesalib/src/glsl/glcpp/glcpp-parse.y
@@ -1187,6 +1187,9 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
if (extensions->ARB_uniform_buffer_object)
add_builtin_define(parser, "GL_ARB_uniform_buffer_object", 1);
+
+ if (extensions->ARB_texture_cube_map_array)
+ add_builtin_define(parser, "GL_ARB_texture_cube_map_array", 1);
}
language_version = 110;
diff --git a/mesalib/src/glsl/glsl_lexer.ll b/mesalib/src/glsl/glsl_lexer.ll
index 24cda0c45..c538d7d8e 100644
--- a/mesalib/src/glsl/glsl_lexer.ll
+++ b/mesalib/src/glsl/glsl_lexer.ll
@@ -296,12 +296,37 @@ usamplerCube KEYWORD(130, 130, USAMPLERCUBE);
usampler1DArray KEYWORD(130, 130, USAMPLER1DARRAY);
usampler2DArray KEYWORD(130, 130, USAMPLER2DARRAY);
-samplerExternalOES {
+samplerCubeArray {
+ if (yyextra->ARB_texture_cube_map_array_enable)
+ return SAMPLERCUBEARRAY;
+ else
+ return IDENTIFIER;
+ }
+isamplerCubeArray {
+ if (yyextra->ARB_texture_cube_map_array_enable)
+ return ISAMPLERCUBEARRAY;
+ else
+ return IDENTIFIER;
+ }
+usamplerCubeArray {
+ if (yyextra->ARB_texture_cube_map_array_enable)
+ return USAMPLERCUBEARRAY;
+ else
+ return IDENTIFIER;
+ }
+samplerCubeArrayShadow {
+ if (yyextra->ARB_texture_cube_map_array_enable)
+ return SAMPLERCUBEARRAYSHADOW;
+ else
+ return IDENTIFIER;
+ }
+
+samplerExternalOES {
if (yyextra->OES_EGL_image_external_enable)
return SAMPLEREXTERNALOES;
else
return IDENTIFIER;
- }
+ }
struct return STRUCT;
diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy
index ee6a67288..a0665067d 100644
--- a/mesalib/src/glsl/glsl_parser.yy
+++ b/mesalib/src/glsl/glsl_parser.yy
@@ -101,9 +101,11 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg)
%token MAT4X2 MAT4X3 MAT4X4
%token SAMPLER1D SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER1DSHADOW SAMPLER2DSHADOW
%token SAMPLERCUBESHADOW SAMPLER1DARRAY SAMPLER2DARRAY SAMPLER1DARRAYSHADOW
-%token SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE
-%token ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D
-%token USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY
+%token SAMPLER2DARRAYSHADOW SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
+%token ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE
+%token ISAMPLER1DARRAY ISAMPLER2DARRAY ISAMPLERCUBEARRAY
+%token USAMPLER1D USAMPLER2D USAMPLER3D USAMPLERCUBE USAMPLER1DARRAY
+%token USAMPLER2DARRAY USAMPLERCUBEARRAY
%token SAMPLER2DRECT ISAMPLER2DRECT USAMPLER2DRECT SAMPLER2DRECTSHADOW
%token SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER
%token SAMPLEREXTERNALOES
@@ -1467,6 +1469,8 @@ basic_type_specifier_nonarray:
| SAMPLER1DARRAYSHADOW { $$ = "sampler1DArrayShadow"; }
| SAMPLER2DARRAYSHADOW { $$ = "sampler2DArrayShadow"; }
| SAMPLERBUFFER { $$ = "samplerBuffer"; }
+ | SAMPLERCUBEARRAY { $$ = "samplerCubeArray"; }
+ | SAMPLERCUBEARRAYSHADOW { $$ = "samplerCubeArrayShadow"; }
| ISAMPLER1D { $$ = "isampler1D"; }
| ISAMPLER2D { $$ = "isampler2D"; }
| ISAMPLER2DRECT { $$ = "isampler2DRect"; }
@@ -1475,6 +1479,7 @@ basic_type_specifier_nonarray:
| ISAMPLER1DARRAY { $$ = "isampler1DArray"; }
| ISAMPLER2DARRAY { $$ = "isampler2DArray"; }
| ISAMPLERBUFFER { $$ = "isamplerBuffer"; }
+ | ISAMPLERCUBEARRAY { $$ = "isamplerCubeArray"; }
| USAMPLER1D { $$ = "usampler1D"; }
| USAMPLER2D { $$ = "usampler2D"; }
| USAMPLER2DRECT { $$ = "usampler2DRect"; }
@@ -1483,6 +1488,7 @@ basic_type_specifier_nonarray:
| USAMPLER1DARRAY { $$ = "usampler1DArray"; }
| USAMPLER2DARRAY { $$ = "usampler2DArray"; }
| USAMPLERBUFFER { $$ = "usamplerBuffer"; }
+ | USAMPLERCUBEARRAY { $$ = "usamplerCubeArray"; }
;
precision_qualifier:
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index 872fcda71..f1fdd3a47 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -289,6 +289,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
EXT(ARB_shader_bit_encoding, true, true, true, true, false, ARB_shader_bit_encoding),
EXT(ARB_uniform_buffer_object, true, false, true, true, false, ARB_uniform_buffer_object),
EXT(OES_standard_derivatives, false, false, true, false, true, OES_standard_derivatives),
+ EXT(ARB_texture_cube_map_array, true, false, true, true, false, ARB_texture_cube_map_array),
};
#undef EXT
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index c8c40ab5a..0b208f6ca 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -205,6 +205,8 @@ struct _mesa_glsl_parse_state {
bool ARB_uniform_buffer_object_warn;
bool OES_standard_derivatives_enable;
bool OES_standard_derivatives_warn;
+ bool ARB_texture_cube_map_array_enable;
+ bool ARB_texture_cube_map_array_warn;
/*@}*/
/** Extensions supported by the OpenGL implementation. */
diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp
index 2aa51f0b3..3940a12a5 100644
--- a/mesalib/src/glsl/glsl_types.cpp
+++ b/mesalib/src/glsl/glsl_types.cpp
@@ -142,7 +142,7 @@ glsl_type::sampler_index() const
case GLSL_SAMPLER_DIM_3D:
return TEXTURE_3D_INDEX;
case GLSL_SAMPLER_DIM_CUBE:
- return TEXTURE_CUBE_INDEX;
+ return (t->sampler_array) ? TEXTURE_CUBE_ARRAY_INDEX : TEXTURE_CUBE_INDEX;
case GLSL_SAMPLER_DIM_RECT:
return TEXTURE_RECT_INDEX;
case GLSL_SAMPLER_DIM_BUF:
@@ -256,6 +256,15 @@ glsl_type::generate_OES_EGL_image_external_types(glsl_symbol_table *symtab,
}
void
+glsl_type::generate_ARB_texture_cube_map_array_types(glsl_symbol_table *symtab,
+ bool warn)
+{
+ add_types_to_symbol_table(symtab, builtin_ARB_texture_cube_map_array_types,
+ Elements(builtin_ARB_texture_cube_map_array_types),
+ warn);
+}
+
+void
_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
{
switch (state->language_version) {
@@ -304,6 +313,11 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
glsl_type::generate_OES_EGL_image_external_types(state->symbols,
state->OES_EGL_image_external_warn);
}
+
+ if (state->ARB_texture_cube_map_array_enable) {
+ glsl_type::generate_ARB_texture_cube_map_array_types(state->symbols,
+ state->ARB_texture_cube_map_array_warn);
+ }
}
diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h
index 915d1a22b..cf954a256 100644
--- a/mesalib/src/glsl/glsl_types.h
+++ b/mesalib/src/glsl/glsl_types.h
@@ -521,6 +521,7 @@ private:
static const glsl_type builtin_EXT_texture_array_types[];
static const glsl_type builtin_EXT_texture_buffer_object_types[];
static const glsl_type builtin_OES_EGL_image_external_types[];
+ static const glsl_type builtin_ARB_texture_cube_map_array_types[];
/*@}*/
/**
@@ -541,6 +542,7 @@ private:
static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
static void generate_OES_texture_3D_types(glsl_symbol_table *, bool);
static void generate_OES_EGL_image_external_types(glsl_symbol_table *, bool);
+ static void generate_ARB_texture_cube_map_array_types(glsl_symbol_table *, bool);
/*@}*/
/**
diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp
index 7e37be578..120ee9534 100644
--- a/mesalib/src/glsl/standalone_scaffolding.cpp
+++ b/mesalib/src/glsl/standalone_scaffolding.cpp
@@ -81,6 +81,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
ctx->Extensions.OES_EGL_image_external = true;
ctx->Extensions.ARB_shader_bit_encoding = true;
ctx->Extensions.OES_standard_derivatives = true;
+ ctx->Extensions.ARB_texture_cube_map_array = true;
ctx->Const.GLSLVersion = 120;