Commit c4533eae by Yizhou Jiang Committed by Commit Bot

Enable ANGLE_texture_multisample in glsl in es 3.0

Enable gsampler2dMS, texelFetch, textureSize in glslang in es 3.0 if ANGLE_texture_multisample is supported. Bug: angleproject:2275 TEST=SamplerMultisampleEXTTest.TextureMultisampleEXTEnabled Change-Id: Ibfa367970db3ae790f3822e57eb50090843dc6db Reviewed-on: https://chromium-review.googlesource.com/c/867521Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Yizhou Jiang <yizhou.jiang@intel.com>
parent f2ed2995
...@@ -314,6 +314,7 @@ struct ShBuiltInResources ...@@ -314,6 +314,7 @@ struct ShBuiltInResources
int EXT_YUV_target; int EXT_YUV_target;
int EXT_geometry_shader; int EXT_geometry_shader;
int OES_texture_storage_multisample_2d_array; int OES_texture_storage_multisample_2d_array;
int ANGLE_texture_multisample;
// Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives // Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives
// with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate // with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate
......
...@@ -64,6 +64,7 @@ void GenerateResources(ShBuiltInResources *resources) ...@@ -64,6 +64,7 @@ void GenerateResources(ShBuiltInResources *resources)
resources->OES_standard_derivatives = 0; resources->OES_standard_derivatives = 0;
resources->OES_EGL_image_external = 0; resources->OES_EGL_image_external = 0;
resources->EXT_geometry_shader = 1; resources->EXT_geometry_shader = 1;
resources->ANGLE_texture_multisample = 0;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
"DXGI format:src/libANGLE/renderer/gen_angle_format_table.py": "DXGI format:src/libANGLE/renderer/gen_angle_format_table.py":
"9de29b6ca59a05747623c0dc32344b14", "9de29b6ca59a05747623c0dc32344b14",
"ESSL static builtins:src/compiler/translator/builtin_function_declarations.txt": "ESSL static builtins:src/compiler/translator/builtin_function_declarations.txt":
"336c2a275fe35bce1adc7e9b5918bdb0", "b98d4add454ee68dc17d9bd550abf61d",
"ESSL static builtins:src/compiler/translator/builtin_variables.json": "ESSL static builtins:src/compiler/translator/builtin_variables.json":
"2c0e86ff9f92f79ada03f04206e63fba", "2c0e86ff9f92f79ada03f04206e63fba",
"ESSL static builtins:src/compiler/translator/gen_builtin_symbols.py": "ESSL static builtins:src/compiler/translator/gen_builtin_symbols.py":
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#define LIST_EXTENSIONS(OP) \ #define LIST_EXTENSIONS(OP) \
OP(ARB_texture_rectangle) \ OP(ARB_texture_rectangle) \
OP(ANGLE_texture_multisample) \
OP(ARM_shader_framebuffer_fetch) \ OP(ARM_shader_framebuffer_fetch) \
OP(EXT_blend_func_extended) \ OP(EXT_blend_func_extended) \
OP(EXT_draw_buffers) \ OP(EXT_draw_buffers) \
......
...@@ -19,6 +19,7 @@ enum class TExtension ...@@ -19,6 +19,7 @@ enum class TExtension
UNDEFINED, // Special value used to indicate no extension. UNDEFINED, // Special value used to indicate no extension.
ARB_texture_rectangle, ARB_texture_rectangle,
ANGLE_texture_multisample,
ARM_shader_framebuffer_fetch, ARM_shader_framebuffer_fetch,
EXT_blend_func_extended, EXT_blend_func_extended,
EXT_draw_buffers, EXT_draw_buffers,
......
...@@ -77,6 +77,10 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi ...@@ -77,6 +77,10 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi
{ {
extBehavior[TExtension::OES_texture_storage_multisample_2d_array] = EBhUndefined; extBehavior[TExtension::OES_texture_storage_multisample_2d_array] = EBhUndefined;
} }
if (resources.ANGLE_texture_multisample)
{
extBehavior[TExtension::ANGLE_texture_multisample] = EBhUndefined;
}
} }
void ResetExtensionBehavior(TExtensionBehavior &extBehavior) void ResetExtensionBehavior(TExtensionBehavior &extBehavior)
......
...@@ -21,42 +21,42 @@ namespace BuiltInGroup ...@@ -21,42 +21,42 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func) bool isTextureOffsetNoBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 668 && id <= 737; return id >= 671 && id <= 740;
} }
bool isTextureOffsetBias(const TFunction *func) bool isTextureOffsetBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 738 && id <= 757; return id >= 741 && id <= 760;
} }
bool isTextureGatherOffset(const TFunction *func) bool isTextureGatherOffset(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 832 && id <= 845; return id >= 838 && id <= 851;
} }
bool isTextureGather(const TFunction *func) bool isTextureGather(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 808 && id <= 845; return id >= 814 && id <= 851;
} }
bool isAtomicMemory(const TFunction *func) bool isAtomicMemory(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 862 && id <= 879; return id >= 868 && id <= 885;
} }
bool isImageLoad(const TFunction *func) bool isImageLoad(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 904 && id <= 915; return id >= 910 && id <= 921;
} }
bool isImageStore(const TFunction *func) bool isImageStore(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 916 && id <= 927; return id >= 922 && id <= 933;
} }
bool isImage(const TFunction *func) bool isImage(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 880 && id <= 927; return id >= 886 && id <= 933;
} }
} // namespace BuiltInGroup } // namespace BuiltInGroup
......
...@@ -203,6 +203,7 @@ void InitBuiltInResources(ShBuiltInResources *resources) ...@@ -203,6 +203,7 @@ void InitBuiltInResources(ShBuiltInResources *resources)
resources->EXT_YUV_target = 0; resources->EXT_YUV_target = 0;
resources->EXT_geometry_shader = 0; resources->EXT_geometry_shader = 0;
resources->OES_texture_storage_multisample_2d_array = 0; resources->OES_texture_storage_multisample_2d_array = 0;
resources->ANGLE_texture_multisample = 0;
resources->NV_draw_buffers = 0; resources->NV_draw_buffers = 0;
......
...@@ -381,6 +381,11 @@ GROUP BEGIN TextureSizeMS ...@@ -381,6 +381,11 @@ GROUP BEGIN TextureSizeMS
ivec2 textureSize(gsampler2DMS); ivec2 textureSize(gsampler2DMS);
GROUP END TextureSizeMS GROUP END TextureSizeMS
GROUP BEGIN TextureSizeMSExt
DEFAULT METADATA {"level": "ESSL3_BUILTINS", "op": "CallBuiltInFunction", "extension": "ANGLE_texture_multisample", "suffix": "Ext"}
ivec2 textureSize(gsampler2DMS);
GROUP END TextureSizeMSExt
GROUP BEGIN TextureSizeMSArray GROUP BEGIN TextureSizeMSArray
DEFAULT METADATA {"level": "ESSL3_1_BUILTINS", "op": "CallBuiltInFunction", "extension": "OES_texture_storage_multisample_2d_array"} DEFAULT METADATA {"level": "ESSL3_1_BUILTINS", "op": "CallBuiltInFunction", "extension": "OES_texture_storage_multisample_2d_array"}
ivec3 textureSize(gsampler2DMSArray); ivec3 textureSize(gsampler2DMSArray);
...@@ -477,6 +482,11 @@ GROUP BEGIN TexelFetchMS ...@@ -477,6 +482,11 @@ GROUP BEGIN TexelFetchMS
gvec4 texelFetch(gsampler2DMS, ivec2, int); gvec4 texelFetch(gsampler2DMS, ivec2, int);
GROUP END TexelFetchMS GROUP END TexelFetchMS
GROUP BEGIN TexelFetchMSExt
DEFAULT METADATA {"level": "ESSL3_BUILTINS", "op": "CallBuiltInFunction", "extension": "ANGLE_texture_multisample", "suffix": "Ext"}
gvec4 texelFetch(gsampler2DMS, ivec2, int);
GROUP END TexelFetchMSExt
GROUP BEGIN TexelFetchMSArray GROUP BEGIN TexelFetchMSArray
DEFAULT METADATA {"level": "ESSL3_1_BUILTINS", "op": "CallBuiltInFunction", "extension": "OES_texture_storage_multisample_2d_array"} DEFAULT METADATA {"level": "ESSL3_1_BUILTINS", "op": "CallBuiltInFunction", "extension": "OES_texture_storage_multisample_2d_array"}
gvec4 texelFetch(gsampler2DMSArray, ivec3, int); gvec4 texelFetch(gsampler2DMSArray, ivec3, int);
......
73cc05cec23b85e97dfc3c1b334a927c be8880d407c36c696b4ef362988abd50
\ No newline at end of file \ No newline at end of file
...@@ -86,6 +86,7 @@ static int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token) ...@@ -86,6 +86,7 @@ static int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token)
static int ES2_and_ES3_ident_ES3_1_keyword(TParseContext *context, int token); static int ES2_and_ES3_ident_ES3_1_keyword(TParseContext *context, int token);
static int ES3_extension_keyword_else_ident(TParseContext *context, TExtension extension, int token); static int ES3_extension_keyword_else_ident(TParseContext *context, TExtension extension, int token);
static int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExtension extension, int token); static int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExtension extension, int token);
static int ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(TParseContext *context, TExtension extension, int token);
static int uint_constant(TParseContext *context); static int uint_constant(TParseContext *context);
static int int_constant(TParseContext *context); static int int_constant(TParseContext *context);
static int float_constant(yyscan_t yyscanner); static int float_constant(yyscan_t yyscanner);
...@@ -189,17 +190,17 @@ O [0-7] ...@@ -189,17 +190,17 @@ O [0-7]
"sampler3DRect" { return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); } "sampler3DRect" { return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
"sampler2DRect" { return SAMPLER2DRECT; } "sampler2DRect" { return SAMPLER2DRECT; }
"sampler2DArray" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAY); } "sampler2DArray" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAY); }
"sampler2DMS" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, SAMPLER2DMS); } "sampler2DMS" { return ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(context, TExtension::ANGLE_texture_multisample, SAMPLER2DMS); }
"isampler2D" { return ES2_ident_ES3_keyword(context, ISAMPLER2D); } "isampler2D" { return ES2_ident_ES3_keyword(context, ISAMPLER2D); }
"isampler3D" { return ES2_ident_ES3_keyword(context, ISAMPLER3D); } "isampler3D" { return ES2_ident_ES3_keyword(context, ISAMPLER3D); }
"isamplerCube" { return ES2_ident_ES3_keyword(context, ISAMPLERCUBE); } "isamplerCube" { return ES2_ident_ES3_keyword(context, ISAMPLERCUBE); }
"isampler2DArray" { return ES2_ident_ES3_keyword(context, ISAMPLER2DARRAY); } "isampler2DArray" { return ES2_ident_ES3_keyword(context, ISAMPLER2DARRAY); }
"isampler2DMS" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, ISAMPLER2DMS); } "isampler2DMS" { return ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(context, TExtension::ANGLE_texture_multisample, ISAMPLER2DMS); }
"usampler2D" { return ES2_ident_ES3_keyword(context, USAMPLER2D); } "usampler2D" { return ES2_ident_ES3_keyword(context, USAMPLER2D); }
"usampler3D" { return ES2_ident_ES3_keyword(context, USAMPLER3D); } "usampler3D" { return ES2_ident_ES3_keyword(context, USAMPLER3D); }
"usamplerCube" { return ES2_ident_ES3_keyword(context, USAMPLERCUBE); } "usamplerCube" { return ES2_ident_ES3_keyword(context, USAMPLERCUBE); }
"usampler2DArray" { return ES2_ident_ES3_keyword(context, USAMPLER2DARRAY); } "usampler2DArray" { return ES2_ident_ES3_keyword(context, USAMPLER2DARRAY); }
"usampler2DMS" { return ES2_ident_ES3_reserved_ES3_1_keyword(context, USAMPLER2DMS); } "usampler2DMS" { return ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(context, TExtension::ANGLE_texture_multisample, USAMPLER2DMS); }
"sampler2DShadow" { return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); } "sampler2DShadow" { return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); }
"samplerCubeShadow" { return ES2_ident_ES3_keyword(context, SAMPLERCUBESHADOW); } "samplerCubeShadow" { return ES2_ident_ES3_keyword(context, SAMPLERCUBESHADOW); }
"sampler2DArrayShadow" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAYSHADOW); } "sampler2DArrayShadow" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
...@@ -599,6 +600,26 @@ int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExte ...@@ -599,6 +600,26 @@ int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExte
return check_type(yyscanner); return check_type(yyscanner);
} }
int ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(TParseContext *context, TExtension extension, int token)
{
struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
yyscan_t yyscanner = (yyscan_t) context->getScanner();
// A keyword in GLSL ES 3.00 with enabled extension or in GLSL ES 3.10
if (context->getShaderVersion() >= 310 || (context->getShaderVersion() == 300 && context->isExtensionEnabled(extension)))
{
return token;
}
if(context->getShaderVersion() == 300)
{
return reserved_word(yyscanner);
}
yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
return check_type(yyscanner);
}
int uint_constant(TParseContext *context) int uint_constant(TParseContext *context)
{ {
struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner(); struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
......
...@@ -1225,6 +1225,7 @@ static int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token) ...@@ -1225,6 +1225,7 @@ static int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token)
static int ES2_and_ES3_ident_ES3_1_keyword(TParseContext *context, int token); static int ES2_and_ES3_ident_ES3_1_keyword(TParseContext *context, int token);
static int ES3_extension_keyword_else_ident(TParseContext *context, TExtension extension, int token); static int ES3_extension_keyword_else_ident(TParseContext *context, TExtension extension, int token);
static int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExtension extension, int token); static int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExtension extension, int token);
static int ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(TParseContext *context, TExtension extension, int token);
static int uint_constant(TParseContext *context); static int uint_constant(TParseContext *context);
static int int_constant(TParseContext *context); static int int_constant(TParseContext *context);
static int float_constant(yyscan_t yyscanner); static int float_constant(yyscan_t yyscanner);
...@@ -1968,7 +1969,7 @@ YY_RULE_SETUP ...@@ -1968,7 +1969,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 68: case 68:
YY_RULE_SETUP YY_RULE_SETUP
{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, SAMPLER2DMS); } { return ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(context, TExtension::ANGLE_texture_multisample, SAMPLER2DMS); }
YY_BREAK YY_BREAK
case 69: case 69:
YY_RULE_SETUP YY_RULE_SETUP
...@@ -1988,7 +1989,7 @@ YY_RULE_SETUP ...@@ -1988,7 +1989,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 73: case 73:
YY_RULE_SETUP YY_RULE_SETUP
{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, ISAMPLER2DMS); } { return ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(context, TExtension::ANGLE_texture_multisample, ISAMPLER2DMS); }
YY_BREAK YY_BREAK
case 74: case 74:
YY_RULE_SETUP YY_RULE_SETUP
...@@ -2008,7 +2009,7 @@ YY_RULE_SETUP ...@@ -2008,7 +2009,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 78: case 78:
YY_RULE_SETUP YY_RULE_SETUP
{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, USAMPLER2DMS); } { return ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(context, TExtension::ANGLE_texture_multisample, USAMPLER2DMS); }
YY_BREAK YY_BREAK
case 79: case 79:
YY_RULE_SETUP YY_RULE_SETUP
...@@ -3964,6 +3965,26 @@ int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExte ...@@ -3964,6 +3965,26 @@ int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExte
return check_type(yyscanner); return check_type(yyscanner);
} }
int ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(TParseContext *context, TExtension extension, int token)
{
struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
yyscan_t yyscanner = (yyscan_t) context->getScanner();
// A keyword in GLSL ES 3.00 with enabled extension or in GLSL ES 3.10
if (context->getShaderVersion() >= 310 || (context->getShaderVersion() == 300 && context->isExtensionEnabled(extension)))
{
return token;
}
if(context->getShaderVersion() == 300)
{
return reserved_word(yyscanner);
}
yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
return check_type(yyscanner);
}
int uint_constant(TParseContext *context) int uint_constant(TParseContext *context)
{ {
struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner(); struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment