当前位置: 首页>>代码示例>>C++>>正文


C++ GrGLCaps::advancedBlendEquationSupport方法代码示例

本文整理汇总了C++中GrGLCaps::advancedBlendEquationSupport方法的典型用法代码示例。如果您正苦于以下问题:C++ GrGLCaps::advancedBlendEquationSupport方法的具体用法?C++ GrGLCaps::advancedBlendEquationSupport怎么用?C++ GrGLCaps::advancedBlendEquationSupport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GrGLCaps的用法示例。


在下文中一共展示了GrGLCaps::advancedBlendEquationSupport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

bool GrGLSLCaps::init(const GrGLContextInfo& ctxInfo,
                      const GrGLInterface* gli,
                      const GrGLCaps& glCaps) {
    this->reset();
    if (!ctxInfo.isInitialized()) {
        return false;
    }

    GrGLStandard standard = ctxInfo.standard();
    GrGLVersion version = ctxInfo.version();

    /**************************************************************************
    * Caps specific to GrGLSLCaps
    **************************************************************************/

    if (kGLES_GrGLStandard == standard) {
        if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) {
            fFBFetchNeedsCustomOutput = (version >= GR_GL_VER(3, 0));
            fFBFetchSupport = true;
            fFBFetchColorName = "gl_LastFragData[0]";
            fFBFetchExtensionString = "GL_EXT_shader_framebuffer_fetch";
        }
        else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) {
            // Actually, we haven't seen an ES3.0 device with this extension yet, so we don't know
            fFBFetchNeedsCustomOutput = false;
            fFBFetchSupport = true;
            fFBFetchColorName = "gl_LastFragData[0]";
            fFBFetchExtensionString = "GL_NV_shader_framebuffer_fetch";
        }
        else if (ctxInfo.hasExtension("GL_ARM_shader_framebuffer_fetch")) {
            // The arm extension also requires an additional flag which we will set onResetContext
            fFBFetchNeedsCustomOutput = false;
            fFBFetchSupport = true;
            fFBFetchColorName = "gl_LastFragColorARM";
            fFBFetchExtensionString = "GL_ARM_shader_framebuffer_fetch";
        }
    }

    // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero in a shader
    fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor();

    /**************************************************************************
    * GrShaderCaps fields
    **************************************************************************/

    fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering");

    if (fPathRenderingSupport) {
        if (kGL_GrGLStandard == standard) {
            // We only support v1.3+ of GL_NV_path_rendering which allows us to
            // set individual fragment inputs with ProgramPathFragmentInputGen. The API
            // additions are detected by checking the existence of the function.
            fPathRenderingSupport = ctxInfo.hasExtension("GL_EXT_direct_state_access") &&
                                    ((ctxInfo.version() >= GR_GL_VER(4, 3) ||
                                      ctxInfo.hasExtension("GL_ARB_program_interface_query")) &&
                                     gli->fFunctions.fProgramPathFragmentInputGen);
        }
        else {
            fPathRenderingSupport = ctxInfo.version() >= GR_GL_VER(3, 1);
        }
    }

    // For now these two are equivalent but we could have dst read in shader via some other method
    fDstReadInShaderSupport = fFBFetchSupport;

    // Enable supported shader-related caps
    if (kGL_GrGLStandard == standard) {
        fDualSourceBlendingSupport = ctxInfo.version() >= GR_GL_VER(3, 3) ||
                                     ctxInfo.hasExtension("GL_ARB_blend_func_extended");
        fShaderDerivativeSupport = true;
        // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS
        fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) &&
                                 ctxInfo.glslGeneration() >= k150_GrGLSLGeneration;
    }
    else {
        fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) ||
                                   ctxInfo.hasExtension("GL_OES_standard_derivatives");
    }

    if (glCaps.advancedBlendEquationSupport()) {
        bool coherent = glCaps.advancedCoherentBlendEquationSupport();
        if (ctxInfo.hasExtension(coherent ? "GL_NV_blend_equation_advanced_coherent"
                                 : "GL_NV_blend_equation_advanced")) {
            fAdvBlendEqInteraction = kAutomatic_AdvBlendEqInteraction;
        } else {
            fAdvBlendEqInteraction = kGeneralEnable_AdvBlendEqInteraction;
            // TODO: Use the following on any platform where "blend_support_all_equations" is slow.
            //fAdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction;
        }
    }

    this->initShaderPrecisionTable(ctxInfo, gli);

    return true;
}
开发者ID:rickdynasty,项目名称:platform_external_skia,代码行数:95,代码来源:GrGLCaps.cpp


注:本文中的GrGLCaps::advancedBlendEquationSupport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。