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

Unified Diff: src/gpu/GrPipeline.cpp

Issue 1286173006: Fail early in GrPipeline::CreateAt() if XP creation fails (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | no next file » | 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 28ef7ba05dcfc0d3db80999c9f91bf5bf17ac336..bc3e785ba138a4d94cd301384c53e6e4bb9ba336 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -17,7 +17,6 @@
GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
GrPipelineOptimizations* opts) {
- GrPipeline* pipeline = SkNEW_PLACEMENT(memory, GrPipeline);
const GrPipelineBuilder& builder = *args.fPipelineBuilder;
// Create XferProcessor from DS's XPFactory
@@ -25,6 +24,9 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
builder.getXPFactory()->createXferProcessor(args.fColorPOI, args.fCoveragePOI,
builder.hasMixedSamples(), &args.fDstTexture,
*args.fCaps));
+ if (!xferProcessor) {
+ return nullptr;
+ }
GrColor overrideColor = GrColor_ILLEGAL;
if (args.fColorPOI.firstEffectiveStageIndex() != 0) {
@@ -32,15 +34,12 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
}
GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags;
- if (xferProcessor) {
- pipeline->fXferProcessor.reset(xferProcessor.get());
- optFlags = xferProcessor->getOptimizations(args.fColorPOI,
- args.fCoveragePOI,
- builder.getStencil().doesWrite(),
- &overrideColor,
- *args.fCaps);
- }
+ optFlags = xferProcessor->getOptimizations(args.fColorPOI,
+ args.fCoveragePOI,
+ builder.getStencil().doesWrite(),
+ &overrideColor,
+ *args.fCaps);
// No need to have an override color if it isn't even going to be used.
if (SkToBool(GrXferProcessor::kIgnoreColor_OptFlag & optFlags)) {
egdaniel 2015/08/12 20:37:29 lets move this check bellow the return nullptr bel
bsalomon 2015/08/13 13:37:08 Done.
@@ -50,11 +49,13 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
// 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)) {
- pipeline->~GrPipeline();
+ if (GrXferProcessor::kSkipDraw_OptFlag & optFlags) {
return nullptr;
}
+ GrPipeline* pipeline = SkNEW_PLACEMENT(memory, GrPipeline);
+ pipeline->fXferProcessor.reset(xferProcessor.get());
+
pipeline->fRenderTarget.reset(builder.fRenderTarget.get());
SkASSERT(pipeline->fRenderTarget);
pipeline->fScissorState = *args.fScissor;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698