Commit 1d742ce8 by Clemen Deng Committed by Commit Bot

Deleted unnecessary built-in conditions

A few built-in variables are checking against overly complicated extension conditions, deleting these will make the array lookup easier to implement. Also changed functionality to always enable GL_OVR_multiview when GL_OVR_multiview2 is enabled Bug: angleproject:3805 Change-Id: I10fc7db0fa8b496fbba8b2c27a7311ac3c24dbe4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1752082 Commit-Queue: Clemen Deng <clemendeng@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 188b679b
......@@ -4,13 +4,13 @@
"src/compiler/translator/ParseContext_autogen.h":
"58786d2f352ee1a58d529fb7572c86a4",
"src/compiler/translator/SymbolTable_autogen.cpp":
"cd0abc040d6902e1688d048d19ca70a9",
"e53566eaeeb2ca47d54b22ff0ff21b6d",
"src/compiler/translator/SymbolTable_autogen.h":
"bdb3c8eab0d48267a2f264e3af635e1a",
"src/compiler/translator/builtin_function_declarations.txt":
"d0c15cb9f2ef6c0ba5cd6612470db000",
"src/compiler/translator/builtin_variables.json":
"04f763459cfbd47831bec22299287e82",
"bbcda061188c066dd887f9ecf5f6f4b4",
"src/compiler/translator/gen_builtin_symbols.py":
"5527c49f0e939aa593fa14f0f0cf84c5",
"src/compiler/translator/tree_util/BuiltIn_autogen.h":
......
......@@ -164,6 +164,17 @@ void TDirectiveHandler::handleExtension(const angle::pp::SourceLocation &loc,
if (iter != mExtensionBehavior.end())
{
iter->second = behaviorVal;
// OVR_multiview is implicitly enabled when OVR_multiview2 is enabled
if (name == "GL_OVR_multiview2")
{
const std::string multiview = "GL_OVR_multiview";
TExtensionBehavior::iterator iterMultiview =
mExtensionBehavior.find(GetExtensionByName(multiview.c_str()));
if (iterMultiview != mExtensionBehavior.end())
{
iterMultiview->second = behaviorVal;
}
}
return;
}
......
......@@ -17236,8 +17236,7 @@ const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shader
}
}
}
if ((mResources.OVR_multiview || mResources.OVR_multiview2) &&
mShaderType != GL_COMPUTE_SHADER)
if (mResources.OVR_multiview && mShaderType != GL_COMPUTE_SHADER)
{
switch (nameHash)
{
......@@ -17716,9 +17715,7 @@ const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shader
}
}
}
if ((mShaderType == GL_FRAGMENT_SHADER) &&
(!mResources.EXT_shader_framebuffer_fetch && !mResources.NV_shader_framebuffer_fetch &&
mResources.ARM_shader_framebuffer_fetch))
if ((mShaderType == GL_FRAGMENT_SHADER) && (mResources.ARM_shader_framebuffer_fetch))
{
switch (nameHash)
{
......@@ -17746,8 +17743,7 @@ const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shader
}
}
}
if ((mResources.OVR_multiview || mResources.OVR_multiview2) &&
mShaderType != GL_COMPUTE_SHADER)
if (mResources.OVR_multiview && mShaderType != GL_COMPUTE_SHADER)
{
switch (nameHash)
{
......
......@@ -577,7 +577,7 @@
}
},
"ARMShaderFramebufferFetch":{
"condition":"!mResources.EXT_shader_framebuffer_fetch && !mResources.NV_shader_framebuffer_fetch && mResources.ARM_shader_framebuffer_fetch",
"condition":"mResources.ARM_shader_framebuffer_fetch",
"variables":{
"gl_LastFragColorARM":{
"level":"ESSL1_BUILTINS",
......@@ -882,7 +882,7 @@
}
},
"Multiview":{
"condition":"(mResources.OVR_multiview||mResources.OVR_multiview2) && shaderType != GL_COMPUTE_SHADER",
"condition":"mResources.OVR_multiview && shaderType != GL_COMPUTE_SHADER",
"subgroups":{
"ESSL3":{
"variables":{
......
......@@ -3151,6 +3151,11 @@ bool Context::isExtensionRequestable(const char *name)
void Context::requestExtension(const char *name)
{
// OVR_multiview is implicitly enabled when OVR_multiview2 is enabled
if (strcmp(name, "GL_OVR_multiview2") == 0)
{
requestExtension("GL_OVR_multiview");
}
const ExtensionInfoMap &extensionInfos = GetExtensionInfoMap();
ASSERT(extensionInfos.find(name) != extensionInfos.end());
const auto &extension = extensionInfos.at(name);
......
......@@ -97,6 +97,7 @@ class OVRMultiview2VertexShaderTest : public ShaderCompileTreeTest
ShShaderSpec getShaderSpec() const override { return SH_WEBGL3_SPEC; }
void initResources(ShBuiltInResources *resources) override
{
resources->OVR_multiview = 1;
resources->OVR_multiview2 = 1;
resources->MaxViewsOVR = 4;
}
......@@ -112,6 +113,7 @@ class OVRMultiview2FragmentShaderTest : public ShaderCompileTreeTest
ShShaderSpec getShaderSpec() const override { return SH_WEBGL3_SPEC; }
void initResources(ShBuiltInResources *resources) override
{
resources->OVR_multiview = 1;
resources->OVR_multiview2 = 1;
resources->MaxViewsOVR = 4;
}
......@@ -125,6 +127,7 @@ class OVRMultiview2OutputCodeTest : public MatchOutputCodeTest
{
addOutputType(SH_GLSL_COMPATIBILITY_OUTPUT);
getResources()->OVR_multiview = 1;
getResources()->OVR_multiview2 = 1;
getResources()->MaxViewsOVR = 4;
}
......@@ -187,25 +190,6 @@ void VariableOccursNTimes(TIntermBlock *root,
EXPECT_EQ(n, viewIDByName.getNumberOfOccurrences());
}
// Unsupported GL_OVR_multiview extension directive (GL_OVR_multiview2 spec only exposes
// GL_OVR_multiview2).
TEST_F(OVRMultiview2VertexShaderTest, InvalidMultiview2)
{
const std::string &shaderString =
"#version 300 es\n"
"#extension GL_OVR_multiview : require\n"
"layout(num_views = 2) in;\n"
"void main()\n"
"{\n"
" gl_Position.x = (gl_ViewID_OVR == 0u) ? 1.0 : 0.0;\n"
" gl_Position.yzw = vec3(0, 0, 1);\n"
"}\n";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Invalid combination of non-matching num_views declarations.
TEST_F(OVRMultiview2VertexShaderTest, InvalidNumViewsMismatch)
{
......
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