On 08/07/2018 10:42 PM, Marek Olšák wrote: > From: Chris Forbes <chr...@ijw.co.nz> > > --- > src/compiler/glsl/builtin_types.cpp | 32 ++++++++++++++++++ > src/compiler/glsl/glsl_lexer.ll | 50 ++++++++++++++--------------- > 2 files changed, 57 insertions(+), 25 deletions(-) > > diff --git a/src/compiler/glsl/builtin_types.cpp > b/src/compiler/glsl/builtin_types.cpp > index 7a01cb48bc8..2e141447252 100644 > --- a/src/compiler/glsl/builtin_types.cpp > +++ b/src/compiler/glsl/builtin_types.cpp > @@ -317,20 +317,52 @@ _mesa_glsl_initialize_types(struct > _mesa_glsl_parse_state *state) > add_type(symbols, glsl_type::sampler2DMSArray_type); > add_type(symbols, glsl_type::isampler2DMSArray_type); > add_type(symbols, glsl_type::usampler2DMSArray_type); > } > > if (state->ARB_texture_rectangle_enable) { > add_type(symbols, glsl_type::sampler2DRect_type); > add_type(symbols, glsl_type::sampler2DRectShadow_type); > } > > + if (state->EXT_gpu_shader4_enable) { > + add_type(symbols, glsl_type::uint_type); > + add_type(symbols, glsl_type::uvec2_type); > + add_type(symbols, glsl_type::uvec3_type); > + add_type(symbols, glsl_type::uvec4_type); > + > + add_type(symbols, glsl_type::sampler1DArray_type); > + add_type(symbols, glsl_type::sampler2DArray_type); > + add_type(symbols, glsl_type::sampler1DArrayShadow_type); > + add_type(symbols, glsl_type::sampler2DArrayShadow_type); > + add_type(symbols, glsl_type::samplerCubeShadow_type); > + add_type(symbols, glsl_type::samplerBuffer_type); > + > + add_type(symbols, glsl_type::isampler1D_type); > + add_type(symbols, glsl_type::isampler2D_type); > + add_type(symbols, glsl_type::isampler3D_type); > + add_type(symbols, glsl_type::isamplerCube_type); > + add_type(symbols, glsl_type::isampler2DRect_type); > + add_type(symbols, glsl_type::isampler1DArray_type); > + add_type(symbols, glsl_type::isampler2DArray_type); > + add_type(symbols, glsl_type::isamplerBuffer_type); > + > + add_type(symbols, glsl_type::usampler1D_type); > + add_type(symbols, glsl_type::usampler2D_type); > + add_type(symbols, glsl_type::usampler3D_type); > + add_type(symbols, glsl_type::usamplerCube_type); > + add_type(symbols, glsl_type::usampler2DRect_type); > + add_type(symbols, glsl_type::usampler1DArray_type); > + add_type(symbols, glsl_type::usampler2DArray_type); > + add_type(symbols, glsl_type::usamplerBuffer_type); > + } > + > if (state->EXT_texture_array_enable) { > add_type(symbols, glsl_type::sampler1DArray_type); > add_type(symbols, glsl_type::sampler2DArray_type); > add_type(symbols, glsl_type::sampler1DArrayShadow_type); > add_type(symbols, glsl_type::sampler2DArrayShadow_type); > } > > if (state->OES_EGL_image_external_enable || > state->OES_EGL_image_external_essl3_enable) { > add_type(symbols, glsl_type::samplerExternalOES_type); > diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll > index 65c5b414a2d..67c33d6f1c9 100644 > --- a/src/compiler/glsl/glsl_lexer.ll > +++ b/src/compiler/glsl/glsl_lexer.ll > @@ -347,23 +347,23 @@ for return FOR; > if return IF; > discard return DISCARD; > return return RETURN; > > bvec2 { yylval->type = glsl_type::bvec2_type; return > BASIC_TYPE_TOK; } > bvec3 { yylval->type = glsl_type::bvec3_type; return > BASIC_TYPE_TOK; } > bvec4 { yylval->type = glsl_type::bvec4_type; return > BASIC_TYPE_TOK; } > ivec2 { yylval->type = glsl_type::ivec2_type; return > BASIC_TYPE_TOK; } > ivec3 { yylval->type = glsl_type::ivec3_type; return > BASIC_TYPE_TOK; } > ivec4 { yylval->type = glsl_type::ivec4_type; return > BASIC_TYPE_TOK; } > -uvec2 TYPE(130, 300, 130, 300, glsl_type::uvec2_type); > -uvec3 TYPE(130, 300, 130, 300, glsl_type::uvec3_type); > -uvec4 TYPE(130, 300, 130, 300, glsl_type::uvec4_type); > +uvec2 TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::uvec2_type); > +uvec3 TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::uvec3_type); > +uvec4 TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::uvec4_type); > vec2 { yylval->type = glsl_type::vec2_type; return BASIC_TYPE_TOK; } > vec3 { yylval->type = glsl_type::vec3_type; return BASIC_TYPE_TOK; } > vec4 { yylval->type = glsl_type::vec4_type; return BASIC_TYPE_TOK; } > mat2 { yylval->type = glsl_type::mat2_type; return BASIC_TYPE_TOK; } > mat3 { yylval->type = glsl_type::mat3_type; return BASIC_TYPE_TOK; } > mat4 { yylval->type = glsl_type::mat4_type; return BASIC_TYPE_TOK; } > mat2x2 TYPE(120, 300, 120, 300, glsl_type::mat2_type); > mat2x3 TYPE(120, 300, 120, 300, glsl_type::mat2x3_type); > mat2x4 TYPE(120, 300, 120, 300, glsl_type::mat2x4_type); > mat3x2 TYPE(120, 300, 120, 300, glsl_type::mat3x2_type); > @@ -383,39 +383,39 @@ centroid KEYWORD_WITH_ALT(120, 300, 120, 300, > yyextra->EXT_gpu_shader4_enable, C > invariant KEYWORD(120, 100, 120, 100, INVARIANT); > flat KEYWORD_WITH_ALT(130, 100, 130, 300, > yyextra->EXT_gpu_shader4_enable, FLAT); > smooth KEYWORD(130, 300, 130, 300, SMOOTH); > noperspective KEYWORD_WITH_ALT(130, 300, 130, 0, > yyextra->EXT_gpu_shader4_enable, NOPERSPECTIVE); > patch KEYWORD_WITH_ALT(0, 300, 400, 320, > yyextra->has_tessellation_shader(), PATCH); > > sampler1D DEPRECATED_ES_TYPE(glsl_type::sampler1D_type); > sampler2D { yylval->type = glsl_type::sampler2D_type; return > BASIC_TYPE_TOK; } > sampler3D { yylval->type = glsl_type::sampler3D_type; return > BASIC_TYPE_TOK; } > samplerCube { yylval->type = glsl_type::samplerCube_type; return > BASIC_TYPE_TOK; } > -sampler1DArray TYPE(130, 300, 130, 0, glsl_type::sampler1DArray_type); > -sampler2DArray TYPE(130, 300, 130, 300, > glsl_type::sampler2DArray_type); > +sampler1DArray TYPE_WITH_ALT(130, 300, 130, 0, > yyextra->EXT_gpu_shader4_enable, glsl_type::sampler1DArray_type); > +sampler2DArray TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::sampler2DArray_type); > sampler1DShadow DEPRECATED_ES_TYPE(glsl_type::sampler1DShadow_type); > sampler2DShadow { yylval->type = glsl_type::sampler2DShadow_type; > return BASIC_TYPE_TOK; } > -samplerCubeShadow TYPE(130, 300, 130, 300, > glsl_type::samplerCubeShadow_type); > -sampler1DArrayShadow TYPE(130, 300, 130, 0, > glsl_type::sampler1DArrayShadow_type); > -sampler2DArrayShadow TYPE(130, 300, 130, 300, > glsl_type::sampler2DArrayShadow_type); > -isampler1D TYPE(130, 300, 130, 0, glsl_type::isampler1D_type); > -isampler2D TYPE(130, 300, 130, 300, glsl_type::isampler2D_type); > -isampler3D TYPE(130, 300, 130, 300, glsl_type::isampler3D_type); > -isamplerCube TYPE(130, 300, 130, 300, glsl_type::isamplerCube_type); > -isampler1DArray TYPE(130, 300, 130, 0, > glsl_type::isampler1DArray_type); > -isampler2DArray TYPE(130, 300, 130, 300, > glsl_type::isampler2DArray_type); > -usampler1D TYPE(130, 300, 130, 0, glsl_type::usampler1D_type); > -usampler2D TYPE(130, 300, 130, 300, glsl_type::usampler2D_type); > -usampler3D TYPE(130, 300, 130, 300, glsl_type::usampler3D_type); > -usamplerCube TYPE(130, 300, 130, 300, glsl_type::usamplerCube_type); > -usampler1DArray TYPE(130, 300, 130, 0, > glsl_type::usampler1DArray_type); > -usampler2DArray TYPE(130, 300, 130, 300, > glsl_type::usampler2DArray_type); > +samplerCubeShadow TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::samplerCubeShadow_type); > +sampler1DArrayShadow TYPE_WITH_ALT(130, 300, 130, 0, > yyextra->EXT_gpu_shader4_enable, glsl_type::sampler1DArrayShadow_type); > +sampler2DArrayShadow TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::sampler2DArrayShadow_type); > +isampler1D TYPE_WITH_ALT(130, 300, 130, 0, > yyextra->EXT_gpu_shader4_enable, glsl_type::isampler1D_type); > +isampler2D TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::isampler2D_type); > +isampler3D TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::isampler3D_type); > +isamplerCube TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::isamplerCube_type); > +isampler1DArray TYPE_WITH_ALT(130, 300, 130, 0, > yyextra->EXT_gpu_shader4_enable, glsl_type::isampler1DArray_type); > +isampler2DArray TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::isampler2DArray_type); > +usampler1D TYPE_WITH_ALT(130, 300, 130, 0, > yyextra->EXT_gpu_shader4_enable, glsl_type::usampler1D_type); > +usampler2D TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::usampler2D_type); > +usampler3D TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::usampler3D_type); > +usamplerCube TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::usamplerCube_type); > +usampler1DArray TYPE_WITH_ALT(130, 300, 130, 0, > yyextra->EXT_gpu_shader4_enable, glsl_type::usampler1DArray_type); > +usampler2DArray TYPE_WITH_ALT(130, 300, 130, 300, > yyextra->EXT_gpu_shader4_enable, glsl_type::usampler2DArray_type); > > /* additional keywords in ARB_texture_multisample, included in GLSL 1.50 > */ > /* these are reserved but not defined in GLSL 3.00 */ > /* [iu]sampler2DMS are defined in GLSL ES 3.10 */ > sampler2DMS TYPE_WITH_ALT(150, 300, 150, 310, > yyextra->ARB_texture_multisample_enable, glsl_type::sampler2DMS_type); > isampler2DMS TYPE_WITH_ALT(150, 300, 150, 310, > yyextra->ARB_texture_multisample_enable, glsl_type::isampler2DMS_type); > usampler2DMS TYPE_WITH_ALT(150, 300, 150, 310, > yyextra->ARB_texture_multisample_enable, glsl_type::usampler2DMS_type); > sampler2DMSArray TYPE_WITH_ALT(150, 300, 150, 320, > yyextra->ARB_texture_multisample_enable || > yyextra->OES_texture_storage_multisample_2d_array_enable, > glsl_type::sampler2DMSArray_type); > isampler2DMSArray TYPE_WITH_ALT(150, 300, 150, 320, > yyextra->ARB_texture_multisample_enable || > yyextra->OES_texture_storage_multisample_2d_array_enable, > glsl_type::isampler2DMSArray_type); > usampler2DMSArray TYPE_WITH_ALT(150, 300, 150, 320, > yyextra->ARB_texture_multisample_enable || > yyextra->OES_texture_storage_multisample_2d_array_enable, > glsl_type::usampler2DMSArray_type); > @@ -640,29 +640,29 @@ lowp KEYWORD(120, 100, 130, 100, LOWP); > mediump KEYWORD(120, 100, 130, 100, MEDIUMP); > highp KEYWORD(120, 100, 130, 100, HIGHP); > precision KEYWORD(120, 100, 130, 100, PRECISION); > > /* Additional reserved words in GLSL 1.30. */ > case KEYWORD(130, 300, 130, 300, CASE); > common KEYWORD(130, 300, 0, 0, COMMON); > partition KEYWORD(130, 300, 0, 0, PARTITION); > active KEYWORD(130, 300, 0, 0, ACTIVE); > superp KEYWORD(130, 100, 0, 0, SUPERP); > -samplerBuffer TYPE_WITH_ALT(130, 300, 140, 320, > yyextra->EXT_texture_buffer_enable || yyextra->OES_texture_buffer_enable, > glsl_type::samplerBuffer_type); > +samplerBuffer TYPE_WITH_ALT(130, 300, 140, 320, > yyextra->EXT_texture_buffer_enable || yyextra->OES_texture_buffer_enable || > yyextra->EXT_gpu_shader4_enable, glsl_type::samplerBuffer_type);
I don't think this change is correct. The EXT_gpu_shader4 spec says: Interactions with EXT_texture_buffer_object If EXT_texture_buffer_object is not supported, references to buffer textures, as well as the texelFetchBuffer and texelSizeBuffer lookup functions and samplerBuffer types, need to be removed So I think it's correct as-is, even when destkop OpenGL EXT_texture_buffer is added. > filter KEYWORD(130, 300, 0, 0, FILTER); > row_major KEYWORD_WITH_ALT(130, 0, 140, 0, > yyextra->ARB_uniform_buffer_object_enable && !yyextra->es_shader, ROW_MAJOR); > > /* Additional reserved words in GLSL 1.40 */ > -isampler2DRect TYPE(140, 300, 140, 0, glsl_type::isampler2DRect_type); > -usampler2DRect TYPE(140, 300, 140, 0, glsl_type::usampler2DRect_type); > -isamplerBuffer TYPE_WITH_ALT(140, 300, 140, 320, > yyextra->EXT_texture_buffer_enable || yyextra->OES_texture_buffer_enable, > glsl_type::isamplerBuffer_type); > -usamplerBuffer TYPE_WITH_ALT(140, 300, 140, 320, > yyextra->EXT_texture_buffer_enable || yyextra->OES_texture_buffer_enable, > glsl_type::usamplerBuffer_type); > +isampler2DRect TYPE_WITH_ALT(140, 300, 140, 0, > yyextra->EXT_gpu_shader4_enable, glsl_type::isampler2DRect_type); > +usampler2DRect TYPE_WITH_ALT(140, 300, 140, 0, > yyextra->EXT_gpu_shader4_enable, glsl_type::usampler2DRect_type); > +isamplerBuffer TYPE_WITH_ALT(140, 300, 140, 320, > yyextra->EXT_texture_buffer_enable || yyextra->OES_texture_buffer_enable || > yyextra->EXT_gpu_shader4_enable, glsl_type::isamplerBuffer_type); > +usamplerBuffer TYPE_WITH_ALT(140, 300, 140, 320, > yyextra->EXT_texture_buffer_enable || yyextra->OES_texture_buffer_enable || > yyextra->EXT_gpu_shader4_enable, glsl_type::usamplerBuffer_type); > > /* Additional reserved words in GLSL ES 3.00 */ > resource KEYWORD(420, 300, 0, 0, RESOURCE); > sample KEYWORD_WITH_ALT(400, 300, 400, 320, > yyextra->ARB_gpu_shader5_enable || > yyextra->OES_shader_multisample_interpolation_enable, SAMPLE); > subroutine KEYWORD_WITH_ALT(400, 300, 400, 0, > yyextra->ARB_shader_subroutine_enable, SUBROUTINE); > > /* Additional words for ARB_gpu_shader_int64 */ > int64_t TYPE_WITH_ALT(0, 0, 0, 0, > yyextra->ARB_gpu_shader_int64_enable, glsl_type::int64_t_type); > i64vec2 TYPE_WITH_ALT(0, 0, 0, 0, > yyextra->ARB_gpu_shader_int64_enable, glsl_type::i64vec2_type); > i64vec3 TYPE_WITH_ALT(0, 0, 0, 0, > yyextra->ARB_gpu_shader_int64_enable, glsl_type::i64vec3_type); > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev