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


C++ GrProcessor::numBuffers方法代码示例

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


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

示例1: add_sampler_keys

static void add_sampler_keys(GrProcessorKeyBuilder* b, const GrProcessor& proc,
                             const GrGLSLCaps& caps) {
    int numTextures = proc.numTextures();
    int numSamplers = numTextures + proc.numBuffers();
    // Need two bytes per key (swizzle, sampler type, and precision).
    int word32Count = (numSamplers + 1) / 2;
    if (0 == word32Count) {
        return;
    }
    uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count));
    int i = 0;
    for (; i < numTextures; ++i) {
        const GrTextureAccess& access = proc.textureAccess(i);
        const GrTexture* tex = access.getTexture();
        k16[i] = sampler_key(tex->samplerType(), tex->config(), access.getVisibility(), caps);
    }
    for (; i < numSamplers; ++i) {
        const GrBufferAccess& access = proc.bufferAccess(i - numTextures);
        k16[i] = sampler_key(kSamplerBuffer_GrSLType, access.texelConfig(), access.visibility(),
                             caps);
    }
    // zero the last 16 bits if the number of samplers is odd.
    if (numSamplers & 0x1) {
        k16[numSamplers] = 0;
    }
}
开发者ID:BertiKarsunke,项目名称:skia,代码行数:26,代码来源:GrGLProgramDesc.cpp

示例2: bindTextures

void GrGLProgram::bindTextures(const GrProcessor& processor,
                               bool allowSRGBInputs,
                               int* nextSamplerIdx) {
    for (int i = 0; i < processor.numTextures(); ++i) {
        const GrTextureAccess& access = processor.textureAccess(i);
        fGpu->bindTexture((*nextSamplerIdx)++, access.getParams(),
                          allowSRGBInputs, static_cast<GrGLTexture*>(access.getTexture()));
    }
    for (int i = 0; i < processor.numBuffers(); ++i) {
        const GrBufferAccess& access = processor.bufferAccess(i);
        fGpu->bindTexelBuffer((*nextSamplerIdx)++, access.offsetInBytes(), access.texelConfig(),
                              static_cast<GrGLBuffer*>(access.buffer()));
    }
}
开发者ID:BertiKarsunke,项目名称:skia,代码行数:14,代码来源:GrGLProgram.cpp

示例3: hasSameSamplers

bool GrProcessor::hasSameSamplers(const GrProcessor& that) const {
    if (this->numTextures() != that.numTextures() || this->numBuffers() != that.numBuffers()) {
        return false;
    }
    for (int i = 0; i < this->numTextures(); ++i) {
        if (this->textureAccess(i) != that.textureAccess(i)) {
            return false;
        }
    }
    for (int i = 0; i < this->numBuffers(); ++i) {
        if (this->bufferAccess(i) != that.bufferAccess(i)) {
            return false;
        }
    }
    return true;
}
开发者ID:03050903,项目名称:skia,代码行数:16,代码来源:GrProcessor.cpp

示例4: add_texture_key

static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc,
                            const GrGLSLCaps& caps) {
    int numTextures = proc.numTextures();
    SkASSERT(0 == proc.numBuffers());
    // Need two bytes per key (swizzle, sampler type, and precision).
    int word32Count = (proc.numTextures() + 1) / 2;
    if (0 == word32Count) {
        return;
    }
    uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count));
    for (int i = 0; i < numTextures; ++i) {
        const GrTextureAccess& access = proc.textureAccess(i);
        GrTexture* texture = access.getTexture();
        k16[i] = SkToU16(caps.configTextureSwizzle(texture->config()).asKey() |
                         (caps.samplerPrecision(texture->config(), access.getVisibility()) << 8));
    }
    // zero the last 16 bits if the number of textures is odd.
    if (numTextures & 0x1) {
        k16[numTextures] = 0;
    }
}
开发者ID:OwenTan,项目名称:skia,代码行数:21,代码来源:GrVkProgramDesc.cpp


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