本文整理汇总了C++中GrPipelineBuilder::numCoverageFragmentStages方法的典型用法代码示例。如果您正苦于以下问题:C++ GrPipelineBuilder::numCoverageFragmentStages方法的具体用法?C++ GrPipelineBuilder::numCoverageFragmentStages怎么用?C++ GrPipelineBuilder::numCoverageFragmentStages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrPipelineBuilder
的用法示例。
在下文中一共展示了GrPipelineBuilder::numCoverageFragmentStages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adjustProgramFromOptimizations
void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelineBuilder,
GrXferProcessor::OptFlags flags,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
int* firstColorStageIdx,
int* firstCoverageStageIdx) {
fReadsFragPosition = fXferProcessor->willReadFragmentPosition();
if ((flags & GrXferProcessor::kIgnoreColor_OptFlag) ||
(flags & GrXferProcessor::kOverrideColor_OptFlag)) {
*firstColorStageIdx = pipelineBuilder.numColorFragmentStages();
} else {
if (coveragePOI.readsFragPosition()) {
fReadsFragPosition = true;
}
}
if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) {
*firstCoverageStageIdx = pipelineBuilder.numCoverageFragmentStages();
} else {
if (coveragePOI.readsFragPosition()) {
fReadsFragPosition = true;
}
}
}
示例2: xferProcessor
GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDrawTargetCaps& caps,
const GrScissorState& scissorState,
const GrDeviceCoordTexture* dstCopy) {
// Create XferProcessor from DS's XPFactory
SkAutoTUnref<GrXferProcessor> xferProcessor(
pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePOI, dstCopy, caps));
GrColor overrideColor = GrColor_ILLEGAL;
if (colorPOI.firstEffectiveStageIndex() != 0) {
overrideColor = colorPOI.inputColorToEffectiveStage();
}
GrXferProcessor::OptFlags optFlags;
if (xferProcessor) {
fXferProcessor.reset(xferProcessor.get());
optFlags = xferProcessor->getOptimizations(colorPOI,
coveragePOI,
pipelineBuilder.getStencil().doesWrite(),
&overrideColor,
caps);
}
// When path rendering the stencil settings are not always set on the GrPipelineBuilder
// so we must check the draw type. In cases where we will skip drawing we simply return a
// null GrPipeline.
if (!xferProcessor || (GrXferProcessor::kSkipDraw_OptFlag & optFlags)) {
// Set the fields that don't default init and return. The lack of a render target will
// indicate that this can be skipped.
fFlags = 0;
fDrawFace = GrPipelineBuilder::kInvalid_DrawFace;
return;
}
fRenderTarget.reset(pipelineBuilder.fRenderTarget.get());
SkASSERT(fRenderTarget);
fScissorState = scissorState;
fStencilSettings = pipelineBuilder.getStencil();
fDrawFace = pipelineBuilder.getDrawFace();
fFlags = 0;
if (pipelineBuilder.isHWAntialias()) {
fFlags |= kHWAA_Flag;
}
if (pipelineBuilder.isDither()) {
fFlags |= kDither_Flag;
}
if (pipelineBuilder.snapVerticesToPixelCenters()) {
fFlags |= kSnapVertices_Flag;
}
int firstColorStageIdx = colorPOI.firstEffectiveStageIndex();
// TODO: Once we can handle single or four channel input into coverage stages then we can use
// GrPipelineBuilder's coverageProcInfo (like color above) to set this initial information.
int firstCoverageStageIdx = 0;
this->adjustProgramFromOptimizations(pipelineBuilder, optFlags, colorPOI, coveragePOI,
&firstColorStageIdx, &firstCoverageStageIdx);
bool usesLocalCoords = false;
// Copy Stages from PipelineBuilder to Pipeline
for (int i = firstColorStageIdx; i < pipelineBuilder.numColorFragmentStages(); ++i) {
SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
GrPendingFragmentStage,
(pipelineBuilder.fColorStages[i]));
usesLocalCoords = usesLocalCoords ||
pipelineBuilder.fColorStages[i].processor()->usesLocalCoords();
}
fNumColorStages = fFragmentStages.count();
for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentStages(); ++i) {
SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
GrPendingFragmentStage,
(pipelineBuilder.fCoverageStages[i]));
usesLocalCoords = usesLocalCoords ||
pipelineBuilder.fCoverageStages[i].processor()->usesLocalCoords();
}
// let the GP init the batch tracker
fInitBT.fColorIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreColor_OptFlag);
fInitBT.fOverrideColor = fInitBT.fColorIgnored ? GrColor_ILLEGAL : overrideColor;
fInitBT.fCoverageIgnored = SkToBool(optFlags & GrXferProcessor::kIgnoreCoverage_OptFlag);
fInitBT.fUsesLocalCoords = usesLocalCoords;
fInitBT.fCanTweakAlphaForCoverage =
SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag);
}
示例3: checkDraw
bool GrDrawTarget::checkDraw(const GrPipelineBuilder& pipelineBuilder,
const GrGeometryProcessor* gp,
GrPrimitiveType type,
int startVertex,
int startIndex,
int vertexCount,
int indexCount) const {
#ifdef SK_DEBUG
const GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
int maxVertex = startVertex + vertexCount;
int maxValidVertex;
switch (geoSrc.fVertexSrc) {
case kNone_GeometrySrcType:
SkFAIL("Attempting to draw without vertex src.");
case kReserved_GeometrySrcType: // fallthrough
maxValidVertex = geoSrc.fVertexCount;
break;
case kBuffer_GeometrySrcType:
maxValidVertex = static_cast<int>(geoSrc.fVertexBuffer->gpuMemorySize() /
geoSrc.fVertexSize);
break;
}
if (maxVertex > maxValidVertex) {
SkFAIL("Drawing outside valid vertex range.");
}
if (indexCount > 0) {
int maxIndex = startIndex + indexCount;
int maxValidIndex;
switch (geoSrc.fIndexSrc) {
case kNone_GeometrySrcType:
SkFAIL("Attempting to draw indexed geom without index src.");
case kReserved_GeometrySrcType: // fallthrough
maxValidIndex = geoSrc.fIndexCount;
break;
case kBuffer_GeometrySrcType:
maxValidIndex = static_cast<int>(geoSrc.fIndexBuffer->gpuMemorySize() /
sizeof(uint16_t));
break;
}
if (maxIndex > maxValidIndex) {
SkFAIL("Index reads outside valid index range.");
}
}
SkASSERT(pipelineBuilder.getRenderTarget());
if (gp) {
int numTextures = gp->numTextures();
for (int t = 0; t < numTextures; ++t) {
GrTexture* texture = gp->texture(t);
SkASSERT(texture->asRenderTarget() != pipelineBuilder.getRenderTarget());
}
}
for (int s = 0; s < pipelineBuilder.numColorFragmentStages(); ++s) {
const GrProcessor* effect = pipelineBuilder.getColorFragmentStage(s).processor();
int numTextures = effect->numTextures();
for (int t = 0; t < numTextures; ++t) {
GrTexture* texture = effect->texture(t);
SkASSERT(texture->asRenderTarget() != pipelineBuilder.getRenderTarget());
}
}
for (int s = 0; s < pipelineBuilder.numCoverageFragmentStages(); ++s) {
const GrProcessor* effect = pipelineBuilder.getCoverageFragmentStage(s).processor();
int numTextures = effect->numTextures();
for (int t = 0; t < numTextures; ++t) {
GrTexture* texture = effect->texture(t);
SkASSERT(texture->asRenderTarget() != pipelineBuilder.getRenderTarget());
}
}
#endif
if (NULL == pipelineBuilder.getRenderTarget()) {
return false;
}
return true;
}