diff options
Diffstat (limited to 'gfx/angle/src/compiler/translator/TranslatorGLSL.cpp')
-rwxr-xr-x | gfx/angle/src/compiler/translator/TranslatorGLSL.cpp | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/gfx/angle/src/compiler/translator/TranslatorGLSL.cpp b/gfx/angle/src/compiler/translator/TranslatorGLSL.cpp index 1d6582b02..0ee96f590 100755 --- a/gfx/angle/src/compiler/translator/TranslatorGLSL.cpp +++ b/gfx/angle/src/compiler/translator/TranslatorGLSL.cpp @@ -11,36 +11,26 @@ #include "compiler/translator/EmulatePrecision.h" #include "compiler/translator/ExtensionGLSL.h" #include "compiler/translator/OutputGLSL.h" -#include "compiler/translator/RewriteTexelFetchOffset.h" #include "compiler/translator/VersionGLSL.h" -namespace sh -{ - TranslatorGLSL::TranslatorGLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output) : TCompiler(type, spec, output) { } -void TranslatorGLSL::initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, - ShCompileOptions compileOptions) +void TranslatorGLSL::initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, int compileOptions) { - if (compileOptions & SH_EMULATE_ABS_INT_FUNCTION) - { - InitBuiltInAbsFunctionEmulatorForGLSLWorkarounds(emu, getShaderType()); - } - - if (compileOptions & SH_EMULATE_ISNAN_FLOAT_FUNCTION) + if (compileOptions & SH_EMULATE_BUILT_IN_FUNCTIONS) { - InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(emu, getShaderVersion()); + InitBuiltInFunctionEmulatorForGLSLWorkarounds(emu, getShaderType()); } int targetGLSLVersion = ShaderOutputTypeToGLSLVersion(getOutputType()); InitBuiltInFunctionEmulatorForGLSLMissingFunctions(emu, getShaderType(), targetGLSLVersion); } -void TranslatorGLSL::translate(TIntermNode *root, ShCompileOptions compileOptions) +void TranslatorGLSL::translate(TIntermNode *root, int compileOptions) { TInfoSinkBase& sink = getInfoSink().obj; @@ -60,7 +50,7 @@ void TranslatorGLSL::translate(TIntermNode *root, ShCompileOptions compileOption // variables that are actually used, to avoid affecting the behavior of the shader. if ((compileOptions & SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL) && getPragma().stdgl.invariantAll) { - ASSERT(wereVariablesCollected()); + collectVariables(root); switch (getShaderType()) { @@ -85,11 +75,6 @@ void TranslatorGLSL::translate(TIntermNode *root, ShCompileOptions compileOption } } - if ((compileOptions & SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH) != 0) - { - sh::RewriteTexelFetchOffset(root, getSymbolTable(), getShaderVersion()); - } - bool precisionEmulation = getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision; if (precisionEmulation) @@ -188,9 +173,13 @@ void TranslatorGLSL::translate(TIntermNode *root, ShCompileOptions compileOption } // Write translated shader. - TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), - getSymbolTable(), getShaderType(), getShaderVersion(), getOutputType(), - compileOptions); + TOutputGLSL outputGLSL(sink, + getArrayIndexClampingStrategy(), + getHashFunction(), + getNameMap(), + getSymbolTable(), + getShaderVersion(), + getOutputType()); root->traverse(&outputGLSL); } @@ -201,12 +190,6 @@ bool TranslatorGLSL::shouldFlattenPragmaStdglInvariantAll() return IsGLSL130OrNewer(getOutputType()); } -bool TranslatorGLSL::shouldCollectVariables(ShCompileOptions compileOptions) -{ - return (compileOptions & SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL) || - TCompiler::shouldCollectVariables(compileOptions); -} - void TranslatorGLSL::writeVersion(TIntermNode *root) { TVersionGLSL versionGLSL(getShaderType(), getPragma(), getOutputType()); @@ -294,5 +277,3 @@ void TranslatorGLSL::conditionallyOutputInvariantDeclaration(const char *builtin sink << "invariant " << builtinVaryingName << ";\n"; } } - -} // namespace sh |