Exemple #1
0
void ShaderD3D::parseAttributes(ShHandle compiler)
{
    const std::string &hlsl = getTranslatedSource();
    if (!hlsl.empty())
    {
        mActiveAttributes = *GetShaderVariables(ShGetAttributes(compiler));
        FilterInactiveVariables(&mActiveAttributes);
    }
}
Exemple #2
0
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();
}
Exemple #3
0
void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer)
{
    GetSourceImpl(getTranslatedSource(), bufSize, length, buffer);
}