Commit 6d276c8e by Jamie Madill

Revert "Make all fragment shader out variables require location layout qualifier"

Causes a warning on Windows: compiler\translator\ValidateOutputs.cpp(37): warning C4804: '>' : unsafe use of type 'bool' in operation BUG=angleproject:1070 This reverts commit 140941d0. Change-Id: Ieed42cdda22f17c6e15c38ee1c059184869e6919 Reviewed-on: https://chromium-review.googlesource.com/286820Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 140941d0
...@@ -14,7 +14,7 @@ ValidateOutputs::ValidateOutputs(TInfoSinkBase& sink, int maxDrawBuffers) ...@@ -14,7 +14,7 @@ ValidateOutputs::ValidateOutputs(TInfoSinkBase& sink, int maxDrawBuffers)
mSink(sink), mSink(sink),
mMaxDrawBuffers(maxDrawBuffers), mMaxDrawBuffers(maxDrawBuffers),
mNumErrors(0), mNumErrors(0),
mUnspecifiedOutputLocationCount(0) mHasUnspecifiedOutputLocation(false)
{ {
} }
...@@ -32,15 +32,14 @@ void ValidateOutputs::visitSymbol(TIntermSymbol *symbol) ...@@ -32,15 +32,14 @@ void ValidateOutputs::visitSymbol(TIntermSymbol *symbol)
{ {
const TType &type = symbol->getType(); const TType &type = symbol->getType();
const int location = type.getLayoutQualifier().location; const int location = type.getLayoutQualifier().location;
const bool isUnspecifiedOutputLocation = location == -1;
if (mUnspecifiedOutputLocationCount > 0 || (isUnspecifiedOutputLocation && !mOutputMap.empty())) if (mHasUnspecifiedOutputLocation)
{ {
error(symbol->getLine(), "must explicitly specify all locations when using multiple fragment outputs", name.c_str()); error(symbol->getLine(), "must explicitly specify all locations when using multiple fragment outputs", name.c_str());
} }
else if (isUnspecifiedOutputLocation) else if (location == -1)
{ {
++mUnspecifiedOutputLocationCount; mHasUnspecifiedOutputLocation = true;
} }
else else
{ {
......
...@@ -26,7 +26,7 @@ class ValidateOutputs : public TIntermTraverser ...@@ -26,7 +26,7 @@ class ValidateOutputs : public TIntermTraverser
TInfoSinkBase& mSink; TInfoSinkBase& mSink;
int mMaxDrawBuffers; int mMaxDrawBuffers;
int mNumErrors; int mNumErrors;
bool mUnspecifiedOutputLocationCount; bool mHasUnspecifiedOutputLocation;
typedef std::map<int, TIntermSymbol*> OutputMap; typedef std::map<int, TIntermSymbol*> OutputMap;
OutputMap mOutputMap; OutputMap mOutputMap;
......
...@@ -689,64 +689,6 @@ TEST_F(MalformedShaderTest, LayoutQualifierInFunctionReturnType) ...@@ -689,64 +689,6 @@ TEST_F(MalformedShaderTest, LayoutQualifierInFunctionReturnType)
} }
} }
// If there is more than one output, the location must be specified for all outputs.
// (ESSL 3.00.04 section 4.3.8.2)
TEST_F(MalformedShaderTest, TwoOutputsNoLayoutQualifiers)
{
const std::string &shaderString =
"#version 300 es\n"
"precision mediump float;\n"
"uniform vec4 u;\n"
"out vec4 my_FragColor;\n"
"out vec4 my_SecondaryFragColor;\n"
"void main() {\n"
" my_FragColor = vec4(1.0);\n"
" my_SecondaryFragColor = vec4(0.5);\n"
"}\n";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
}
}
// (ESSL 3.00.04 section 4.3.8.2)
TEST_F(MalformedShaderTest, TwoOutputsFirstLayoutQualifier)
{
const std::string &shaderString =
"#version 300 es\n"
"precision mediump float;\n"
"uniform vec4 u;\n"
"layout(location = 0) out vec4 my_FragColor;\n"
"out vec4 my_SecondaryFragColor;\n"
"void main() {\n"
" my_FragColor = vec4(1.0);\n"
" my_SecondaryFragColor = vec4(0.5);\n"
"}\n";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
}
}
// (ESSL 3.00.04 section 4.3.8.2)
TEST_F(MalformedShaderTest, TwoOutputsSecondLayoutQualifier)
{
const std::string &shaderString =
"#version 300 es\n"
"precision mediump float;\n"
"uniform vec4 u;\n"
"out vec4 my_FragColor;\n"
"layout(location = 0) out vec4 my_SecondaryFragColor;\n"
"void main() {\n"
" my_FragColor = vec4(1.0);\n"
" my_SecondaryFragColor = vec4(0.5);\n"
"}\n";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
}
}
// Uniforms can be arrays (ESSL 3.00 section 4.3.5) // Uniforms can be arrays (ESSL 3.00 section 4.3.5)
TEST_F(MalformedShaderTest, UniformArray) TEST_F(MalformedShaderTest, UniformArray)
{ {
......
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