本文整理汇总了C++中GrProcessor::bufferAccess方法的典型用法代码示例。如果您正苦于以下问题:C++ GrProcessor::bufferAccess方法的具体用法?C++ GrProcessor::bufferAccess怎么用?C++ GrProcessor::bufferAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrProcessor
的用法示例。
在下文中一共展示了GrProcessor::bufferAccess方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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()));
}
}
示例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;
}