//uncompile FILE* outfile, outfile, void uncompile(FILE* outfile, Node *n){ int i; switch(n->type){ case nodo_coringa: case nodo_tipounico: case nodo_tipolista: case nodo_idf: case nodo_int: case nodo_float: case nodo_if: case nodo_while: case nodo_end: case nodo_else: case nodo_true: case nodo_false: fprintf(outfile,"%s ",n->lexeme); } for (i = 0; i < nb_of_children(n); i++) uncompile(outfile, child(n, i)); }
ShaderD3D::ShaderD3D(const gl::ShaderState &data, const angle::WorkaroundsD3D &workarounds, const gl::Extensions &extensions) : ShaderImpl(data), mAdditionalOptions(0) { uncompile(); if (workarounds.expandIntegerPowExpressions) { mAdditionalOptions |= SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS; } if (workarounds.getDimensionsIgnoresBaseLevel) { mAdditionalOptions |= SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL; } if (workarounds.preAddTexelFetchOffsets) { mAdditionalOptions |= SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH; } if (workarounds.rewriteUnaryMinusOperator) { mAdditionalOptions |= SH_REWRITE_INTEGER_UNARY_MINUS_OPERATOR; } if (workarounds.emulateIsnanFloat) { mAdditionalOptions |= SH_EMULATE_ISNAN_FLOAT_FUNCTION; } if (extensions.multiview) { mAdditionalOptions |= SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW; } }
void FragmentShader::compile() { uncompile(); compileToHLSL(mFragmentCompiler); parseVaryings(); mVaryings.sort(compareVarying); }
void VertexShader::compile() { uncompile(); compileToHLSL(mVertexCompiler); parseAttributes(); parseVaryings(); }
ShaderD3D::ShaderD3D(GLenum type, RendererD3D *renderer) : mType(type), mRenderer(renderer), mShaderVersion(100) { uncompile(); initializeCompiler(); }
Shader::Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle) : mHandle(handle), mRenderer(renderer), mResourceManager(manager) { uncompile(); initializeCompiler(); mRefCount = 0; mDeleteStatus = false; mShaderVersion = 100; }
Shader::Shader(ResourceManager *manager, GLuint handle) : mHandle(handle), mResourceManager(manager) { mSource = NULL; mHlsl = NULL; mInfoLog = NULL; uncompile(); initializeCompiler(); mRefCount = 0; mDeleteStatus = false; }
Shader::Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle) : mHandle(handle), mRenderer(renderer), mResourceManager(manager) { mSource = NULL; mHlsl = NULL; mInfoLog = NULL; m_binary = nullptr; m_size = 0; uncompile(); initializeCompiler(); mRefCount = 0; mDeleteStatus = false; }
void FragmentShader::compile() { uncompile(); compileToHLSL(mFragmentCompiler); parseVaryings(mFragmentCompiler); std::sort(mVaryings.begin(), mVaryings.end(), compareVarying); const std::string &hlsl = getHLSL(); if (!hlsl.empty()) { void *activeOutputVariables; ShGetInfoPointer(mFragmentCompiler, SH_ACTIVE_OUTPUT_VARIABLES_ARRAY, &activeOutputVariables); mActiveOutputVariables = *(std::vector<Attribute>*)activeOutputVariables; } }
ShaderD3D::ShaderD3D(const gl::ShaderState &data, const WorkaroundsD3D &workarounds) : ShaderImpl(data), mAdditionalOptions(0) { uncompile(); if (workarounds.expandIntegerPowExpressions) { mAdditionalOptions |= SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS; } if (workarounds.getDimensionsIgnoresBaseLevel) { mAdditionalOptions |= SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL; } if (workarounds.preAddTexelFetchOffsets) { mAdditionalOptions |= SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH; } }
bool ShaderD3D::compile(gl::Compiler *compiler, const std::string &source) { uncompile(); CompilerD3D *compilerD3D = GetImplAs<CompilerD3D>(compiler); ShHandle compilerHandle = compilerD3D->getCompilerHandle(mShaderType); mCompilerOutputType = ShGetShaderOutputType(compilerHandle); compileToHLSL(compilerHandle, source); if (mShaderType == GL_VERTEX_SHADER) { parseAttributes(compilerHandle); } parseVaryings(compilerHandle); if (mShaderType == GL_FRAGMENT_SHADER) { std::sort(mVaryings.begin(), mVaryings.end(), CompareVarying); const std::string &hlsl = getTranslatedSource(); if (!hlsl.empty()) { mActiveOutputVariables = *GetShaderVariables(ShGetOutputVariables(compilerHandle)); FilterInactiveVariables(&mActiveOutputVariables); } } #if ANGLE_SHADER_DEBUG_INFO == ANGLE_ENABLED mDebugInfo += std::string("// ") + GetShaderTypeString(mShaderType) + " SHADER BEGIN\n"; mDebugInfo += "\n// GLSL BEGIN\n\n" + source + "\n\n// GLSL END\n\n\n"; mDebugInfo += "// INITIAL HLSL BEGIN\n\n" + getTranslatedSource() + "\n// INITIAL HLSL END\n\n\n"; // Successive steps will append more info #else mDebugInfo += getTranslatedSource(); #endif return !getTranslatedSource().empty(); }
int ShaderD3D::prepareSourceAndReturnOptions(std::stringstream *shaderSourceStream) { uncompile(); int additionalOptions = 0; const std::string &source = mData.getSource(); #if !defined(ANGLE_ENABLE_WINDOWS_STORE) if (gl::DebugAnnotationsActive()) { std::string sourcePath = getTempPath(); writeFile(sourcePath.c_str(), source.c_str(), source.length()); additionalOptions |= SH_LINE_DIRECTIVES | SH_SOURCE_PATH; *shaderSourceStream << sourcePath; } #endif *shaderSourceStream << source; return additionalOptions; }
ShaderD3D::ShaderD3D(GLenum type, RendererD3D *renderer) : mShaderType(type), mRenderer(renderer) { uncompile(); }
ShaderD3D::ShaderD3D(const gl::Shader::Data &data) : ShaderImpl(data) { uncompile(); }
ShaderD3D::ShaderD3D(GLenum type) : mShaderType(type), mShaderVersion(100) { uncompile(); }