Commit c5fa0ad5 by Yuly Novikov

Revert "Remove invariant qualifier for input in fragment shader"

This reverts commit d842a6b2. Because of WebglConformance_conformance_glsl_bugs_invariant_does_not_leak_across_shaders failure BUG=chromium:659326 Change-Id: I0602e24f3d34ccf852cda865f673c5c7634f82a6 Reviewed-on: https://chromium-review.googlesource.com/403230Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
parent af7f301f
......@@ -92,8 +92,6 @@
'compiler/translator/RecordConstantPrecision.h',
'compiler/translator/RegenerateStructNames.cpp',
'compiler/translator/RegenerateStructNames.h',
'compiler/translator/RemoveInvariantDeclaration.cpp',
'compiler/translator/RemoveInvariantDeclaration.h',
'compiler/translator/RemovePow.cpp',
'compiler/translator/RemovePow.h',
'compiler/translator/RewriteDoWhile.cpp',
......
......@@ -23,7 +23,6 @@
#include "compiler/translator/ParseContext.h"
#include "compiler/translator/PruneEmptyDeclarations.h"
#include "compiler/translator/RegenerateStructNames.h"
#include "compiler/translator/RemoveInvariantDeclaration.h"
#include "compiler/translator/RemovePow.h"
#include "compiler/translator/RewriteDoWhile.h"
#include "compiler/translator/ScalarizeVecAndMatConstructorArgs.h"
......@@ -92,14 +91,6 @@ bool IsGLSL130OrNewer(ShShaderOutput output)
output == SH_GLSL_450_CORE_OUTPUT);
}
bool IsGLSL420OrNewer(ShShaderOutput output)
{
return (output == SH_GLSL_420_CORE_OUTPUT ||
output == SH_GLSL_430_CORE_OUTPUT ||
output == SH_GLSL_440_CORE_OUTPUT ||
output == SH_GLSL_450_CORE_OUTPUT);
}
size_t GetGlobalMaxTokenSize(ShShaderSpec spec)
{
// WebGL defines a max token legnth of 256, while ES2 leaves max token
......@@ -391,9 +382,6 @@ TIntermBlock *TCompiler::compileTreeImpl(const char *const shaderStrings[],
(outputType == SH_GLSL_COMPATIBILITY_OUTPUT)))
initializeGLPosition(root);
if (success && shaderType == GL_FRAGMENT_SHADER && IsGLSL420OrNewer(outputType))
sh::RemoveInvariantDeclaration(root);
// This pass might emit short circuits so keep it before the short circuit unfolding
if (success && (compileOptions & SH_REWRITE_DO_WHILE_LOOPS))
RewriteDoWhile(root, getTemporaryIndex());
......
......@@ -38,7 +38,6 @@ bool IsWebGLBasedSpec(ShShaderSpec spec);
// Helper function to check if the shader type is GLSL.
//
bool IsGLSL130OrNewer(ShShaderOutput output);
bool IsGLSL420OrNewer(ShShaderOutput output);
//
// The base class used to back handles returned to the driver.
......
......@@ -146,9 +146,8 @@ void TOutputGLSLBase::writeLayoutQualifier(const TType &type)
void TOutputGLSLBase::writeVariableType(const TType &type)
{
TQualifier qualifier = type.getQualifier();
TInfoSinkBase &out = objSink();
if (type.isInvariant() && qualifier != EvqFragmentIn && !IsGLSL420OrNewer(mOutput))
if (type.isInvariant())
{
out << "invariant ";
}
......@@ -157,6 +156,7 @@ void TOutputGLSLBase::writeVariableType(const TType &type)
TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
declareInterfaceBlockLayout(interfaceBlock);
}
TQualifier qualifier = type.getQualifier();
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
{
if (IsGLSL130OrNewer(mOutput))
......
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "compiler/translator/RemoveInvariantDeclaration.h"
#include "compiler/translator/IntermNode.h"
namespace sh
{
namespace
{
// An AST traverser that removes invariant declaration for input in fragment shader
// when GLSL > 4.20.
class RemoveInvariantDeclarationTraverser : public TIntermTraverser
{
public:
RemoveInvariantDeclarationTraverser() : TIntermTraverser(true, false, false) {}
private:
bool visitAggregate(Visit visit, TIntermAggregate *node) override
{
if (node->getOp() == EOpInvariantDeclaration)
{
TIntermSequence emptyReplacement;
mMultiReplacements.push_back(
NodeReplaceWithMultipleEntry(getParentNode()->getAsBlock(), node, emptyReplacement));
return false;
}
return true;
}
};
} // anonymous namespace
void RemoveInvariantDeclaration(TIntermNode *root)
{
RemoveInvariantDeclarationTraverser traverser;
root->traverse(&traverser);
traverser.updateTree();
}
} // namespace sh
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef COMPILER_TRANSLATOR_REMOVEINVARIANTDECLARATION_H_
#define COMPILER_TRANSLATOR_REMOVEINVARIANTDECLARATION_H_
class TIntermNode;
namespace sh
{
void RemoveInvariantDeclaration(TIntermNode *root);
} // namespace sh
#endif // COMPILER_TRANSLATOR_REMOVEINVARIANTDECLARATION_H_
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