本文整理汇总了C++中GrGeometryProcessor类的典型用法代码示例。如果您正苦于以下问题:C++ GrGeometryProcessor类的具体用法?C++ GrGeometryProcessor怎么用?C++ GrGeometryProcessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GrGeometryProcessor类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emitAttributes
void GrGLVertexBuilder::emitAttributes(const GrGeometryProcessor& gp) {
int vaCount = gp.numAttribs();
for (int i = 0; i < vaCount; i++) {
this->addAttribute(&gp.getAttrib(i));
}
return;
}
示例2: GenKey
static inline void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const BatchTracker& local = bt.cast<BatchTracker>();
uint32_t key = local.fInputColorType << 16;
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 : 0x0;
key |= ComputePosKey(gp.viewMatrix()) << 1;
b->add32(key);
}
示例3: emitAttributes
void GrGLSLVaryingHandler::emitAttributes(const GrGeometryProcessor& gp) {
int vaCount = gp.numVertexAttributes();
for (int i = 0; i < vaCount; i++) {
this->addAttribute(gp.vertexAttribute(i).asShaderVar());
}
int iaCount = gp.numInstanceAttributes();
for (int i = 0; i < iaCount; i++) {
this->addAttribute(gp.instanceAttribute(i).asShaderVar());
}
}
示例4: emitAttributes
void GrGLSLVaryingHandler::emitAttributes(const GrGeometryProcessor& gp) {
int vaCount = gp.numAttribs();
for (int i = 0; i < vaCount; i++) {
const GrGeometryProcessor::Attribute& attr = gp.getAttrib(i);
this->addAttribute(GrShaderVar(attr.fName,
GrVertexAttribTypeToSLType(attr.fType),
GrShaderVar::kAttribute_TypeModifier,
GrShaderVar::kNonArray,
attr.fPrecision));
}
}
示例5: GenKey
static inline void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const GrDistanceFieldTextureEffect& dfTexEffect = gp.cast<GrDistanceFieldTextureEffect>();
const DistanceFieldBatchTracker& local = bt.cast<DistanceFieldBatchTracker>();
uint32_t key = dfTexEffect.getFlags();
key |= local.fInputColorType << 16;
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 << 24: 0x0;
key |= ComputePosKey(gp.viewMatrix()) << 25;
b->add32(key);
}
示例6: GenKey
static inline void GenKey(const GrGeometryProcessor& gp,
const GrBatchTracker& bt,
const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const DefaultGeoProc& def = gp.cast<DefaultGeoProc>();
const BatchTracker& local = bt.cast<BatchTracker>();
uint32_t key = def.fFlags;
key |= local.fInputColorType << 8 | local.fInputCoverageType << 16;
key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 << 24 : 0x0;
key |= ComputePosKey(gp.viewMatrix()) << 25;
b->add32(key);
}
示例7: GenKey
static inline void GenKey(const GrGeometryProcessor& gp,
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const GrDistanceFieldA8TextGeoProc& dfTexEffect = gp.cast<GrDistanceFieldA8TextGeoProc>();
uint32_t key = dfTexEffect.getFlags();
key |= dfTexEffect.colorIgnored() << 16;
key |= ComputePosKey(dfTexEffect.viewMatrix()) << 25;
b->add32(key);
// Currently we hardcode numbers to convert atlas coordinates to normalized floating point
SkASSERT(gp.numTextures() == 1);
GrTexture* atlas = gp.textureAccess(0).getTexture();
SkASSERT(atlas);
b->add32(atlas->width());
b->add32(atlas->height());
}
示例8: emitAttributes
void GrGLVertexShaderBuilder::emitAttributes(const GrGeometryProcessor& gp) {
const GrGeometryProcessor::VertexAttribArray& vars = gp.getVertexAttribs();
int numAttributes = vars.count();
for (int a = 0; a < numAttributes; ++a) {
this->addAttribute(vars[a]);
}
}
示例9: emitAttributes
void GrGLVertexBuilder::emitAttributes(const GrGeometryProcessor& gp) {
const GrGeometryProcessor::VertexAttribArray& v = gp.getAttribs();
int vaCount = v.count();
for (int i = 0; i < vaCount; i++) {
this->addAttribute(&v[i]);
}
return;
}
示例10: flush
void GrAtlasTextOp::flush(GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
if (!flushInfo->fGlyphsToFlush) {
return;
}
auto atlasManager = target->atlasManager();
GrGeometryProcessor* gp = flushInfo->fGeometryProcessor.get();
GrMaskFormat maskFormat = this->maskFormat();
unsigned int numActiveProxies;
const sk_sp<GrTextureProxy>* proxies = atlasManager->getProxies(maskFormat, &numActiveProxies);
SkASSERT(proxies);
if (gp->numTextureSamplers() != (int) numActiveProxies) {
// During preparation the number of atlas pages has increased.
// Update the proxies used in the GP to match.
for (unsigned i = gp->numTextureSamplers(); i < numActiveProxies; ++i) {
flushInfo->fFixedDynamicState->fPrimitiveProcessorTextures[i] = proxies[i].get();
}
if (this->usesDistanceFields()) {
if (this->isLCD()) {
reinterpret_cast<GrDistanceFieldLCDTextGeoProc*>(gp)->addNewProxies(
proxies, numActiveProxies, GrSamplerState::ClampBilerp());
} else {
reinterpret_cast<GrDistanceFieldA8TextGeoProc*>(gp)->addNewProxies(
proxies, numActiveProxies, GrSamplerState::ClampBilerp());
}
} else {
GrSamplerState samplerState = fNeedsGlyphTransform ? GrSamplerState::ClampBilerp()
: GrSamplerState::ClampNearest();
reinterpret_cast<GrBitmapTextGeoProc*>(gp)->addNewProxies(proxies, numActiveProxies,
samplerState);
}
}
int maxGlyphsPerDraw =
static_cast<int>(flushInfo->fIndexBuffer->gpuMemorySize() / sizeof(uint16_t) / 6);
GrMesh* mesh = target->allocMesh(GrPrimitiveType::kTriangles);
mesh->setIndexedPatterned(flushInfo->fIndexBuffer.get(), kIndicesPerGlyph, kVerticesPerGlyph,
flushInfo->fGlyphsToFlush, maxGlyphsPerDraw);
mesh->setVertexData(flushInfo->fVertexBuffer.get(), flushInfo->fVertexOffset);
target->draw(flushInfo->fGeometryProcessor, flushInfo->fPipeline, flushInfo->fFixedDynamicState,
mesh);
flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlush;
flushInfo->fGlyphsToFlush = 0;
}
示例11: gen_attrib_key
static uint32_t gen_attrib_key(const GrGeometryProcessor& proc) {
uint32_t key = 0;
const GrGeometryProcessor::VertexAttribArray& vars = proc.getVertexAttribs();
int numAttributes = vars.count();
SkASSERT(numAttributes <= 2);
for (int a = 0; a < numAttributes; ++a) {
uint32_t value = 1 << a;
key |= value;
}
return key;
}
示例12: GenKey
static inline void GenKey(const GrGeometryProcessor& proc,
const GrBatchTracker& bt,
const GrGLCaps&,
GrProcessorKeyBuilder* b) {
const BitmapTextBatchTracker& local = bt.cast<BitmapTextBatchTracker>();
// We have to put the optional vertex attribute as part of the key. See the comment
// on addVertexAttrib.
// TODO When we have deferred geometry we can fix this
const GrBitmapTextGeoProc& gp = proc.cast<GrBitmapTextGeoProc>();
uint32_t key = 0;
key |= SkToBool(gp.inColor()) ? 0x1 : 0x0;
key |= local.fUsesLocalCoords && proc.localMatrix().hasPerspective() ? 0x2 : 0x0;
key |= gp.maskFormat() == kARGB_GrMaskFormat ? 0x4 : 0x0;
key |= ComputePosKey(gp.viewMatrix()) << 3;
b->add32(local.fInputColorType << 16 | key);
}