void TranslatorGLSL::initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, int compileOptions) { if (compileOptions & SH_EMULATE_BUILT_IN_FUNCTIONS) { InitBuiltInFunctionEmulatorForGLSLWorkarounds(emu, getShaderType()); } int targetGLSLVersion = ShaderOutputTypeToGLSLVersion(getOutputType()); InitBuiltInFunctionEmulatorForGLSLMissingFunctions(emu, getShaderType(), targetGLSLVersion); }
// We need to scan for the following: // 1. "invariant" keyword: This can occur in both - vertex and fragment shaders // but only at the global scope. // 2. "gl_PointCoord" built-in variable: This can only occur in fragment shader // but inside any scope. // 3. Call to a matrix constructor with another matrix as argument. // (These constructors were reserved in GLSL version 1.10.) // 4. Arrays as "out" function parameters. // GLSL spec section 6.1.1: "When calling a function, expressions that do // not evaluate to l-values cannot be passed to parameters declared as // out or inout." // GLSL 1.1 section 5.8: "Other binary or unary expressions, // non-dereferenced arrays, function names, swizzles with repeated fields, // and constants cannot be l-values." // GLSL 1.2 relaxed the restriction on arrays, section 5.8: "Variables that // are built-in types, entire structures or arrays... are all l-values." // TVersionGLSL::TVersionGLSL(sh::GLenum type, const TPragma &pragma, ShShaderOutput output) : TIntermTraverser(true, false, false) { mVersion = ShaderOutputTypeToGLSLVersion(output); if (pragma.stdgl.invariantAll) { ensureVersionIsAtLeast(GLSL_VERSION_120); } }
void TranslatorGLSL::initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, ShCompileOptions compileOptions) { if (compileOptions & SH_EMULATE_ABS_INT_FUNCTION) { InitBuiltInAbsFunctionEmulatorForGLSLWorkarounds(emu, getShaderType()); } if (compileOptions & SH_EMULATE_ISNAN_FLOAT_FUNCTION) { InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(emu, getShaderVersion()); } int targetGLSLVersion = ShaderOutputTypeToGLSLVersion(getOutputType()); InitBuiltInFunctionEmulatorForGLSLMissingFunctions(emu, getShaderType(), targetGLSLVersion); }
TExtensionGLSL::TExtensionGLSL(ShShaderOutput output) : TIntermTraverser(true, false, false), mTargetVersion(ShaderOutputTypeToGLSLVersion(output)) { }
void TranslatorGLSL::initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, int compileOptions) { int targetGLSLVersion = ShaderOutputTypeToGLSLVersion(getOutputType()); InitBuiltInFunctionEmulatorForGLSLMissingFunctions(emu, getShaderType(), targetGLSLVersion); }