aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2015-05-13 12:35:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-13 12:35:36 -0700
commit231c5fd590c898957d65cbfbc51040c7fe236af6 (patch)
treec2aa10774e252f02b024c39a0b4f3dc1bb33ce1f /src/gpu
parent1ba8cc9193f13a812401e14b8037fdcf3f3acbac (diff)
Don't issue texture barriers for RT's with separate storage
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrCommandBuilder.cpp2
-rw-r--r--src/gpu/GrGpu.h2
-rw-r--r--src/gpu/GrTargetCommands.cpp2
-rw-r--r--src/gpu/GrTargetCommands.h8
-rw-r--r--src/gpu/GrTest.cpp2
-rw-r--r--src/gpu/gl/GrGLGpu.cpp12
-rw-r--r--src/gpu/gl/GrGLGpu.h2
7 files changed, 22 insertions, 8 deletions
diff --git a/src/gpu/GrCommandBuilder.cpp b/src/gpu/GrCommandBuilder.cpp
index 2ff59bcecd..106e78185d 100644
--- a/src/gpu/GrCommandBuilder.cpp
+++ b/src/gpu/GrCommandBuilder.cpp
@@ -82,7 +82,7 @@ GrCommandBuilder::recordXferBarrierIfNecessary(const GrPipeline& pipeline,
return NULL;
}
- XferBarrier* xb = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), XferBarrier, ());
+ XferBarrier* xb = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), XferBarrier, (rt));
xb->fBarrierType = barrierType;
return xb;
}
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 83f6c992fc..f2ad10f417 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -277,7 +277,7 @@ public:
const SkIPoint& dstPoint) = 0;
// Called before certain draws in order to guarantee coherent results from dst reads.
- virtual void xferBarrier(GrXferBarrierType) = 0;
+ virtual void xferBarrier(GrRenderTarget*, GrXferBarrierType) = 0;
struct DrawArgs {
DrawArgs(const GrPrimitiveProcessor* primProc,
diff --git a/src/gpu/GrTargetCommands.cpp b/src/gpu/GrTargetCommands.cpp
index 7e57c03291..096d429dea 100644
--- a/src/gpu/GrTargetCommands.cpp
+++ b/src/gpu/GrTargetCommands.cpp
@@ -111,5 +111,5 @@ void GrTargetCommands::CopySurface::execute(GrGpu* gpu) {
}
void GrTargetCommands::XferBarrier::execute(GrGpu* gpu) {
- gpu->xferBarrier(fBarrierType);
+ gpu->xferBarrier(fRenderTarget.get(), fBarrierType);
}
diff --git a/src/gpu/GrTargetCommands.h b/src/gpu/GrTargetCommands.h
index 5e35e50bbf..2f9909bb02 100644
--- a/src/gpu/GrTargetCommands.h
+++ b/src/gpu/GrTargetCommands.h
@@ -242,11 +242,17 @@ private:
};
struct XferBarrier : public Cmd {
- XferBarrier() : Cmd(kXferBarrier_CmdType) {}
+ XferBarrier(GrRenderTarget* rt)
+ : Cmd(kXferBarrier_CmdType)
+ , fRenderTarget(rt) {
+ }
void execute(GrGpu*) override;
GrXferBarrierType fBarrierType;
+
+ private:
+ GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
};
static const int kCmdBufferInitialSizeInBytes = 8 * 1024;
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 1017273031..0b3d030cdb 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -169,7 +169,7 @@ public:
return false;
}
- void xferBarrier(GrXferBarrierType) override {}
+ void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {}
private:
void onResetContext(uint32_t resetBits) override {}
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 3d7d6918f1..6d97804fc6 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2787,12 +2787,20 @@ bool GrGLGpu::canCopySurface(const GrSurface* dst,
return false;
}
-void GrGLGpu::xferBarrier(GrXferBarrierType type) {
+void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) {
switch (type) {
- case kTexture_GrXferBarrierType:
+ case kTexture_GrXferBarrierType: {
+ GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt);
+ if (glrt->textureFBOID() != glrt->renderFBOID()) {
+ // The render target uses separate storage so no need for glTextureBarrier.
+ // FIXME: The render target will resolve automatically when its texture is bound,
+ // but we could resolve only the bounds that will be read if we do it here instead.
+ return;
+ }
SkASSERT(this->caps()->textureBarrierSupport());
GL_CALL(TextureBarrier());
return;
+ }
case kBlend_GrXferBarrierType:
SkASSERT(GrDrawTargetCaps::kAdvanced_BlendEquationSupport ==
this->caps()->blendEquationSupport());
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 4409b0c8fc..3323ece079 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -106,7 +106,7 @@ public:
const SkIRect& srcRect,
const SkIPoint& dstPoint) override;
- void xferBarrier(GrXferBarrierType) override;
+ void xferBarrier(GrRenderTarget*, GrXferBarrierType) override;
void buildProgramDesc(GrProgramDesc*,
const GrPrimitiveProcessor&,