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

Unified Diff: src/gpu/GrRenderTargetOpList.cpp

Issue 2215323003: Start using RenderTargetProxy (omnibus) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 1 month 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/GrRenderTargetOpList.h ('k') | src/gpu/GrTextureParamsAdjuster.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrRenderTargetOpList.cpp
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index b4e6870585af770a9deb80ec0755934343fcbbbd..3d410c79d07bf86129005dbfca834128f684cc69 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -19,6 +19,7 @@
#include "GrPipelineBuilder.h"
#include "GrRenderTarget.h"
#include "GrResourceProvider.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrRenderTargetPriv.h"
#include "GrStencilAttachment.h"
#include "GrSurfacePriv.h"
@@ -98,7 +99,7 @@ void GrRenderTargetOpList::dump() const {
#endif
bool GrRenderTargetOpList::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuilder,
- GrRenderTarget* rt,
+ GrRenderTargetContext* rtc,
const GrClip& clip,
const GrPipelineOptimizations& optimizations,
GrXferProcessor::DstTexture* dstTexture,
@@ -110,6 +111,12 @@ bool GrRenderTargetOpList::setupDstReadIfNecessary(const GrPipelineBuilder& pipe
return true;
}
+ GrContext* context = rtc->priv().context();
+ GrRenderTarget* rt = rtc->priv().accessRTP()->instantiate(context->textureProvider());
+ if (!rt) {
+ return false;
+ }
+
if (this->caps()->textureBarrierSupport()) {
if (GrTexture* rtTex = rt->asTexture()) {
// The render target is a texture, so we can read from it directly in the shader. The XP
@@ -184,24 +191,24 @@ bool GrRenderTargetOpList::drawBatches(GrBatchFlushState* flushState) {
}
// Draw all the generated geometry.
SkRandom random;
- GrRenderTarget* currentRT = nullptr;
+ GrRenderTargetProxy* currentRTP = nullptr;
std::unique_ptr<GrGpuCommandBuffer> commandBuffer;
for (int i = 0; i < fRecordedBatches.count(); ++i) {
if (!fRecordedBatches[i].fBatch) {
continue;
}
- if (fRecordedBatches[i].fBatch->renderTarget() != currentRT) {
+ if (fRecordedBatches[i].fBatch->rtp() != currentRTP) {
if (commandBuffer) {
commandBuffer->end();
commandBuffer->submit();
commandBuffer.reset();
}
- currentRT = fRecordedBatches[i].fBatch->renderTarget();
- if (currentRT) {
+ currentRTP = fRecordedBatches[i].fBatch->rtp();
+ if (currentRTP) {
static const GrGpuCommandBuffer::LoadAndStoreInfo kBasicLoadStoreInfo
{ GrGpuCommandBuffer::LoadOp::kLoad,GrGpuCommandBuffer::StoreOp::kStore,
GrColor_ILLEGAL };
- commandBuffer.reset(fGpu->createCommandBuffer(currentRT,
+ commandBuffer.reset(fGpu->createCommandBuffer(nullptr, //currentRT,
kBasicLoadStoreInfo, // Color
kBasicLoadStoreInfo)); // Stencil
}
@@ -211,11 +218,13 @@ bool GrRenderTargetOpList::drawBatches(GrBatchFlushState* flushState) {
const SkRect& bounds = fRecordedBatches[i].fClippedBounds;
SkIRect ibounds;
bounds.roundOut(&ibounds);
+#if 0
// In multi-draw buffer all the batches use the same render target and we won't need to
// get the batchs bounds.
if (GrRenderTarget* rt = fRecordedBatches[i].fBatch->renderTarget()) {
fGpu->drawDebugWireRect(rt, ibounds, 0xFF000000 | random.nextU());
}
+#endif
}
fRecordedBatches[i].fBatch->draw(flushState, fRecordedBatches[i].fClippedBounds);
}
@@ -338,7 +347,7 @@ void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder,
args.fScissor = &appliedClip.scissorState();
args.fWindowRectsState = &appliedClip.windowRectsState();
args.fHasStencilClip = appliedClip.hasStencilClip();
- if (!this->setupDstReadIfNecessary(pipelineBuilder, renderTargetContext->accessRenderTarget(),
+ if (!this->setupDstReadIfNecessary(pipelineBuilder, renderTargetContext,
clip, args.fOpts,
&args.fDstTexture, batch->bounds())) {
return;
@@ -392,7 +401,7 @@ void GrRenderTargetOpList::stencilPath(GrRenderTargetContext* renderTargetContex
appliedClip.hasStencilClip(),
stencilAttachment->bits(),
appliedClip.scissorState(),
- renderTargetContext->accessRenderTarget(),
+ fRenderTargetProxy,
path);
this->recordBatch(batch, appliedClip.clippedDrawBounds());
batch->unref();
@@ -402,29 +411,29 @@ void GrRenderTargetOpList::addBatch(sk_sp<GrBatch> batch) {
this->recordBatch(batch.get(), batch->bounds());
}
-void GrRenderTargetOpList::fullClear(GrRenderTarget* renderTarget, GrColor color) {
+void GrRenderTargetOpList::fullClear(GrRenderTargetProxy* rtp, GrColor color) {
// Currently this just inserts or updates the last clear batch. However, once in MDB this can
// remove all the previously recorded batches and change the load op to clear with supplied
// color.
if (fLastFullClearBatch &&
- fLastFullClearBatch->renderTargetUniqueID() == renderTarget->uniqueID()) {
+ fLastFullClearBatch->renderTargetUniqueID() == rtp->uniqueID()) {
// As currently implemented, fLastFullClearBatch should be the last batch because we would
// have cleared it when another batch was recorded.
SkASSERT(fRecordedBatches.back().fBatch.get() == fLastFullClearBatch);
fLastFullClearBatch->setColor(color);
return;
}
- sk_sp<GrClearBatch> batch(GrClearBatch::Make(GrFixedClip::Disabled(), color, renderTarget));
+ sk_sp<GrClearBatch> batch(GrClearBatch::Make(GrFixedClip::Disabled(), color, rtp));
if (batch.get() == this->recordBatch(batch.get(), batch->bounds())) {
fLastFullClearBatch = batch.get();
}
}
-void GrRenderTargetOpList::discard(GrRenderTarget* renderTarget) {
+void GrRenderTargetOpList::discard(GrRenderTargetProxy* rtp) {
// Currently this just inserts a discard batch. However, once in MDB this can remove all the
// previously recorded batches and change the load op to discard.
if (this->caps()->discardRenderTargetSupport()) {
- GrBatch* batch = new GrDiscardBatch(renderTarget);
+ GrBatch* batch = new GrDiscardBatch(rtp);
this->recordBatch(batch, batch->bounds());
batch->unref();
}
@@ -574,8 +583,8 @@ void GrRenderTargetOpList::forwardCombine() {
void GrRenderTargetOpList::clearStencilClip(const GrFixedClip& clip,
bool insideStencilMask,
- GrRenderTarget* rt) {
- GrBatch* batch = new GrClearStencilClipBatch(clip, insideStencilMask, rt);
+ GrRenderTargetProxy* rtp) {
+ GrBatch* batch = new GrClearStencilClipBatch(clip, insideStencilMask, rtp);
this->recordBatch(batch, batch->bounds());
batch->unref();
}
« no previous file with comments | « src/gpu/GrRenderTargetOpList.h ('k') | src/gpu/GrTextureParamsAdjuster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698