aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-02-22 11:52:36 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-23 14:03:32 +0000
commitb16e8ac7f37b30ca9a51367e49c5815f36774120 (patch)
tree28e7a19b1caa8e7fabff405a5db4473cc0de1d79
parente9c25ce2d2fecd719156212b4ac6f6701c31a4b6 (diff)
Make GrPipeline::CreateAt take GrRenderTarget and not GrRenderTargetContext
This is needed in order to create pipelines at flush time. Change-Id: I0bcd64d503d45c3383dbb932b048e2d7faa07c67 Reviewed-on: https://skia-review.googlesource.com/8849 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
-rw-r--r--src/gpu/GrPipeline.cpp10
-rw-r--r--src/gpu/GrPipeline.h2
-rw-r--r--src/gpu/GrRenderTargetOpList.cpp7
-rw-r--r--tests/GpuSampleLocationsTest.cpp2
4 files changed, 11 insertions, 10 deletions
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 4121549a7b..6de106c8dd 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -22,14 +22,10 @@
GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
GrPipelineOptimizations* optimizations) {
SkASSERT(args.fAnalysis);
- GrRenderTarget* rt = args.fRenderTargetContext->accessRenderTarget();
- if (!rt) {
- return nullptr;
- }
+ SkASSERT(args.fRenderTarget);
GrPipeline* pipeline = new (memory) GrPipeline;
- pipeline->fRenderTarget.reset(rt);
- SkASSERT(pipeline->fRenderTarget);
+ pipeline->fRenderTarget.reset(args.fRenderTarget);
pipeline->fScissorState = args.fAppliedClip->scissorState();
pipeline->fWindowRectsState = args.fAppliedClip->windowRectsState();
pipeline->fUserStencilSettings = args.fUserStencil;
@@ -55,7 +51,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
bool isHWAA = kHWAntialias_Flag & args.fFlags;
// Create XferProcessor from DS's XPFactory
- bool hasMixedSamples = args.fRenderTargetContext->hasMixedSamples() &&
+ bool hasMixedSamples = args.fRenderTarget->isMixedSampled() &&
(isHWAA || pipeline->isStencilEnabled());
const GrXPFactory* xpFactory = args.fProcessors->xpFactory();
sk_sp<GrXferProcessor> xferProcessor;
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 8fca37e6fa..a9d34aea9c 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -62,7 +62,7 @@ public:
const GrProcessorSet::FragmentProcessorAnalysis* fAnalysis;
const GrUserStencilSettings* fUserStencil = &GrUserStencilSettings::kUnused;
GrAppliedClip* fAppliedClip = nullptr;
- GrRenderTargetContext* fRenderTargetContext = nullptr;
+ GrRenderTarget* fRenderTarget = nullptr;
const GrCaps* fCaps = nullptr;
GrXferProcessor::DstTexture fDstTexture;
};
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index cd22541b93..eb80cbc819 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -292,7 +292,12 @@ void GrRenderTargetOpList::addDrawOp(const GrPipelineBuilder& pipelineBuilder,
GrPipeline::CreateArgs args;
pipelineBuilder.initPipelineCreateArgs(&args);
args.fAppliedClip = &appliedClip;
- args.fRenderTargetContext = renderTargetContext;
+ // This forces instantiation of the render target. Pipeline creation is moving to flush time
+ // by which point instantiation must have occurred anyway.
+ args.fRenderTarget = renderTargetContext->accessRenderTarget();
+ if (!args.fRenderTarget) {
+ return;
+ }
args.fCaps = this->caps();
args.fAnalysis = &analysis;
if (analysis.usesPLSDstRead() || fClipOpToBounds) {
diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp
index 17fbe47f20..45a8ae100c 100644
--- a/tests/GpuSampleLocationsTest.cpp
+++ b/tests/GpuSampleLocationsTest.cpp
@@ -101,7 +101,7 @@ static GrPipeline* construct_dummy_pipeline(GrRenderTargetContext* dc, void* sto
GrProcessorSet::FragmentProcessorAnalysis analysis;
GrPipeline::CreateArgs args;
dummyBuilder.initPipelineCreateArgs(&args);
- args.fRenderTargetContext = dc;
+ args.fRenderTarget = dc->accessRenderTarget();
args.fAnalysis = &analysis;
args.fCaps = dc->caps();
args.fAppliedClip = &dummyAppliedClip;