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


C++ GrGLCaps类代码示例

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


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

示例1: getUniformLocations

void GrGLUniformHandler::getUniformLocations(GrGLuint programID, const GrGLCaps& caps) {
    if (!caps.bindUniformLocationSupport()) {
        int count = fUniforms.count();
        for (int i = 0; i < count; ++i) {
            GrGLint location;
            GL_CALL_RET(location, GetUniformLocation(programID, fUniforms[i].fVariable.c_str()));
            fUniforms[i].fLocation = location;
        }
        for (int i = 0; i < fSamplers.count(); ++i) {
            GrGLint location;
            GL_CALL_RET(location, GetUniformLocation(programID, fSamplers[i].fVariable.c_str()));
            fSamplers[i].fLocation = location;
        }
        for (int i = 0; i < fTexelBuffers.count(); ++i) {
            GrGLint location;
            GL_CALL_RET(location, GetUniformLocation(programID,
                                                     fTexelBuffers[i].fVariable.c_str()));
            fTexelBuffers[i].fLocation = location;
        }
        for (int i = 0; i < fImageStorages.count(); ++i) {
            GrGLint location;
            GL_CALL_RET(location, GetUniformLocation(programID,
                                                     fImageStorages[i].fVariable.c_str()));
            fImageStorages[i].fLocation = location;
        }
    }
}
开发者ID:MIPS,项目名称:external-skia,代码行数:27,代码来源:GrGLUniformHandler.cpp

示例2: KeyForDstRead

GrGLShaderBuilder::DstReadKey GrGLShaderBuilder::KeyForDstRead(const GrTexture* dstCopy,
                                                               const GrGLCaps& caps) {
    uint32_t key = kYesDstRead_DstReadKeyBit;
    if (caps.fbFetchSupport()) {
        return key;
    }
    SkASSERT(NULL != dstCopy);
    if (!caps.textureSwizzleSupport() && GrPixelConfigIsAlphaOnly(dstCopy->config())) {
        // The fact that the config is alpha-only must be considered when generating code.
        key |= kUseAlphaConfig_DstReadKeyBit;
    }
    if (kTopLeft_GrSurfaceOrigin == dstCopy->origin()) {
        key |= kTopLeftOrigin_DstReadKeyBit;
    }
    SkASSERT(static_cast<DstReadKey>(key) == key);
    return static_cast<DstReadKey>(key);
}
开发者ID:xuwakao,项目名称:skia,代码行数:17,代码来源:GrGLShaderBuilder.cpp

示例3: bindUniformLocations

void GrGLUniformHandler::bindUniformLocations(GrGLuint programID, const GrGLCaps& caps) {
    if (caps.bindUniformLocationSupport()) {
        int count = fUniforms.count();
        for (int i = 0; i < count; ++i) {
            GL_CALL(BindUniformLocation(programID, i, fUniforms[i].fVariable.c_str()));
            fUniforms[i].fLocation = i;
        }
    }
}
开发者ID:Crawping,项目名称:chromium_extract,代码行数:9,代码来源:GrGLUniformHandler.cpp

示例4: swizzle_requires_alpha_remapping

/**
 * Do we need to either map r,g,b->a or a->r. configComponentMask indicates which channels are
 * present in the texture's config. swizzleComponentMask indicates the channels present in the
 * shader swizzle.
 */
static bool swizzle_requires_alpha_remapping(const GrGLCaps& caps,
                                             uint32_t configComponentMask,
                                             uint32_t swizzleComponentMask) {
    if (caps.textureSwizzleSupport()) {
        // Any remapping is handled using texture swizzling not shader modifications.
        return false;
    }
    // check if the texture is alpha-only
    if (kA_GrColorComponentFlag == configComponentMask) {
        if (caps.textureRedSupport() && (kA_GrColorComponentFlag & swizzleComponentMask)) {
            // we must map the swizzle 'a's to 'r'.
            return true;
        }
        if (kRGB_GrColorComponentFlags & swizzleComponentMask) {
            // The 'r', 'g', and/or 'b's must be mapped to 'a' according to our semantics that
            // alpha-only textures smear alpha across all four channels when read.
            return true;
        }
    }
    return false;
}
开发者ID:DXGL,项目名称:skia,代码行数:26,代码来源:GrGLProgramDesc.cpp

示例5: bindUniformLocations

void GrGLUniformHandler::bindUniformLocations(GrGLuint programID, const GrGLCaps& caps) {
    if (caps.bindUniformLocationSupport()) {
        int uniformCnt = fUniforms.count();
        for (int i = 0; i < uniformCnt; ++i) {
            GL_CALL(BindUniformLocation(programID, i, fUniforms[i].fVariable.c_str()));
            fUniforms[i].fLocation = i;
        }
        for (int i = 0; i < fSamplers.count(); ++i) {
            GrGLint location = i + uniformCnt;
            GL_CALL(BindUniformLocation(programID, location, fSamplers[i].fShaderVar.c_str()));
            fSamplers[i].fLocation = location;
        }
    }
}
开发者ID:03050903,项目名称:skia,代码行数:14,代码来源:GrGLUniformHandler.cpp

示例6: KeyForTextureAccess

GrCustomStage::StageKey GrGLShaderBuilder::KeyForTextureAccess(const GrTextureAccess& access,
                                                               const GrGLCaps& caps) {
    GrCustomStage::StageKey key = 0;

    // Assume that swizzle support implies that we never have to modify a shader to adjust
    // for texture format/swizzle settings.
    if (caps.textureSwizzleSupport()) {
        return key;
    }

    if (texture_requires_alpha_to_red_swizzle(caps, access)) {
        key = 1;
    }

    return key;
}
开发者ID:gw280,项目名称:skia,代码行数:16,代码来源:GrGLShaderBuilder.cpp

示例7: get_frag_proc_and_meta_keys

/*
 * TODO: A better name for this function  would be "compute" instead of "get".
 */
static bool get_frag_proc_and_meta_keys(const GrPrimitiveProcessor& primProc,
                                        const GrFragmentProcessor& fp,
                                        const GrGLCaps& caps,
                                        GrProcessorKeyBuilder* b) {
    for (int i = 0; i < fp.numChildProcessors(); ++i) {
        if (!get_frag_proc_and_meta_keys(primProc, fp.childProcessor(i), caps, b)) {
            return false;
        }
    }

    fp.getGLProcessorKey(*caps.glslCaps(), b);

    //**** use glslCaps here?
    return get_meta_key(fp, caps, primProc.getTransformKey(fp.coordTransforms(),
                                                           fp.numTransformsExclChildren()), b);
}
开发者ID:jagannathanraman,项目名称:skia,代码行数:19,代码来源:GrGLProgramDesc.cpp

示例8: gen_texture_key

static uint32_t gen_texture_key(const GrProcessor& proc, const GrGLCaps& caps) {
    uint32_t key = 0;
    int numTextures = proc.numTextures();
    int shift = 0;
    for (int t = 0; t < numTextures; ++t) {
        const GrTextureAccess& access = proc.textureAccess(t);
        if (swizzle_requires_alpha_remapping(*caps.glslCaps(), access.getTexture()->config())) {
            key |= 1 << shift;
        }
        if (GR_GL_TEXTURE_EXTERNAL == static_cast<GrGLTexture*>(access.getTexture())->target()) {
            key |= 2 << shift;
        }
        shift += 2;
    }
    return key;
}
开发者ID:shokeywind,项目名称:skia,代码行数:16,代码来源:GrGLProgramDesc.cpp

示例9: KeyForTextureAccess

GrBackendEffectFactory::EffectKey GrGLShaderBuilder::KeyForTextureAccess(
                                                            const GrTextureAccess& access,
                                                            const GrGLCaps& caps) {
    GrBackendEffectFactory::EffectKey key = 0;

    // Assume that swizzle support implies that we never have to modify a shader to adjust
    // for texture format/swizzle settings.
    if (!caps.textureSwizzleSupport() && swizzle_requires_alpha_remapping(caps, access)) {
        key = 1;
    }
#if GR_DEBUG
    // Assert that key is set iff the swizzle will be modified.
    SkString origString(access.getSwizzle());
    origString.prepend(".");
    SkString modifiedString;
    append_swizzle(&modifiedString, access, caps);
    if (!modifiedString.size()) {
        modifiedString = ".rgba";
    }
    GrAssert(SkToBool(key) == (modifiedString != origString));
#endif
    return key;
}
开发者ID:hicdre,项目名称:skiaui,代码行数:23,代码来源:GrGLShaderBuilder.cpp

示例10: bindUniformLocations

void GrGLUniformHandler::bindUniformLocations(GrGLuint programID, const GrGLCaps& caps) {
    if (caps.bindUniformLocationSupport()) {
        int currUniform = 0;
        for (int i = 0; i < fUniforms.count(); ++i, ++currUniform) {
            GL_CALL(BindUniformLocation(programID, currUniform, fUniforms[i].fVariable.c_str()));
            fUniforms[i].fLocation = currUniform;
        }
        for (int i = 0; i < fSamplers.count(); ++i, ++currUniform) {
            GL_CALL(BindUniformLocation(programID, currUniform, fSamplers[i].fVariable.c_str()));
            fSamplers[i].fLocation = currUniform;
        }
        for (int i = 0; i < fTexelBuffers.count(); ++i, ++currUniform) {
            GL_CALL(BindUniformLocation(programID, currUniform,
                                        fTexelBuffers[i].fVariable.c_str()));
            fTexelBuffers[i].fLocation = currUniform;
        }
        for (int i = 0; i < fImageStorages.count(); ++i, ++currUniform) {
            GL_CALL(BindUniformLocation(programID, currUniform,
                                        fImageStorages[i].fVariable.c_str()));
            fImageStorages[i].fLocation = currUniform;
        }
    }
}
开发者ID:MIPS,项目名称:external-skia,代码行数:23,代码来源:GrGLUniformHandler.cpp

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