Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Unified Diff: src/gpu/GrPipeline.cpp

Issue 1962243002: Separate user and raw stencil settings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrPipeline.h ('k') | src/gpu/GrPipelineBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPipeline.cpp
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 8d384ef9f10230fcff8718770940a1246b598ce1..761a876a1bf2e36432b8551abb3fdfccaf296a9a 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -20,9 +20,35 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
GrXPOverridesForBatch* overrides) {
const GrPipelineBuilder& builder = *args.fPipelineBuilder;
+ GrPipeline* pipeline = new (memory) GrPipeline;
+ pipeline->fRenderTarget.reset(builder.fRenderTarget.get());
+ SkASSERT(pipeline->fRenderTarget);
+ pipeline->fScissorState = *args.fScissor;
+ if (builder.hasUserStencilSettings() || args.fHasStencilClip) {
+ SkASSERT(args.fNumStencilBits);
+ pipeline->fStencilSettings.reset(*builder.getUserStencil(), args.fHasStencilClip,
+ args.fNumStencilBits);
+ 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;
+ }
+
// Create XferProcessor from DS's XPFactory
bool hasMixedSamples = builder.getRenderTarget()->hasMixedSamples() &&
- (builder.isHWAntialias() || !builder.getStencil().isDisabled());
+ (builder.isHWAntialias() || !pipeline->fStencilSettings.isDisabled());
const GrXPFactory* xpFactory = builder.getXPFactory();
SkAutoTUnref<GrXferProcessor> xferProcessor;
if (xpFactory) {
@@ -31,6 +57,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
&args.fDstTexture,
*args.fCaps));
if (!xferProcessor) {
+ pipeline->~GrPipeline();
return nullptr;
}
} else {
@@ -51,7 +78,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
const GrXferProcessor* xpForOpts = xferProcessor ? xferProcessor.get() :
&GrPorterDuffXPFactory::SimpleSrcOverXP();
optFlags = xpForOpts->getOptimizations(args.fOpts,
- builder.getStencil().doesWrite(),
+ pipeline->fStencilSettings.doesWrite(),
&overrideColor,
*args.fCaps);
@@ -59,6 +86,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
// 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;
}
@@ -67,29 +95,8 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
overrideColor = GrColor_ILLEGAL;
}
- GrPipeline* pipeline = new (memory) GrPipeline;
pipeline->fXferProcessor.reset(xferProcessor);
- pipeline->fRenderTarget.reset(builder.fRenderTarget.get());
- SkASSERT(pipeline->fRenderTarget);
- pipeline->fScissorState = *args.fScissor;
- pipeline->fStencilSettings = builder.getStencil();
- 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;
- }
-
int firstColorProcessorIdx = args.fOpts.fColorPOI.firstEffectiveProcessorIndex();
// TODO: Once we can handle single or four channel input into coverage GrFragmentProcessors
« no previous file with comments | « src/gpu/GrPipeline.h ('k') | src/gpu/GrPipelineBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698