Commit 5e0a8f9b by Shahbaz Youssefi Committed by Commit Bot

Translator: Enable geometry and tessellation in ES3.2

Symbols that these extensions introduced were only accepted if the extension directive was present. This is not necessary for es 320 shaders. This change adds a new tag to builtin variable and function declarations in the translator, namely "essl_extension_becomes_core_in" which makes gen_builtin_symbols.py automatically create two entries for the builtin; one with the specified level and extension, one with the core level and without extension. Entries in builtin_function_declarations.txt can potentially be deduplicated as a follow up to take advantage of this tag, though likely an anologous "glsl_extension_becomes_core_in" needs to be introduced. Bug: angleproject:5557 Bug: angleproject:5579 Change-Id: I84c19f48a3ccc89d82d80a4f35f7833205bbc88f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2649449Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent badcf3bd
......@@ -4,25 +4,25 @@
"src/compiler/translator/ImmutableString_autogen.cpp":
"5c77d1341ef8f3d506aa918c646a90af",
"src/compiler/translator/ParseContext_ESSL_autogen.h":
"6da863c0ec89166d10a148ddb6178dd1",
"6ee6e9e843ae43d0d8c7576f2104db15",
"src/compiler/translator/ParseContext_complete_autogen.h":
"2db8d7d0efd13afdd4b971c89f785f7e",
"src/compiler/translator/SymbolTable_ESSL_autogen.cpp":
"53cd516345cded422cf61c16c2f4a19a",
"65376822952784b4f81fedb8fc1a216a",
"src/compiler/translator/SymbolTable_autogen.cpp":
"4767d8c23e4db437fa2ab98666bfa535",
"b9bb430ee04e5f4a53479f4fe38b179c",
"src/compiler/translator/SymbolTable_autogen.h":
"f76260fe28587e720590adcedcb65928",
"f5cfa6c5f81416f074c17d2f3245b678",
"src/compiler/translator/builtin_function_declarations.txt":
"29ab2d428cf0079127d22eda430deb36",
"337bdd37f549ee3ba84a8ac45e250c0d",
"src/compiler/translator/builtin_variables.json":
"5c2641aae409184a249d6ad57f93a502",
"a1093fa8db0483716e4644a78d8b5150",
"src/compiler/translator/gen_builtin_symbols.py":
"12f20fb93de0634ca9de5532185e0244",
"0b997ff6e25c823a62264ad618b070ed",
"src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h":
"63eb495054fa3a28fd0c10981cd77961",
"efc6fbba081842cf29b6c8bb7179e0c1",
"src/compiler/translator/tree_util/BuiltIn_complete_autogen.h":
"b3e5c368ccdf96bf564f32bbf19e5f69",
"81c368111e4594f4ef82d80a918c4748",
"src/tests/compiler_tests/ImmutableString_test_ESSL_autogen.cpp":
"b0ce4e0905740d612471ca1ad68cfaba",
"src/tests/compiler_tests/ImmutableString_test_autogen.cpp":
......
......@@ -1258,7 +1258,7 @@ struct TLayoutQualifier
int invocations;
int maxVertices;
// EXT_tessellation_control shader layout qualifiers
// EXT_tessellation_shader shader layout qualifiers
int vertices;
TLayoutTessEvaluationType tesPrimitiveType;
TLayoutTessEvaluationType tesVertexSpacingType;
......@@ -1414,6 +1414,9 @@ inline const char *getQualifierString(TQualifier q)
case EvqGeometryIn: return "in";
case EvqGeometryOut: return "out";
case EvqPerVertexIn: return "gl_in";
case EvqPrimitiveIDIn: return "gl_PrimitiveIDIn";
case EvqInvocationID: return "gl_InvocationID";
case EvqPrimitiveID: return "gl_PrimitiveID";
case EvqPrecise: return "precise";
case EvqClipDistance: return "ClipDistance";
case EvqSample: return "sample";
......
......@@ -459,9 +459,8 @@ bool TCompiler::checkShaderVersion(TParseContext *parseContext)
"Geometry shader is not supported in this shader version.");
return false;
}
else
else if (mShaderVersion == 310)
{
ASSERT(mShaderVersion == 310 || mShaderVersion == 320);
if (!parseContext->checkCanUseExtension(sh::TSourceLoc(),
TExtension::EXT_geometry_shader))
{
......@@ -470,6 +469,24 @@ bool TCompiler::checkShaderVersion(TParseContext *parseContext)
}
break;
case GL_TESS_CONTROL_SHADER_EXT:
case GL_TESS_EVALUATION_SHADER_EXT:
if (mShaderVersion < 310)
{
mDiagnostics.globalError(
"Tessellation shaders are not supported in this shader version.");
return false;
}
else if (mShaderVersion == 310)
{
if (!parseContext->checkCanUseExtension(sh::TSourceLoc(),
TExtension::EXT_tessellation_shader))
{
return false;
}
}
break;
default:
break;
}
......
......@@ -2499,7 +2499,7 @@ void TParseContext::checkInputOutputTypeIsValidES3(const TQualifier qualifier,
bool typeContainsIntegers =
(type.getBasicType() == EbtInt || type.getBasicType() == EbtUInt ||
type.isStructureContainingType(EbtInt) || type.isStructureContainingType(EbtUInt));
bool extendedShaderTypes = mShaderVersion == 320 ||
bool extendedShaderTypes = mShaderVersion >= 320 ||
isExtensionEnabled(TExtension::EXT_geometry_shader) ||
isExtensionEnabled(TExtension::EXT_tessellation_shader);
if (typeContainsIntegers && qualifier != EvqFlatIn && qualifier != EvqFlatOut &&
......@@ -4135,7 +4135,7 @@ TIntermDeclaration *TParseContext::addInterfaceBlock(
if (isShaderIoBlock)
{
if (!isExtensionEnabled(TExtension::OES_shader_io_blocks) &&
!isExtensionEnabled(TExtension::EXT_shader_io_blocks))
!isExtensionEnabled(TExtension::EXT_shader_io_blocks) && mShaderVersion < 320)
{
error(typeQualifier.line,
"invalid qualifier: shader IO blocks need shader io block extension",
......@@ -4981,8 +4981,9 @@ TLayoutQualifier TParseContext::parseLayoutQualifier(const ImmutableString &qual
qualifier.imageInternalFormat = EiifR32UI;
}
else if (mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader) &&
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310))
(mShaderVersion >= 320 ||
(checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader) &&
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310))))
{
if (qualifierType == "points")
{
......@@ -5018,8 +5019,9 @@ TLayoutQualifier TParseContext::parseLayoutQualifier(const ImmutableString &qual
}
}
else if (mShaderType == GL_TESS_EVALUATION_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::EXT_tessellation_shader) &&
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310))
(mShaderVersion >= 320 ||
(checkCanUseExtension(qualifierTypeLine, TExtension::EXT_tessellation_shader) &&
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310))))
{
if (qualifierType == "triangles")
{
......@@ -5254,12 +5256,14 @@ TLayoutQualifier TParseContext::parseLayoutQualifier(const ImmutableString &qual
}
}
else if (qualifierType == "invocations" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
(mShaderVersion >= 320 ||
checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader)))
{
parseInvocations(intValue, intValueLine, intValueString, &qualifier.invocations);
}
else if (qualifierType == "max_vertices" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
(mShaderVersion >= 320 ||
checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader)))
{
parseMaxVertices(intValue, intValueLine, intValueString, &qualifier.maxVertices);
}
......@@ -5269,7 +5273,8 @@ TLayoutQualifier TParseContext::parseLayoutQualifier(const ImmutableString &qual
parseIndexLayoutQualifier(intValue, intValueLine, intValueString, &qualifier.index);
}
else if (qualifierType == "vertices" && mShaderType == GL_TESS_CONTROL_SHADER_EXT &&
checkCanUseExtension(qualifierTypeLine, TExtension::EXT_tessellation_shader))
(mShaderVersion >= 320 ||
checkCanUseExtension(qualifierTypeLine, TExtension::EXT_tessellation_shader)))
{
parseVertices(intValue, intValueLine, intValueString, &qualifier.vertices);
}
......
......@@ -21,77 +21,77 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3729 && id <= 3798;
return id >= 3794 && id <= 3863;
}
bool isTextureOffsetBias(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3799 && id <= 3818;
return id >= 3864 && id <= 3883;
}
bool isTextureGatherOffsetsComp(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3856 && id <= 3868;
return id >= 3921 && id <= 3933;
}
bool isTextureGatherOffsetsNoComp(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3869 && id <= 3884;
return id >= 3934 && id <= 3949;
}
bool isTextureGatherOffsets(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3856 && id <= 3884;
return id >= 3921 && id <= 3949;
}
bool isTextureGatherOffsetComp(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3885 && id <= 3890;
return id >= 3950 && id <= 3955;
}
bool isTextureGatherOffsetNoComp(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3891 && id <= 3898;
return id >= 3956 && id <= 3963;
}
bool isTextureGatherOffset(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3885 && id <= 3898;
return id >= 3950 && id <= 3963;
}
bool isTextureGather(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3832 && id <= 3898;
return id >= 3897 && id <= 3963;
}
bool isInterpolationFS(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3911 && id <= 3934;
return id >= 3976 && id <= 3999;
}
bool isAtomicMemory(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3939 && id <= 3956;
return id >= 4004 && id <= 4021;
}
bool isImageLoad(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3993 && id <= 4010;
return id >= 4058 && id <= 4075;
}
bool isImageAtomic(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 4011 && id <= 4586;
return id >= 4076 && id <= 4651;
}
bool isImageStore(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 4587 && id <= 4604;
return id >= 4652 && id <= 4669;
}
bool isImage(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 3957 && id <= 4604;
return id >= 4022 && id <= 4669;
}
} // namespace BuiltInGroup
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -34,6 +34,8 @@
// function name from C++ keywords, or disambiguate two functions with the same name.
// "essl_extension"
// string, ESSL extension where the function is defined.
// "essl_extension_becomes_core_in"
// string, ESSL level where functions from this extension have become core.
// "glsl_extension"
// string, GLSL extension where the function is defined.
// "hasSideEffects"
......@@ -1182,12 +1184,12 @@ GROUP BEGIN ESSL310CS {"shader_type": "COMPUTE"}
GROUP END ESSL310CS
GROUP BEGIN ESSL310TCS {"shader_type": "TESS_CONTROL_EXT"}
DEFAULT METADATA {"essl_level": "ESSL3_1_BUILTINS", "op": "auto", "essl_extension": "EXT_tessellation_shader", "hasSideEffects": true}
DEFAULT METADATA {"essl_level": "ESSL3_1_BUILTINS", "op": "auto", "essl_extension": "EXT_tessellation_shader", "essl_extension_becomes_core_in": "ESSL3_2_BUILTINS", "hasSideEffects": true}
void barrier();
GROUP END ESSL310TCS
GROUP BEGIN ESSL310GS {"shader_type": "GEOMETRY_EXT"}
DEFAULT METADATA {"essl_level": "ESSL3_1_BUILTINS", "op": "auto", "essl_extension": "EXT_geometry_shader", "hasSideEffects": true}
DEFAULT METADATA {"essl_level": "ESSL3_1_BUILTINS", "op": "auto", "essl_extension": "EXT_geometry_shader", "essl_extension_becomes_core_in": "ESSL3_2_BUILTINS", "hasSideEffects": true}
void EmitVertex();
void EndPrimitive();
GROUP END ESSL310GS
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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