summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2016-08-17 10:20:34 +0100
committerIan Romanick <ian.d.romanick@intel.com>2016-08-26 15:03:15 -0700
commitdc4f53b68308bbd79932470cf4613037f7e95fb7 (patch)
treeab86f908b5d9e32cd416c951a35a3d0ea811b984 /src/compiler
parent87fa462ffd6754144f89163a2692eff005beef9c (diff)
downloadexternal_mesa3d-dc4f53b68308bbd79932470cf4613037f7e95fb7.tar.gz
external_mesa3d-dc4f53b68308bbd79932470cf4613037f7e95fb7.tar.bz2
external_mesa3d-dc4f53b68308bbd79932470cf4613037f7e95fb7.zip
mesa: Add support for OES_texture_cube_map_array
This has a separate enable flag because this extension also requires OES_geometry_shader. It is possible that some drivers may support OpenGL ES 3.1 and ARB_texture_cube_map but not support OES_geometry_shader. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/builtin_functions.cpp29
-rw-r--r--src/compiler/glsl/builtin_types.cpp27
-rw-r--r--src/compiler/glsl/glsl_lexer.ll14
-rw-r--r--src/compiler/glsl/glsl_parser_extras.cpp1
-rw-r--r--src/compiler/glsl/glsl_parser_extras.h5
5 files changed, 47 insertions, 29 deletions
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 161c98bd01..64bf8d8a48 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -245,6 +245,14 @@ gpu_shader5_es(const _mesa_glsl_parse_state *state)
}
static bool
+gpu_shader5_or_OES_texture_cube_map_array(const _mesa_glsl_parse_state *state)
+{
+ return state->is_version(400, 320) ||
+ state->ARB_gpu_shader5_enable ||
+ state->OES_texture_cube_map_array_enable;
+}
+
+static bool
es31_not_gs5(const _mesa_glsl_parse_state *state)
{
return state->is_version(0, 310) && !gpu_shader5_es(state);
@@ -358,11 +366,12 @@ texture_query_lod(const _mesa_glsl_parse_state *state)
}
static bool
-texture_gather(const _mesa_glsl_parse_state *state)
+texture_gather_cube_map_array(const _mesa_glsl_parse_state *state)
{
- return state->is_version(400, 0) ||
+ return state->is_version(400, 320) ||
state->ARB_texture_gather_enable ||
- state->ARB_gpu_shader5_enable;
+ state->ARB_gpu_shader5_enable ||
+ state->OES_texture_cube_map_array_enable;
}
static bool
@@ -2554,9 +2563,9 @@ builtin_builder::create_builtins()
_texture(ir_tg4, texture_gather_or_es31, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type),
_texture(ir_tg4, texture_gather_or_es31, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type),
- _texture(ir_tg4, texture_gather, glsl_type::vec4_type, glsl_type::samplerCubeArray_type, glsl_type::vec4_type),
- _texture(ir_tg4, texture_gather, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type),
- _texture(ir_tg4, texture_gather, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type),
+ _texture(ir_tg4, texture_gather_cube_map_array, glsl_type::vec4_type, glsl_type::samplerCubeArray_type, glsl_type::vec4_type),
+ _texture(ir_tg4, texture_gather_cube_map_array, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type),
+ _texture(ir_tg4, texture_gather_cube_map_array, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type),
_texture(ir_tg4, gpu_shader5_or_es31, glsl_type::vec4_type, glsl_type::sampler2D_type, glsl_type::vec2_type, TEX_COMPONENT),
_texture(ir_tg4, gpu_shader5_or_es31, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_COMPONENT),
@@ -2574,14 +2583,14 @@ builtin_builder::create_builtins()
_texture(ir_tg4, gpu_shader5_or_es31, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type, TEX_COMPONENT),
_texture(ir_tg4, gpu_shader5_or_es31, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type, TEX_COMPONENT),
- _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::samplerCubeArray_type, glsl_type::vec4_type, TEX_COMPONENT),
- _texture(ir_tg4, gpu_shader5, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type, TEX_COMPONENT),
- _texture(ir_tg4, gpu_shader5, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5_or_OES_texture_cube_map_array, glsl_type::vec4_type, glsl_type::samplerCubeArray_type, glsl_type::vec4_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5_or_OES_texture_cube_map_array, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type, TEX_COMPONENT),
+ _texture(ir_tg4, gpu_shader5_or_OES_texture_cube_map_array, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type, TEX_COMPONENT),
_texture(ir_tg4, gpu_shader5_or_es31, glsl_type::vec4_type, glsl_type::sampler2DShadow_type, glsl_type::vec2_type),
_texture(ir_tg4, gpu_shader5_or_es31, glsl_type::vec4_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec3_type),
_texture(ir_tg4, gpu_shader5_or_es31, glsl_type::vec4_type, glsl_type::samplerCubeShadow_type, glsl_type::vec3_type),
- _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::samplerCubeArrayShadow_type, glsl_type::vec4_type),
+ _texture(ir_tg4, gpu_shader5_or_OES_texture_cube_map_array, glsl_type::vec4_type, glsl_type::samplerCubeArrayShadow_type, glsl_type::vec4_type),
_texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::sampler2DRectShadow_type, glsl_type::vec2_type),
NULL);
diff --git a/src/compiler/glsl/builtin_types.cpp b/src/compiler/glsl/builtin_types.cpp
index 5f208f8e9d..d40f785c28 100644
--- a/src/compiler/glsl/builtin_types.cpp
+++ b/src/compiler/glsl/builtin_types.cpp
@@ -177,7 +177,7 @@ static const struct builtin_type_versions {
T(samplerCube, 110, 100)
T(sampler1DArray, 130, 999)
T(sampler2DArray, 130, 300)
- T(samplerCubeArray, 400, 999)
+ T(samplerCubeArray, 400, 320)
T(sampler2DRect, 140, 999)
T(samplerBuffer, 140, 320)
T(sampler2DMS, 150, 310)
@@ -189,7 +189,7 @@ static const struct builtin_type_versions {
T(isamplerCube, 130, 300)
T(isampler1DArray, 130, 999)
T(isampler2DArray, 130, 300)
- T(isamplerCubeArray, 400, 999)
+ T(isamplerCubeArray, 400, 320)
T(isampler2DRect, 140, 999)
T(isamplerBuffer, 140, 320)
T(isampler2DMS, 150, 310)
@@ -201,7 +201,7 @@ static const struct builtin_type_versions {
T(usamplerCube, 130, 300)
T(usampler1DArray, 130, 999)
T(usampler2DArray, 130, 300)
- T(usamplerCubeArray, 400, 999)
+ T(usamplerCubeArray, 400, 320)
T(usampler2DRect, 140, 999)
T(usamplerBuffer, 140, 320)
T(usampler2DMS, 150, 310)
@@ -212,7 +212,7 @@ static const struct builtin_type_versions {
T(samplerCubeShadow, 130, 300)
T(sampler1DArrayShadow, 130, 999)
T(sampler2DArrayShadow, 130, 300)
- T(samplerCubeArrayShadow, 400, 999)
+ T(samplerCubeArrayShadow, 400, 320)
T(sampler2DRectShadow, 140, 999)
T(struct_gl_DepthRangeParameters, 110, 100)
@@ -225,7 +225,7 @@ static const struct builtin_type_versions {
T(imageBuffer, 420, 320)
T(image1DArray, 420, 999)
T(image2DArray, 420, 310)
- T(imageCubeArray, 420, 999)
+ T(imageCubeArray, 420, 320)
T(image2DMS, 420, 999)
T(image2DMSArray, 420, 999)
T(iimage1D, 420, 999)
@@ -236,7 +236,7 @@ static const struct builtin_type_versions {
T(iimageBuffer, 420, 320)
T(iimage1DArray, 420, 999)
T(iimage2DArray, 420, 310)
- T(iimageCubeArray, 420, 999)
+ T(iimageCubeArray, 420, 320)
T(iimage2DMS, 420, 999)
T(iimage2DMSArray, 420, 999)
T(uimage1D, 420, 999)
@@ -247,7 +247,7 @@ static const struct builtin_type_versions {
T(uimageBuffer, 420, 320)
T(uimage1DArray, 420, 999)
T(uimage2DArray, 420, 310)
- T(uimageCubeArray, 420, 999)
+ T(uimageCubeArray, 420, 320)
T(uimage2DMS, 420, 999)
T(uimage2DMSArray, 420, 999)
@@ -298,7 +298,8 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
* by the version-based loop, but attempting to add them a second time
* is harmless.
*/
- if (state->ARB_texture_cube_map_array_enable) {
+ if (state->ARB_texture_cube_map_array_enable ||
+ state->OES_texture_cube_map_array_enable) {
add_type(symbols, glsl_type::samplerCubeArray_type);
add_type(symbols, glsl_type::samplerCubeArrayShadow_type);
add_type(symbols, glsl_type::isamplerCubeArray_type);
@@ -337,6 +338,13 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
add_type(symbols, glsl_type::sampler3D_type);
}
+ if (state->ARB_shader_image_load_store_enable ||
+ state->OES_texture_cube_map_array_enable) {
+ add_type(symbols, glsl_type::imageCubeArray_type);
+ add_type(symbols, glsl_type::iimageCubeArray_type);
+ add_type(symbols, glsl_type::uimageCubeArray_type);
+ }
+
if (state->ARB_shader_image_load_store_enable) {
add_type(symbols, glsl_type::image1D_type);
add_type(symbols, glsl_type::image2D_type);
@@ -346,7 +354,6 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
add_type(symbols, glsl_type::imageBuffer_type);
add_type(symbols, glsl_type::image1DArray_type);
add_type(symbols, glsl_type::image2DArray_type);
- add_type(symbols, glsl_type::imageCubeArray_type);
add_type(symbols, glsl_type::image2DMS_type);
add_type(symbols, glsl_type::image2DMSArray_type);
add_type(symbols, glsl_type::iimage1D_type);
@@ -357,7 +364,6 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
add_type(symbols, glsl_type::iimageBuffer_type);
add_type(symbols, glsl_type::iimage1DArray_type);
add_type(symbols, glsl_type::iimage2DArray_type);
- add_type(symbols, glsl_type::iimageCubeArray_type);
add_type(symbols, glsl_type::iimage2DMS_type);
add_type(symbols, glsl_type::iimage2DMSArray_type);
add_type(symbols, glsl_type::uimage1D_type);
@@ -368,7 +374,6 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
add_type(symbols, glsl_type::uimageBuffer_type);
add_type(symbols, glsl_type::uimage1DArray_type);
add_type(symbols, glsl_type::uimage2DArray_type);
- add_type(symbols, glsl_type::uimageCubeArray_type);
add_type(symbols, glsl_type::uimage2DMS_type);
add_type(symbols, glsl_type::uimage2DMSArray_type);
}
diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll
index ad95f0298f..2ed11ef870 100644
--- a/src/compiler/glsl/glsl_lexer.ll
+++ b/src/compiler/glsl/glsl_lexer.ll
@@ -348,10 +348,10 @@ isampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 320, yyextra->ARB_texture_mul
usampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 320, yyextra->ARB_texture_multisample_enable || yyextra->OES_texture_storage_multisample_2d_array_enable, USAMPLER2DMSARRAY);
/* keywords available with ARB_texture_cube_map_array_enable extension on desktop GLSL */
-samplerCubeArray KEYWORD_WITH_ALT(400, 310, 400, 0, yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAY);
-isamplerCubeArray KEYWORD_WITH_ALT(400, 310, 400, 0, yyextra->ARB_texture_cube_map_array_enable, ISAMPLERCUBEARRAY);
-usamplerCubeArray KEYWORD_WITH_ALT(400, 310, 400, 0, yyextra->ARB_texture_cube_map_array_enable, USAMPLERCUBEARRAY);
-samplerCubeArrayShadow KEYWORD_WITH_ALT(400, 310, 400, 0, yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAYSHADOW);
+samplerCubeArray KEYWORD_WITH_ALT(400, 310, 400, 320, yyextra->ARB_texture_cube_map_array_enable || yyextra->OES_texture_cube_map_array_enable, SAMPLERCUBEARRAY);
+isamplerCubeArray KEYWORD_WITH_ALT(400, 310, 400, 320, yyextra->ARB_texture_cube_map_array_enable || yyextra->OES_texture_cube_map_array_enable, ISAMPLERCUBEARRAY);
+usamplerCubeArray KEYWORD_WITH_ALT(400, 310, 400, 320, yyextra->ARB_texture_cube_map_array_enable || yyextra->OES_texture_cube_map_array_enable, USAMPLERCUBEARRAY);
+samplerCubeArrayShadow KEYWORD_WITH_ALT(400, 310, 400, 320, yyextra->ARB_texture_cube_map_array_enable || yyextra->OES_texture_cube_map_array_enable, SAMPLERCUBEARRAYSHADOW);
samplerExternalOES {
if (yyextra->OES_EGL_image_external_enable)
@@ -372,7 +372,7 @@ imageCube KEYWORD_WITH_ALT(130, 300, 420, 310, yyextra->ARB_shader_image_l
imageBuffer KEYWORD_WITH_ALT(130, 300, 420, 320, yyextra->ARB_shader_image_load_store_enable || yyextra->EXT_texture_buffer_enable || yyextra->OES_texture_buffer_enable, IMAGEBUFFER);
image1DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE1DARRAY);
image2DArray KEYWORD_WITH_ALT(130, 300, 420, 310, yyextra->ARB_shader_image_load_store_enable, IMAGE2DARRAY);
-imageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGECUBEARRAY);
+imageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 320, yyextra->ARB_shader_image_load_store_enable || yyextra->OES_texture_cube_map_array_enable, IMAGECUBEARRAY);
image2DMS KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2DMS);
image2DMSArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2DMSARRAY);
iimage1D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE1D);
@@ -383,7 +383,7 @@ iimageCube KEYWORD_WITH_ALT(130, 300, 420, 310, yyextra->ARB_shader_image_l
iimageBuffer KEYWORD_WITH_ALT(130, 300, 420, 320, yyextra->ARB_shader_image_load_store_enable || yyextra->EXT_texture_buffer_enable || yyextra->OES_texture_buffer_enable, IIMAGEBUFFER);
iimage1DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE1DARRAY);
iimage2DArray KEYWORD_WITH_ALT(130, 300, 420, 310, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DARRAY);
-iimageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGECUBEARRAY);
+iimageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 320, yyextra->ARB_shader_image_load_store_enable || yyextra->OES_texture_cube_map_array_enable, IIMAGECUBEARRAY);
iimage2DMS KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DMS);
iimage2DMSArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DMSARRAY);
uimage1D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE1D);
@@ -394,7 +394,7 @@ uimageCube KEYWORD_WITH_ALT(130, 300, 420, 310, yyextra->ARB_shader_image_l
uimageBuffer KEYWORD_WITH_ALT(130, 300, 420, 320, yyextra->ARB_shader_image_load_store_enable || yyextra->EXT_texture_buffer_enable || yyextra->OES_texture_buffer_enable, UIMAGEBUFFER);
uimage1DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE1DARRAY);
uimage2DArray KEYWORD_WITH_ALT(130, 300, 420, 310, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DARRAY);
-uimageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGECUBEARRAY);
+uimageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 320, yyextra->ARB_shader_image_load_store_enable || yyextra->OES_texture_cube_map_array_enable, UIMAGECUBEARRAY);
uimage2DMS KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DMS);
uimage2DMSArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DMSARRAY);
image1DShadow KEYWORD(130, 300, 0, 0, IMAGE1DSHADOW);
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index b5c5fdc574..80f37f34f2 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -640,6 +640,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
EXT(OES_tessellation_shader),
EXT(OES_texture_3D),
EXT(OES_texture_buffer),
+ EXT(OES_texture_cube_map_array),
EXT(OES_texture_storage_multisample_2d_array),
/* All other extensions go here, sorted alphabetically.
diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index 82ce6a7816..63a8a676b7 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -320,7 +320,8 @@ struct _mesa_glsl_parse_state {
bool has_texture_cube_map_array() const
{
return ARB_texture_cube_map_array_enable ||
- is_version(400, 0);
+ OES_texture_cube_map_array_enable ||
+ is_version(400, 320);
}
void process_version_directive(YYLTYPE *locp, int version,
@@ -688,6 +689,8 @@ struct _mesa_glsl_parse_state {
bool OES_texture_3D_warn;
bool OES_texture_buffer_enable;
bool OES_texture_buffer_warn;
+ bool OES_texture_cube_map_array_enable;
+ bool OES_texture_cube_map_array_warn;
bool OES_texture_storage_multisample_2d_array_enable;
bool OES_texture_storage_multisample_2d_array_warn;