aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2016-11-08 13:49:39 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-08 13:49:49 +0000
commiteaa862569dc91d55fc79d057df6e69b139e46888 (patch)
tree49c648f32f78e3f625b9338d675bd8fbcf340c1e /src/gpu
parent283eb302330e9b9a2f144f341ec12cac54590ebf (diff)
Revert "Revert "Add GrRenderTargetContext instantiate & asTextureProxy""
This reverts commit 7d7d7d19462b75f5470492dc4820a02c1eba4af2. Reason for revert: Reverting this to see if it really was crashing on SVGs or if that was cross talk. Original change's description: > 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> > TBR=bsalomon@google.com,robertphillips@google.com,scroggo@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ifc3b9ac343009a3808f5f47500eef50df438e3d9 Reviewed-on: https://skia-review.googlesource.com/4537 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Robert Phillips <robertphillips@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, 40 insertions, 35 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index f1f17b03ea..4c86cbc464 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -117,6 +117,14 @@ 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 f428a0fb73..fcc5275002 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -37,33 +37,17 @@ GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrRenderTarget> rt)
}
GrRenderTarget* GrRenderTargetProxy::instantiate(GrTextureProvider* texProvider) {
- if (fTarget) {
- return fTarget->asRenderTarget();
- }
+ SkASSERT(fDesc.fFlags & GrSurfaceFlags::kRenderTarget_GrSurfaceFlag);
- // 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) {
+ GrSurface* surf = INHERITED::instantiate(texProvider);
+ if (!surf || !surf->asRenderTarget()) {
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 == fTarget->asRenderTarget()->renderTargetPriv().flags());
+ SkASSERT(fFlags == surf->asRenderTarget()->renderTargetPriv().flags());
- return fTarget->asRenderTarget();
+ return surf->asRenderTarget();
}
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index c5afd0f262..b6d0e11cbb 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -9,6 +9,7 @@
#include "GrGpuResourcePriv.h"
#include "GrOpList.h"
+#include "GrTextureProvider.h"
GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, SkBackingFit fit)
: INHERITED(std::move(surface))
@@ -27,6 +28,29 @@ 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 ca773b3eaf..5fe43f7125 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -21,21 +21,10 @@ GrTextureProxy::GrTextureProxy(sk_sp<GrTexture> tex)
}
GrTexture* GrTextureProxy::instantiate(GrTextureProvider* texProvider) {
- 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());
+ GrSurface* surf = this->INHERITED::instantiate(texProvider);
+ if (!surf) {
+ return nullptr;
}
-#endif
return fTarget->asTexture();
}