Commit 7a0faa82 by Jamie Madill Committed by Commit Bot

Revert "Pass #pragma optimize setting down to compilation."

This reverts commit 499173de. Reason for revert: Causes unexpected HLSL compiler errors in some cases. See bug. Bug: angleproject:5094 Original change's description: > Pass #pragma optimize setting down to compilation. > > This will allow us to disable optimizations in the back-end. This can > be useful both for developers and for ANGLE to disable very slow > shader compilation on D3D11. > > Also apply this pragma to VerifyMaxVertexUniformVectorsWithSamplers. > Reduces compilation time by half in local testing. > > Bug: angleproject:5076 > Change-Id: I64ad576e11b9cee5b41f8af0d3621570304d65c2 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2420749 > Commit-Queue: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> TBR=geofflang@chromium.org,jonahr@google.com,jmadill@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: angleproject:5076 Change-Id: I733e788fe8e9421ae0af662c0eb51af1ed79dde3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2429517Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent f024f54b
...@@ -743,8 +743,6 @@ int GetGeometryShaderInvocations(const ShHandle handle); ...@@ -743,8 +743,6 @@ int GetGeometryShaderInvocations(const ShHandle handle);
int GetGeometryShaderMaxVertices(const ShHandle handle); int GetGeometryShaderMaxVertices(const ShHandle handle);
unsigned int GetShaderSharedMemorySize(const ShHandle handle); unsigned int GetShaderSharedMemorySize(const ShHandle handle);
bool GetPragmaOptimize(const ShHandle handle);
// //
// Helper function to identify specs that are based on the WebGL spec. // Helper function to identify specs that are based on the WebGL spec.
// //
......
...@@ -1506,11 +1506,6 @@ bool TCompiler::isVaryingDefined(const char *varyingName) ...@@ -1506,11 +1506,6 @@ bool TCompiler::isVaryingDefined(const char *varyingName)
return false; return false;
} }
bool TCompiler::getPragmaOptimize() const
{
return mPragma.optimize;
}
void EmitEarlyFragmentTestsGLSL(const TCompiler &compiler, TInfoSinkBase &sink) void EmitEarlyFragmentTestsGLSL(const TCompiler &compiler, TInfoSinkBase &sink)
{ {
if (compiler.isEarlyFragmentTestsSpecified() || compiler.isEarlyFragmentTestsOptimized()) if (compiler.isEarlyFragmentTestsSpecified() || compiler.isEarlyFragmentTestsOptimized())
......
...@@ -144,14 +144,13 @@ class TCompiler : public TShHandleBase ...@@ -144,14 +144,13 @@ class TCompiler : public TShHandleBase
return mGeometryShaderOutputPrimitiveType; return mGeometryShaderOutputPrimitiveType;
} }
unsigned int getStructSize(const ShaderVariable &var) const;
unsigned int getSharedMemorySize() const; unsigned int getSharedMemorySize() const;
sh::GLenum getShaderType() const { return mShaderType; } sh::GLenum getShaderType() const { return mShaderType; }
bool validateAST(TIntermNode *root); bool validateAST(TIntermNode *root);
bool getPragmaOptimize() const;
protected: protected:
// Add emulated functions to the built-in function emulator. // Add emulated functions to the built-in function emulator.
virtual void initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, virtual void initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu,
......
...@@ -716,17 +716,6 @@ unsigned int GetShaderSharedMemorySize(const ShHandle handle) ...@@ -716,17 +716,6 @@ unsigned int GetShaderSharedMemorySize(const ShHandle handle)
return sharedMemorySize; return sharedMemorySize;
} }
bool GetPragmaOptimize(const ShHandle handle)
{
ASSERT(handle);
TShHandleBase *base = static_cast<TShHandleBase *>(handle);
TCompiler *compiler = base->getAsCompiler();
ASSERT(compiler);
return compiler->getPragmaOptimize();
}
// Can't prefix with just _ because then we might introduce a double underscore, which is not safe // Can't prefix with just _ because then we might introduce a double underscore, which is not safe
// in GLSL (ESSL 3.00.6 section 3.8: All identifiers containing a double underscore are reserved for // in GLSL (ESSL 3.00.6 section 3.8: All identifiers containing a double underscore are reserved for
// use by the underlying implementation). u is short for user-defined. // use by the underlying implementation). u is short for user-defined.
......
...@@ -1684,8 +1684,6 @@ void Program::updateLinkedShaderStages() ...@@ -1684,8 +1684,6 @@ void Program::updateLinkedShaderStages()
if (shader) if (shader)
{ {
mState.mExecutable->setLinkedShaderStages(shader->getType()); mState.mExecutable->setLinkedShaderStages(shader->getType());
mState.mExecutable->mShaderOptimizationEnabled[shader->getType()] =
shader->getState().isOptimizationEnabled();
} }
} }
......
...@@ -147,8 +147,6 @@ void ProgramExecutable::load(gl::BinaryInputStream *stream) ...@@ -147,8 +147,6 @@ void ProgramExecutable::load(gl::BinaryInputStream *stream)
mLinkedComputeShaderStages = ShaderBitSet(stream->readInt<uint8_t>()); mLinkedComputeShaderStages = ShaderBitSet(stream->readInt<uint8_t>());
mIsCompute = stream->readBool(); mIsCompute = stream->readBool();
mShaderOptimizationEnabled = ShaderBitSet(stream->readInt<uint8_t>());
mPipelineHasGraphicsUniformBuffers = stream->readBool(); mPipelineHasGraphicsUniformBuffers = stream->readBool();
mPipelineHasComputeUniformBuffers = stream->readBool(); mPipelineHasComputeUniformBuffers = stream->readBool();
mPipelineHasGraphicsStorageBuffers = stream->readBool(); mPipelineHasGraphicsStorageBuffers = stream->readBool();
...@@ -174,8 +172,6 @@ void ProgramExecutable::save(gl::BinaryOutputStream *stream) const ...@@ -174,8 +172,6 @@ void ProgramExecutable::save(gl::BinaryOutputStream *stream) const
stream->writeInt(mLinkedComputeShaderStages.bits()); stream->writeInt(mLinkedComputeShaderStages.bits());
stream->writeInt(static_cast<bool>(mIsCompute)); stream->writeInt(static_cast<bool>(mIsCompute));
stream->writeInt(mShaderOptimizationEnabled.bits());
stream->writeInt(static_cast<bool>(mPipelineHasGraphicsUniformBuffers)); stream->writeInt(static_cast<bool>(mPipelineHasGraphicsUniformBuffers));
stream->writeInt(static_cast<bool>(mPipelineHasComputeUniformBuffers)); stream->writeInt(static_cast<bool>(mPipelineHasComputeUniformBuffers));
stream->writeInt(static_cast<bool>(mPipelineHasGraphicsStorageBuffers)); stream->writeInt(static_cast<bool>(mPipelineHasGraphicsStorageBuffers));
......
...@@ -302,11 +302,6 @@ class ProgramExecutable final : public angle::Subject ...@@ -302,11 +302,6 @@ class ProgramExecutable final : public angle::Subject
} }
int getLinkedShaderVersion(ShaderType shaderType) { return mLinkedShaderVersions[shaderType]; } int getLinkedShaderVersion(ShaderType shaderType) { return mLinkedShaderVersions[shaderType]; }
bool isShaderOptimizationEnabled(ShaderType shaderType) const
{
return mShaderOptimizationEnabled[shaderType];
}
private: private:
// TODO(timvp): http://anglebug.com/3570: Investigate removing these friend // TODO(timvp): http://anglebug.com/3570: Investigate removing these friend
// class declarations and accessing the necessary members with getters/setters. // class declarations and accessing the necessary members with getters/setters.
...@@ -398,8 +393,6 @@ class ProgramExecutable final : public angle::Subject ...@@ -398,8 +393,6 @@ class ProgramExecutable final : public angle::Subject
bool mIsCompute; bool mIsCompute;
ShaderBitSet mShaderOptimizationEnabled;
ShaderMap<std::vector<sh::ShaderVariable>> mLinkedOutputVaryings; ShaderMap<std::vector<sh::ShaderVariable>> mLinkedOutputVaryings;
ShaderMap<std::vector<sh::ShaderVariable>> mLinkedInputVaryings; ShaderMap<std::vector<sh::ShaderVariable>> mLinkedInputVaryings;
ShaderMap<int> mLinkedShaderVersions; ShaderMap<int> mLinkedShaderVersions;
......
...@@ -416,17 +416,6 @@ void ProgramPipeline::updateExecutable() ...@@ -416,17 +416,6 @@ void ProgramPipeline::updateExecutable()
// Must be last, since it queries things updated by earlier functions // Must be last, since it queries things updated by earlier functions
updateHasBooleans(); updateHasBooleans();
for (const gl::ShaderType shaderType : kAllGraphicsShaderTypes)
{
const Program *shaderProgram = getShaderProgram(shaderType);
if (shaderProgram)
{
const ProgramExecutable &executable = shaderProgram->getExecutable();
mState.mExecutable->mShaderOptimizationEnabled[shaderType] =
executable.isShaderOptimizationEnabled(shaderType);
}
}
} }
ProgramMergedVaryings ProgramPipeline::getMergedVaryings() const ProgramMergedVaryings ProgramPipeline::getMergedVaryings() const
......
...@@ -118,8 +118,6 @@ ShaderState::ShaderState(ShaderType shaderType) ...@@ -118,8 +118,6 @@ ShaderState::ShaderState(ShaderType shaderType)
: mLabel(), : mLabel(),
mShaderType(shaderType), mShaderType(shaderType),
mShaderVersion(100), mShaderVersion(100),
mEarlyFragmentTestsOptimization(false),
mOptimizationEnabled(true),
mNumViews(-1), mNumViews(-1),
mGeometryShaderInvocations(1), mGeometryShaderInvocations(1),
mCompileStatus(CompileStatus::NOT_COMPILED) mCompileStatus(CompileStatus::NOT_COMPILED)
...@@ -429,8 +427,7 @@ void Shader::resolveCompile() ...@@ -429,8 +427,7 @@ void Shader::resolveCompile()
#endif // !defined(NDEBUG) #endif // !defined(NDEBUG)
// Gather the shader information // Gather the shader information
mState.mShaderVersion = sh::GetShaderVersion(compilerHandle); mState.mShaderVersion = sh::GetShaderVersion(compilerHandle);
mState.mOptimizationEnabled = sh::GetPragmaOptimize(compilerHandle);
mState.mUniforms = GetShaderVariables(sh::GetUniforms(compilerHandle)); mState.mUniforms = GetShaderVariables(sh::GetUniforms(compilerHandle));
mState.mUniformBlocks = GetShaderVariables(sh::GetUniformBlocks(compilerHandle)); mState.mUniformBlocks = GetShaderVariables(sh::GetUniformBlocks(compilerHandle));
......
...@@ -109,8 +109,6 @@ class ShaderState final : angle::NonCopyable ...@@ -109,8 +109,6 @@ class ShaderState final : angle::NonCopyable
CompileStatus getCompileStatus() const { return mCompileStatus; } CompileStatus getCompileStatus() const { return mCompileStatus; }
bool isOptimizationEnabled() const { return mOptimizationEnabled; }
private: private:
friend class Shader; friend class Shader;
...@@ -133,7 +131,6 @@ class ShaderState final : angle::NonCopyable ...@@ -133,7 +131,6 @@ class ShaderState final : angle::NonCopyable
std::vector<sh::ShaderVariable> mActiveOutputVariables; std::vector<sh::ShaderVariable> mActiveOutputVariables;
bool mEarlyFragmentTestsOptimization; bool mEarlyFragmentTestsOptimization;
bool mOptimizationEnabled;
// ANGLE_multiview. // ANGLE_multiview.
int mNumViews; int mNumViews;
......
...@@ -184,10 +184,6 @@ void ShaderD3D::generateWorkarounds(angle::CompilerWorkaroundsD3D *workarounds) ...@@ -184,10 +184,6 @@ void ShaderD3D::generateWorkarounds(angle::CompilerWorkaroundsD3D *workarounds)
// disabling optimization // disabling optimization
workarounds->skipOptimization = true; workarounds->skipOptimization = true;
} }
else if (!mState.isOptimizationEnabled())
{
workarounds->skipOptimization = true;
}
else if (mUsesNestedBreak) else if (mUsesNestedBreak)
{ {
// ANGLE issue 603: // ANGLE issue 603:
......
...@@ -2994,8 +2994,7 @@ angle::Result Renderer11::compileToExecutable(d3d::Context *context, ...@@ -2994,8 +2994,7 @@ angle::Result Renderer11::compileToExecutable(d3d::Context *context,
<< getShaderModelSuffix(); << getShaderModelSuffix();
std::string profile = profileStream.str(); std::string profile = profileStream.str();
UINT flags = workarounds.skipOptimization ? D3DCOMPILE_SKIP_OPTIMIZATION UINT flags = D3DCOMPILE_OPTIMIZATION_LEVEL2;
: D3DCOMPILE_OPTIMIZATION_LEVEL2;
#if defined(ANGLE_ENABLE_DEBUG_TRACE) #if defined(ANGLE_ENABLE_DEBUG_TRACE)
# ifndef NDEBUG # ifndef NDEBUG
......
...@@ -368,8 +368,7 @@ class GLSLTest : public ANGLETest ...@@ -368,8 +368,7 @@ class GLSLTest : public ANGLETest
std::stringstream fragmentShader; std::stringstream fragmentShader;
// Generate the vertex shader // Generate the vertex shader
vertexShader << "#pragma optimize(off)\n" vertexShader << "precision mediump float;\n";
<< "precision mediump float;\n";
for (int i = 0; i < vertexUniformCount; i++) for (int i = 0; i < vertexUniformCount; i++)
{ {
......
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