本文整理汇总了C++中GrRenderTarget::renderTargetPriv方法的典型用法代码示例。如果您正苦于以下问题:C++ GrRenderTarget::renderTargetPriv方法的具体用法?C++ GrRenderTarget::renderTargetPriv怎么用?C++ GrRenderTarget::renderTargetPriv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrRenderTarget
的用法示例。
在下文中一共展示了GrRenderTarget::renderTargetPriv方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawPath
void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder,
const GrPathProcessor* pathProc,
const GrPath* path,
GrPathRendering::FillType fill) {
// TODO: extract portions of checkDraw that are relevant to path rendering.
SkASSERT(path);
SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
SkRect devBounds = path->getBounds();
pathProc->viewMatrix().mapRect(&devBounds);
// Setup clip
GrScissorState scissorState;
GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
GrPipelineBuilder::AutoRestoreStencil ars;
if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, &devBounds)) {
return;
}
// set stencil settings for path
GrStencilSettings stencilSettings;
GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, pathProc, &devBounds,
this);
if (pipelineInfo.mustSkipDraw()) {
return;
}
this->onDrawPath(pathProc, path, stencilSettings, pipelineInfo);
}
示例2: stencilPath
void GrDrawTarget::stencilPath(GrPipelineBuilder* pipelineBuilder,
const GrPathProcessor* pathProc,
const GrPath* path,
GrPathRendering::FillType fill) {
// TODO: extract portions of checkDraw that are relevant to path stenciling.
SkASSERT(path);
SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
SkASSERT(pipelineBuilder);
// Setup clip
GrScissorState scissorState;
GrPipelineBuilder::AutoRestoreFragmentProcessors arfp;
GrPipelineBuilder::AutoRestoreStencil ars;
if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, NULL)) {
return;
}
// set stencil settings for path
GrStencilSettings stencilSettings;
GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
this->onStencilPath(*pipelineBuilder, pathProc, path, scissorState, stencilSettings);
}
示例3: onExecute
void GrStencilPathOp::onExecute(GrOpFlushState* state) {
GrRenderTarget* rt = state->drawOpArgs().renderTarget();
SkASSERT(rt);
int numStencilBits = rt->renderTargetPriv().numStencilBits();
GrStencilSettings stencil(GrPathRendering::GetStencilPassSettings(fFillType),
fHasStencilClip, numStencilBits);
GrPathRendering::StencilPathArgs args(fUseHWAA, state->drawOpArgs().fProxy,
&fViewMatrix, &fScissor, &stencil);
state->gpu()->pathRendering()->stencilPath(args, fPath.get());
}
示例4: drawPaths
void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
const GrPathProcessor* pathProc,
const GrPathRange* pathRange,
const void* indices,
PathIndexType indexType,
const float transformValues[],
PathTransformType transformType,
int count,
GrPathRendering::FillType fill) {
SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
SkASSERT(pathRange);
SkASSERT(indices);
SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeInBytes(indexType));
SkASSERT(transformValues);
SkASSERT(pipelineBuilder);
// Setup clip
GrScissorState scissorState;
GrPipelineBuilder::AutoRestoreFragmentProcessors arfp;
GrPipelineBuilder::AutoRestoreStencil ars;
if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, NULL)) {
return;
}
// set stencil settings for path
GrStencilSettings stencilSettings;
GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
// Don't compute a bounding box for dst copy texture, we'll opt
// instead for it to just copy the entire dst. Realistically this is a moot
// point, because any context that supports NV_path_rendering will also
// support NV_blend_equation_advanced.
GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, pathProc, NULL, this);
if (pipelineInfo.mustSkipDraw()) {
return;
}
this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues,
transformType, count, stencilSettings, pipelineInfo);
}
示例5: setPipelineBuilderStencil
void GrClipMaskManager::setPipelineBuilderStencil(GrPipelineBuilder* pipelineBuilder,
GrPipelineBuilder::AutoRestoreStencil* ars) {
// We make two copies of the StencilSettings here (except in the early
// exit scenario. One copy from draw state to the stack var. Then another
// from the stack var to the gpu. We could make this class hold a ptr to
// GrGpu's fStencilSettings and eliminate the stack copy here.
// use stencil for clipping if clipping is enabled and the clip
// has been written into the stencil.
GrStencilSettings settings;
// The GrGpu client may not be using the stencil buffer but we may need to
// enable it in order to respect a stencil clip.
if (pipelineBuilder->getStencil().isDisabled()) {
if (GrClipMaskManager::kRespectClip_StencilClipMode == fClipMode) {
settings = basic_apply_stencil_clip_settings();
} else {
return;
}
} else {
settings = pipelineBuilder->getStencil();
}
int stencilBits = 0;
GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
GrStencilBuffer* stencilBuffer = rt->renderTargetPriv().attachStencilBuffer();
if (stencilBuffer) {
stencilBits = stencilBuffer->bits();
}
SkASSERT(fClipTarget->caps()->stencilWrapOpsSupport() || !settings.usesWrapOp());
SkASSERT(fClipTarget->caps()->twoSidedStencilSupport() || !settings.isTwoSided());
this->adjustStencilParams(&settings, fClipMode, stencilBits);
ars->set(pipelineBuilder);
pipelineBuilder->setStencil(settings);
}
示例6: Build
bool GrVkProgramDescBuilder::Build(GrProgramDesc* desc,
const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
const GrGLSLCaps& glslCaps) {
// 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.
GrVkProgramDesc* vkDesc = (GrVkProgramDesc*)desc;
GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t));
// Make room for everything up to the effect keys.
vkDesc->key().reset();
vkDesc->key().push_back_n(kProcessorKeysOffset);
GrProcessorKeyBuilder b(&vkDesc->key());
primProc.getGLSLProcessorKey(glslCaps, &b);
if (!gen_meta_key(primProc, glslCaps, 0, &b)) {
vkDesc->key().reset();
return false;
}
GrProcessor::RequiredFeatures requiredFeatures = primProc.requiredFeatures();
for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) {
const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i);
if (!gen_frag_proc_and_meta_keys(primProc, fp, glslCaps, &b)) {
vkDesc->key().reset();
return false;
}
requiredFeatures |= fp.requiredFeatures();
}
const GrXferProcessor& xp = pipeline.getXferProcessor();
xp.getGLSLProcessorKey(glslCaps, &b);
if (!gen_meta_key(xp, glslCaps, 0, &b)) {
vkDesc->key().reset();
return false;
}
requiredFeatures |= xp.requiredFeatures();
// --------DO NOT MOVE HEADER ABOVE THIS LINE--------------------------------------------------
// Because header is a pointer into the dynamic array, we can't push any new data into the key
// below here.
KeyHeader* header = vkDesc->atOffset<KeyHeader, kHeaderOffset>();
// make sure any padding in the header is zeroed.
memset(header, 0, kHeaderSize);
GrRenderTarget* rt = pipeline.getRenderTarget();
if (requiredFeatures & (GrProcessor::kFragmentPosition_RequiredFeature |
GrProcessor::kSampleLocations_RequiredFeature)) {
header->fSurfaceOriginKey = GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(rt->origin());
} else {
header->fSurfaceOriginKey = 0;
}
if (requiredFeatures & GrProcessor::kSampleLocations_RequiredFeature) {
SkASSERT(pipeline.isHWAntialiasState());
header->fSamplePatternKey =
rt->renderTargetPriv().getMultisampleSpecs(pipeline.getStencil()).fUniqueID;
} else {
header->fSamplePatternKey = 0;
}
header->fOutputSwizzle = glslCaps.configOutputSwizzle(rt->config()).asKey();
if (pipeline.ignoresCoverage()) {
header->fIgnoresCoverage = 1;
} else {
header->fIgnoresCoverage = 0;
}
header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
header->fColorEffectCnt = pipeline.numColorFragmentProcessors();
header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors();
vkDesc->finalize();
return true;
}
示例7: CreateAt
GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
GrXPOverridesForBatch* overrides) {
const GrPipelineBuilder& builder = *args.fPipelineBuilder;
GrPipeline* pipeline = new (memory) GrPipeline;
GrRenderTarget* rt = args.fDrawContext->accessRenderTarget();
pipeline->fRenderTarget.reset(rt);
SkASSERT(pipeline->fRenderTarget);
pipeline->fScissorState = *args.fScissor;
if (builder.hasUserStencilSettings() || args.fHasStencilClip) {
const GrRenderTargetPriv& rtPriv = rt->renderTargetPriv();
pipeline->fStencilSettings.reset(*builder.getUserStencil(), args.fHasStencilClip,
rtPriv.numStencilBits());
SkASSERT(!pipeline->fStencilSettings.usesWrapOp() || args.fCaps->stencilWrapOpsSupport());
}
pipeline->fDrawFace = builder.getDrawFace();
pipeline->fFlags = 0;
if (builder.isHWAntialias()) {
pipeline->fFlags |= kHWAA_Flag;
}
if (builder.snapVerticesToPixelCenters()) {
pipeline->fFlags |= kSnapVertices_Flag;
}
if (builder.getDisableOutputConversionToSRGB()) {
pipeline->fFlags |= kDisableOutputConversionToSRGB_Flag;
}
if (builder.getAllowSRGBInputs()) {
pipeline->fFlags |= kAllowSRGBInputs_Flag;
}
if (builder.getUsesDistanceVectorField()) {
pipeline->fFlags |= kUsesDistanceVectorField_Flag;
}
if (args.fHasStencilClip) {
pipeline->fFlags |= kHasStencilClip_Flag;
}
// Create XferProcessor from DS's XPFactory
bool hasMixedSamples = args.fDrawContext->hasMixedSamples() &&
(builder.isHWAntialias() || !pipeline->fStencilSettings.isDisabled());
const GrXPFactory* xpFactory = builder.getXPFactory();
SkAutoTUnref<GrXferProcessor> xferProcessor;
if (xpFactory) {
xferProcessor.reset(xpFactory->createXferProcessor(args.fOpts,
hasMixedSamples,
&args.fDstTexture,
*args.fCaps));
if (!xferProcessor) {
pipeline->~GrPipeline();
return nullptr;
}
} else {
// This may return nullptr in the common case of src-over implemented using hw blending.
xferProcessor.reset(GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
*args.fCaps,
args.fOpts,
hasMixedSamples,
&args.fDstTexture));
}
GrColor overrideColor = GrColor_ILLEGAL;
if (args.fOpts.fColorPOI.firstEffectiveProcessorIndex() != 0) {
overrideColor = args.fOpts.fColorPOI.inputColorToFirstEffectiveProccesor();
}
GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags;
const GrXferProcessor* xpForOpts = xferProcessor ? xferProcessor.get() :
&GrPorterDuffXPFactory::SimpleSrcOverXP();
optFlags = xpForOpts->getOptimizations(args.fOpts,
pipeline->fStencilSettings.doesWrite(),
&overrideColor,
*args.fCaps);
// 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 (GrXferProcessor::kSkipDraw_OptFlag & optFlags) {
pipeline->~GrPipeline();
return nullptr;
}
// No need to have an override color if it isn't even going to be used.
if (SkToBool(GrXferProcessor::kIgnoreColor_OptFlag & optFlags)) {
overrideColor = GrColor_ILLEGAL;
}
pipeline->fXferProcessor.reset(xferProcessor);
int firstColorProcessorIdx = args.fOpts.fColorPOI.firstEffectiveProcessorIndex();
// TODO: Once we can handle single or four channel input into coverage GrFragmentProcessors
// then we can use GrPipelineBuilder's coverageProcInfo (like color above) to set this initial
// information.
int firstCoverageProcessorIdx = 0;
pipeline->adjustProgramFromOptimizations(builder, optFlags, args.fOpts.fColorPOI,
args.fOpts.fCoveragePOI, &firstColorProcessorIdx,
&firstCoverageProcessorIdx);
bool usesLocalCoords = false;
//.........这里部分代码省略.........