aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Leon Scroggins <scroggo@google.com>2016-11-07 21:26:31 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-07 21:26:46 +0000
commit7d7d7d19462b75f5470492dc4820a02c1eba4af2 (patch)
tree5afc268cac425ef6e5b07c07af0293864e7ac2d7 /src/gpu
parent6749af40739fab375d87951c5b0fb51a195e1f8c (diff)
Revert "Add GrRenderTargetContext instantiate & asTextureProxy"
This reverts commit 9113edfff89e657dabc0ba095c54f7720550196c. Reason for revert: Looks to be causing EXCEPTION_ACCESS_VIOLATION: https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Win-MSVC-NUC-GPU-IntelIris6100-x86_64-Debug/builds/121/steps/test_skia%20on%20Windows/logs/stdio https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Win-MSVC-GCE-CPU-AVX2-x86-Debug/builds/2384/steps/test_skia%20on%20Windows-2008ServerR2-SP1/logs/stdio https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Win-MSVC-ShuttleC-GPU-iHD530-x86_64-Debug/builds/785/steps/test_skia%20on%20Windows/logs/stdio Original change's description: > Add GrRenderTargetContext instantiate & asTextureProxy > > This CL also centralizes the instantiation code in GrSurfaceProxy and adds a test. > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4494 > > Change-Id: I0081d9a216dc0af293179f23bcb88acf6a822324 > Reviewed-on: https://skia-review.googlesource.com/4494 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I225ce7867ebd445067e5ea55ebbfd587f7fe782a Reviewed-on: https://skia-review.googlesource.com/4528 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrRenderTargetContext.cpp8
-rw-r--r--src/gpu/GrRenderTargetProxy.cpp26
-rw-r--r--src/gpu/GrSurfaceProxy.cpp24
-rw-r--r--src/gpu/GrTextureProxy.cpp17
4 files changed, 35 insertions, 40 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 20ac4129ef..ad8adb097d 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -117,14 +117,6 @@ GrRenderTargetContext::~GrRenderTargetContext() {
SkSafeUnref(fOpList);
}
-GrRenderTarget* GrRenderTargetContext::instantiate() {
- return fRenderTargetProxy->instantiate(fContext->textureProvider());
-}
-
-GrTextureProxy* GrRenderTargetContext::asDeferredTexture() {
- return fRenderTargetProxy->asTextureProxy();
-}
-
GrRenderTargetOpList* GrRenderTargetContext::getOpList() {
ASSERT_SINGLE_OWNER
SkDEBUGCODE(this->validate();)
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index fcc5275002..f428a0fb73 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -37,17 +37,33 @@ GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrRenderTarget> rt)
}
GrRenderTarget* GrRenderTargetProxy::instantiate(GrTextureProvider* texProvider) {
- SkASSERT(fDesc.fFlags & GrSurfaceFlags::kRenderTarget_GrSurfaceFlag);
+ if (fTarget) {
+ return fTarget->asRenderTarget();
+ }
- GrSurface* surf = INHERITED::instantiate(texProvider);
- if (!surf || !surf->asRenderTarget()) {
+ // TODO: it would be nice to not have to copy the desc here
+ GrSurfaceDesc desc = fDesc;
+ desc.fFlags |= GrSurfaceFlags::kRenderTarget_GrSurfaceFlag;
+
+ if (SkBackingFit::kApprox == fFit) {
+ fTarget = texProvider->createApproxTexture(desc);
+ } else {
+ fTarget = texProvider->createTexture(desc, fBudgeted);
+ }
+ if (!fTarget) {
return nullptr;
}
+#ifdef SK_DEBUG
+ if (kInvalidGpuMemorySize != this->getRawGpuMemorySize_debugOnly()) {
+ SkASSERT(fTarget->gpuMemorySize() <= this->getRawGpuMemorySize_debugOnly());
+ }
+#endif
+
// Check that our a priori computation matched the ultimate reality
- SkASSERT(fFlags == surf->asRenderTarget()->renderTargetPriv().flags());
+ SkASSERT(fFlags == fTarget->asRenderTarget()->renderTargetPriv().flags());
- return surf->asRenderTarget();
+ return fTarget->asRenderTarget();
}
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index b6d0e11cbb..c5afd0f262 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -9,7 +9,6 @@
#include "GrGpuResourcePriv.h"
#include "GrOpList.h"
-#include "GrTextureProvider.h"
GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, SkBackingFit fit)
: INHERITED(std::move(surface))
@@ -28,29 +27,6 @@ GrSurfaceProxy::~GrSurfaceProxy() {
SkSafeUnref(fLastOpList);
}
-GrSurface* GrSurfaceProxy::instantiate(GrTextureProvider* texProvider) {
- if (fTarget) {
- return fTarget;
- }
-
- if (SkBackingFit::kApprox == fFit) {
- fTarget = texProvider->createApproxTexture(fDesc);
- } else {
- fTarget = texProvider->createTexture(fDesc, fBudgeted);
- }
- if (!fTarget) {
- return nullptr;
- }
-
-#ifdef SK_DEBUG
- if (kInvalidGpuMemorySize != this->getRawGpuMemorySize_debugOnly()) {
- SkASSERT(fTarget->gpuMemorySize() <= this->getRawGpuMemorySize_debugOnly());
- }
-#endif
-
- return fTarget;
-}
-
void GrSurfaceProxy::setLastOpList(GrOpList* opList) {
if (fLastOpList) {
// The non-MDB world never closes so we can't check this condition
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 5fe43f7125..ca773b3eaf 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -21,10 +21,21 @@ GrTextureProxy::GrTextureProxy(sk_sp<GrTexture> tex)
}
GrTexture* GrTextureProxy::instantiate(GrTextureProvider* texProvider) {
- GrSurface* surf = this->INHERITED::instantiate(texProvider);
- if (!surf) {
- return nullptr;
+ if (fTarget) {
+ return fTarget->asTexture();
+ }
+
+ if (SkBackingFit::kApprox == fFit) {
+ fTarget = texProvider->createApproxTexture(fDesc);
+ } else {
+ fTarget = texProvider->createTexture(fDesc, fBudgeted);
+ }
+
+#ifdef SK_DEBUG
+ if (kInvalidGpuMemorySize != this->getRawGpuMemorySize_debugOnly()) {
+ SkASSERT(fTarget->gpuMemorySize() <= this->getRawGpuMemorySize_debugOnly());
}
+#endif
return fTarget->asTexture();
}