Commit 2f90a9b5 by Olli Etuaho Committed by Commit Bot

Fix shader support of OVR_multiview

Fix up incorrect capitalization of gl_ViewID_OVR in a few places. Also add extension macro test to compiler unit tests. BUG=angleproject:1669 TEST=angle_unittests Change-Id: Ia7fdd747ad08355cdc149db9e2e7911c2e673af5 Reviewed-on: https://chromium-review.googlesource.com/425851Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent bb1db48e
...@@ -1143,7 +1143,7 @@ TString TOutputGLSLBase::hashVariableName(const TName &name) ...@@ -1143,7 +1143,7 @@ TString TOutputGLSLBase::hashVariableName(const TName &name)
if (mCompileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM && if (mCompileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM &&
name.getString() == "gl_ViewID_OVR") name.getString() == "gl_ViewID_OVR")
{ {
TName uniformName(TString("ViewId_OVR")); TName uniformName(TString("ViewID_OVR"));
uniformName.setInternal(true); uniformName.setInternal(true);
return hashName(uniformName); return hashName(uniformName);
} }
......
...@@ -97,7 +97,7 @@ void TranslatorESSL::translate(TIntermNode *root, ShCompileOptions compileOption ...@@ -97,7 +97,7 @@ void TranslatorESSL::translate(TIntermNode *root, ShCompileOptions compileOption
if (compileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM) if (compileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM)
{ {
TName uniformName(TString("ViewId_OVR")); TName uniformName(TString("ViewID_OVR"));
uniformName.setInternal(true); uniformName.setInternal(true);
sink << "highp uniform int " << outputESSL.hashName(uniformName) << ";\n"; sink << "highp uniform int " << outputESSL.hashName(uniformName) << ";\n";
} }
......
...@@ -207,7 +207,7 @@ void TranslatorGLSL::translate(TIntermNode *root, ShCompileOptions compileOption ...@@ -207,7 +207,7 @@ void TranslatorGLSL::translate(TIntermNode *root, ShCompileOptions compileOption
if (compileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM) if (compileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM)
{ {
TName uniformName(TString("ViewId_OVR")); TName uniformName(TString("ViewID_OVR"));
uniformName.setInternal(true); uniformName.setInternal(true);
sink << "uniform int " << outputGLSL.hashName(uniformName) << ";\n"; sink << "uniform int " << outputGLSL.hashName(uniformName) << ";\n";
} }
......
...@@ -360,3 +360,24 @@ TEST_F(WEBGLMultiviewVertexShaderTest, RestrictionsLiftedMultiview2) ...@@ -360,3 +360,24 @@ TEST_F(WEBGLMultiviewVertexShaderTest, RestrictionsLiftedMultiview2)
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog; FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
} }
} }
// Correct use of GL_OVR_multiview macros.
TEST_F(WEBGLMultiviewVertexShaderTest, ValidUseOfExtensionMacros)
{
const std::string &shaderString =
"#version 300 es\n"
"#ifdef GL_OVR_multiview\n"
"#ifdef GL_OVR_multiview2\n"
"#if (GL_OVR_multiview == 1) && (GL_OVR_multiview2 == 1)\n"
"void main()\n"
"{\n"
" gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n"
"}\n"
"#endif\n"
"#endif\n"
"#endif\n";
if (!compile(shaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
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