context/llpcCompiler.cpp
Result Compiler::ValidatePipelineShaderInfo(
    ShaderStage               shaderStage,    // Shader stage
    const PipelineShaderInfo* pShaderInfo     // [in] Pipeline shader info
    ) const
{
    Result result = Result::Success;
    const ShaderModuleData* pModuleData = reinterpret_cast<const ShaderModuleData*>(pShaderInfo->pModuleData);
    if (pModuleData != nullptr)
    {
        if (pModuleData->binType == BinaryType::Spirv)
        {
            auto pSpirvBin = &pModuleData->binCode;
            if (pShaderInfo->pEntryTarget != nullptr)
            {
                uint32_t stageMask = GetStageMaskFromSpirvBinary(pSpirvBin, pShaderInfo->pEntryTarget);

                if ((stageMask & ShaderStageToMask(shaderStage)) == 0)
                {
                    LLPC_ERRS("Fail to find entry-point " << pShaderInfo->pEntryTarget << " for " <<
                              GetShaderStageName(shaderStage) << " shader\n");
                    result = Result::ErrorInvalidShader;
                }
            }
            else
            {
                LLPC_ERRS("Missing entry-point name for " << GetShaderStageName(shaderStage) << " shader\n");
                result = Result::ErrorInvalidShader;
            }
        }
        else if ((pModuleData->binType == BinaryType::LlvmBc) || (pModuleData->binType == BinaryType::MultiLlvmBc))
        {
            // Do nothing if input is LLVM IR
        }
        else
        {
            LLPC_ERRS("Invalid shader binary type for " << GetShaderStageName(shaderStage) << " shader\n");
            result = Result::ErrorInvalidShader;
        }
    }

    return result;
}
// =====================================================================================================================
// Checks whether fields in pipeline shader info are valid.
Checks whether fields in pipeline shader info are valid.
Checks whether fields in pipeline shader info are valid .
Result Compiler::ValidatePipelineShaderInfo(
    ShaderStage               shaderStage,    
    const PipelineShaderInfo* pShaderInfo     
    ) const
{
    Result result = Result::Success;
    const ShaderModuleData* pModuleData = reinterpret_cast<const ShaderModuleData*>(pShaderInfo->pModuleData);
    if (pModuleData != nullptr)
    {
        if (pModuleData->binType == BinaryType::Spirv)
        {
            auto pSpirvBin = &pModuleData->binCode;
            if (pShaderInfo->pEntryTarget != nullptr)
            {
                uint32_t stageMask = GetStageMaskFromSpirvBinary(pSpirvBin, pShaderInfo->pEntryTarget);
                if ((stageMask & ShaderStageToMask(shaderStage)) == 0)
                {
                    LLPC_ERRS("Fail to find entry-point " << pShaderInfo->pEntryTarget << " for " <<
                              GetShaderStageName(shaderStage) << " shader\n");
                    result = Result::ErrorInvalidShader;
                }
            }
            else
            {
                LLPC_ERRS("Missing entry-point name for " << GetShaderStageName(shaderStage) << " shader\n");
                result = Result::ErrorInvalidShader;
            }
        }
        else if ((pModuleData->binType == BinaryType::LlvmBc) || (pModuleData->binType == BinaryType::MultiLlvmBc))
        {
        }
        else
        {
            LLPC_ERRS("Invalid shader binary type for " << GetShaderStageName(shaderStage) << " shader\n");
            result = Result::ErrorInvalidShader;
        }
    }
    return result;
}
Result Compiler :: ValidatePipelineShaderInfo ( ShaderStage shaderStage , const PipelineShaderInfo * pShaderInfo ) const { Result result = Result :: Success ; const ShaderModuleData * pModuleData = reinterpret_cast < const ShaderModuleData * > ( pShaderInfo -> pModuleData ) ; if ( pModuleData != nullptr ) { if ( pModuleData -> binType == BinaryType :: Spirv ) { auto pSpirvBin = & pModuleData -> binCode ; if ( pShaderInfo -> pEntryTarget != nullptr ) { uint32_t stageMask = GetStageMaskFromSpirvBinary ( pSpirvBin , pShaderInfo -> pEntryTarget ) ; if ( ( stageMask & ShaderStageToMask ( shaderStage ) ) == 0 ) { LLPC_ERRS ( " " << pShaderInfo -> pEntryTarget << " " << GetShaderStageName ( shaderStage ) << " \n " ) ; result = Result :: ErrorInvalidShader ; } } else { LLPC_ERRS ( " " << GetShaderStageName ( shaderStage ) << " \n " ) ; result = Result :: ErrorInvalidShader ; } } else if ( ( pModuleData -> binType == BinaryType :: LlvmBc ) || ( pModuleData -> binType == BinaryType :: MultiLlvmBc ) ) { } else { LLPC_ERRS ( " " << GetShaderStageName ( shaderStage ) << " \n " ) ; result = Result :: ErrorInvalidShader ; } } return result ; }
Checks whether fields in pipeline shader info are valid.
Checks whether fields in pipeline shader info are valid .
// Shader stage // [in] Pipeline shader info // Do nothing if input is LLVM IR