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


C++ GrGeometryProcessor类代码示例

本文整理汇总了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;
}
开发者ID:Arternis,项目名称:skia,代码行数:7,代码来源:GrGLVertexShaderBuilder.cpp

示例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);
 }
开发者ID:amyvmiwei,项目名称:skia,代码行数:10,代码来源:GrAAConvexPathRenderer.cpp

示例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());
    }
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:10,代码来源:GrGLSLVarying.cpp

示例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));
    }
}
开发者ID:Crawping,项目名称:chromium_extract,代码行数:11,代码来源:GrGLSLVarying.cpp

示例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);
 }
开发者ID:Zahnstocher,项目名称:OsmAnd-external-skia,代码行数:12,代码来源:GrDistanceFieldTextureEffect.cpp

示例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);
 }
开发者ID:Igalia,项目名称:skia,代码行数:12,代码来源:GrDefaultGeoProcFactory.cpp

示例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());
    }
开发者ID:fluxxion82,项目名称:skia,代码行数:16,代码来源:GrDistanceFieldGeoProc.cpp

示例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]);
    }
}
开发者ID:435420057,项目名称:soui,代码行数:7,代码来源:GrGLVertexShaderBuilder.cpp

示例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;
}
开发者ID:lilycc,项目名称:skia,代码行数:8,代码来源:GrGLVertexShaderBuilder.cpp

示例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;
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:45,代码来源:GrAtlasTextOp.cpp

示例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;
}
开发者ID:DXGL,项目名称:skia,代码行数:12,代码来源:GrGLProgramDesc.cpp

示例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);
 }
开发者ID:Ashu17,项目名称:blackberry,代码行数:16,代码来源:GrBitmapTextGeoProc.cpp


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