本文整理汇总了C++中GrDrawState::getGeometryProcessor方法的典型用法代码示例。如果您正苦于以下问题:C++ GrDrawState::getGeometryProcessor方法的具体用法?C++ GrDrawState::getGeometryProcessor怎么用?C++ GrDrawState::getGeometryProcessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrDrawState
的用法示例。
在下文中一共展示了GrDrawState::getGeometryProcessor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INHERITED
GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
BlendOptFlags blendOptFlags,
GrBlendCoeff optSrcCoeff,
GrBlendCoeff optDstCoeff,
const GrDrawTargetCaps& caps) : INHERITED(drawState) {
fColor = drawState.getColor();
fCoverage = drawState.getCoverage();
fViewMatrix = drawState.getViewMatrix();
fBlendConstant = drawState.getBlendConstant();
fFlagBits = drawState.getFlagBits();
fVAPtr = drawState.getVertexAttribs();
fVACount = drawState.getVertexAttribCount();
fVAStride = drawState.getVertexStride();
fStencilSettings = drawState.getStencil();
fDrawFace = drawState.getDrawFace();
fBlendOptFlags = blendOptFlags;
fSrcBlend = optSrcCoeff;
fDstBlend = optDstCoeff;
memcpy(fFixedFunctionVertexAttribIndices,
drawState.getFixedFunctionVertexAttribIndices(),
sizeof(fFixedFunctionVertexAttribIndices));
fInputColorIsUsed = true;
fInputCoverageIsUsed = true;
if (drawState.hasGeometryProcessor()) {
fGeometryProcessor.reset(SkNEW_ARGS(GrGeometryStage, (*drawState.getGeometryProcessor())));
} else {
fGeometryProcessor.reset(NULL);
}
this->copyEffectiveColorStages(drawState);
this->copyEffectiveCoverageStages(drawState);
this->adjustFromBlendOpts();
this->getStageStats();
this->setOutputStateInfo(caps);
};
示例2: Build
bool GrGLProgramDesc::Build(const GrDrawState& drawState,
GrGpu::DrawType drawType,
GrDrawState::BlendOptFlags blendOpts,
GrBlendCoeff srcCoeff,
GrBlendCoeff dstCoeff,
const GrGpuGL* gpu,
const GrDeviceCoordTexture* dstCopy,
const GrEffectStage** geometryProcessor,
SkTArray<const GrEffectStage*, true>* colorStages,
SkTArray<const GrEffectStage*, true>* coverageStages,
GrGLProgramDesc* desc) {
colorStages->reset();
coverageStages->reset();
// This should already have been caught
SkASSERT(!(GrDrawState::kSkipDraw_BlendOptFlag & blendOpts));
bool skipCoverage = SkToBool(blendOpts & GrDrawState::kEmitTransBlack_BlendOptFlag);
bool skipColor = SkToBool(blendOpts & (GrDrawState::kEmitTransBlack_BlendOptFlag |
GrDrawState::kEmitCoverage_BlendOptFlag));
int firstEffectiveColorStage = 0;
bool inputColorIsUsed = true;
if (!skipColor) {
firstEffectiveColorStage = drawState.numColorStages();
while (firstEffectiveColorStage > 0 && inputColorIsUsed) {
--firstEffectiveColorStage;
const GrEffect* effect = drawState.getColorStage(firstEffectiveColorStage).getEffect();
inputColorIsUsed = effect->willUseInputColor();
}
}
int firstEffectiveCoverageStage = 0;
bool inputCoverageIsUsed = true;
if (!skipCoverage) {
firstEffectiveCoverageStage = drawState.numCoverageStages();
while (firstEffectiveCoverageStage > 0 && inputCoverageIsUsed) {
--firstEffectiveCoverageStage;
const GrEffect* effect = drawState.getCoverageStage(firstEffectiveCoverageStage).getEffect();
inputCoverageIsUsed = effect->willUseInputColor();
}
}
// The descriptor is used as a cache key. Thus when a field of the
// descriptor will not affect program generation (because of the attribute
// bindings in use or other descriptor field settings) it should be set
// to a canonical value to avoid duplicate programs with different keys.
bool requiresColorAttrib = !skipColor && drawState.hasColorVertexAttribute();
bool requiresCoverageAttrib = !skipCoverage && drawState.hasCoverageVertexAttribute();
// we only need the local coords if we're actually going to generate effect code
bool requiresLocalCoordAttrib = !(skipCoverage && skipColor) &&
drawState.hasLocalCoordAttribute();
bool readsDst = false;
bool readFragPosition = false;
// Provide option for shader programs without vertex shader only when drawing paths.
bool requiresVertexShader = !GrGpu::IsPathRenderingDrawType(drawType);
int numStages = 0;
if (drawState.hasGeometryProcessor()) {
numStages++;
}
if (!skipColor) {
numStages += drawState.numColorStages() - firstEffectiveColorStage;
}
if (!skipCoverage) {
numStages += drawState.numCoverageStages() - firstEffectiveCoverageStage;
}
GR_STATIC_ASSERT(0 == kEffectKeyOffsetsAndLengthOffset % sizeof(uint32_t));
// Make room for everything up to and including the array of offsets to effect keys.
desc->fKey.reset();
desc->fKey.push_back_n(kEffectKeyOffsetsAndLengthOffset + 2 * sizeof(uint16_t) * numStages);
int offsetAndSizeIndex = 0;
bool effectKeySuccess = true;
KeyHeader* header = desc->header();
// make sure any padding in the header is zeroed.
memset(desc->header(), 0, kHeaderSize);
// We can only have one effect which touches the vertex shader
if (drawState.hasGeometryProcessor()) {
uint16_t* offsetAndSize =
reinterpret_cast<uint16_t*>(desc->fKey.begin() + kEffectKeyOffsetsAndLengthOffset +
offsetAndSizeIndex * 2 * sizeof(uint16_t));
GrEffectKeyBuilder b(&desc->fKey);
uint16_t effectKeySize;
uint32_t effectOffset = desc->fKey.count();
effectKeySuccess |= GetEffectKeyAndUpdateStats(
*drawState.getGeometryProcessor(), gpu->glCaps(),
requiresLocalCoordAttrib, &b,
&effectKeySize, &readsDst,
&readFragPosition, &requiresVertexShader);
effectKeySuccess |= (effectOffset <= SK_MaxU16);
//.........这里部分代码省略.........