aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-04-11 10:08:06 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-12 14:56:10 +0000
commitba375a88843160e6884023e9108ea84de8eb3a0f (patch)
tree18dc34f015079a4ef7aedbc4d0fc877fa56d6d92 /src/gpu
parent21f6437764253c304c839409ea7883ad56cfcd63 (diff)
Add SK_SUPPORT_LEGACY_BACKEND_OBJECTS
This relies on the Chrome CL: https://chromium-review.googlesource.com/c/chromium/src/+/999796 (Add SK_SUPPORT_LEGACY_BACKEND_OBJECTS to SkUserConfig.h) landing first. Change-Id: Ie0a2b7b84cc02e46957765a0a7d6444a5320769d Reviewed-on: https://skia-review.googlesource.com/119140 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/gl/GrGLRenderTarget.h2
-rw-r--r--src/gpu/gl/GrGLTexture.cpp2
-rw-r--r--src/gpu/gl/GrGLTexture.h2
-rw-r--r--src/gpu/mock/GrMockTexture.h6
-rw-r--r--src/gpu/mtl/GrMtlRenderTarget.h2
-rw-r--r--src/gpu/mtl/GrMtlRenderTarget.mm2
-rw-r--r--src/gpu/mtl/GrMtlTexture.h2
-rw-r--r--src/gpu/mtl/GrMtlTexture.mm2
-rw-r--r--src/gpu/vk/GrVkRenderTarget.cpp2
-rw-r--r--src/gpu/vk/GrVkRenderTarget.h3
-rw-r--r--src/gpu/vk/GrVkTexture.cpp2
-rw-r--r--src/gpu/vk/GrVkTexture.h2
12 files changed, 29 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h
index 3da4812dff..4412dcf425 100644
--- a/src/gpu/gl/GrGLRenderTarget.h
+++ b/src/gpu/gl/GrGLRenderTarget.h
@@ -61,7 +61,9 @@ public:
}
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject getRenderTargetHandle() const override { return fRTFBOID; }
+#endif
GrBackendRenderTarget getBackendRenderTarget() const override;
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index 69b214de27..9a8dbd8f4b 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -98,9 +98,11 @@ void GrGLTexture::onAbandon() {
INHERITED::onAbandon();
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject GrGLTexture::getTextureHandle() const {
return reinterpret_cast<GrBackendObject>(&fInfo);
}
+#endif
GrBackendTexture GrGLTexture::getBackendTexture() const {
return GrBackendTexture(this->width(), this->height(), this->texturePriv().mipMapped(), fInfo);
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index 7da2bb4428..fcc85bc700 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -39,7 +39,9 @@ public:
SkASSERT(!fReleaseHelper);
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject getTextureHandle() const override;
+#endif
GrBackendTexture getBackendTexture() const override;
void textureParamsModified() override { fTexParams.invalidate(); }
diff --git a/src/gpu/mock/GrMockTexture.h b/src/gpu/mock/GrMockTexture.h
index 55dc6f3946..071b4f4615 100644
--- a/src/gpu/mock/GrMockTexture.h
+++ b/src/gpu/mock/GrMockTexture.h
@@ -31,9 +31,11 @@ public:
~GrMockTexture() override {}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject getTextureHandle() const override {
return reinterpret_cast<GrBackendObject>(&fInfo);
}
+#endif
GrBackendTexture getBackendTexture() const override {
return GrBackendTexture(this->width(), this->height(), this->texturePriv().mipMapped(),
fInfo);
@@ -118,9 +120,11 @@ public:
return {this->width(), this->height(), this->numColorSamples(), numStencilBits, fInfo};
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject getRenderTargetHandle() const override {
return reinterpret_cast<GrBackendObject>(&fInfo);
}
+#endif
protected:
// constructor for subclasses
@@ -156,7 +160,9 @@ public:
this->registerWithCacheWrapped();
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject getRenderTargetHandle() const override { return 0; }
+#endif
GrTexture* asTexture() override { return this; }
GrRenderTarget* asRenderTarget() override { return this; }
diff --git a/src/gpu/mtl/GrMtlRenderTarget.h b/src/gpu/mtl/GrMtlRenderTarget.h
index 83e7d3c240..c653952482 100644
--- a/src/gpu/mtl/GrMtlRenderTarget.h
+++ b/src/gpu/mtl/GrMtlRenderTarget.h
@@ -40,7 +40,9 @@ public:
return true;
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject getRenderTargetHandle() const override;
+#endif
GrBackendRenderTarget getBackendRenderTarget() const override {
return GrBackendRenderTarget(); // invalid
diff --git a/src/gpu/mtl/GrMtlRenderTarget.mm b/src/gpu/mtl/GrMtlRenderTarget.mm
index 12b507b801..c8060cf88c 100644
--- a/src/gpu/mtl/GrMtlRenderTarget.mm
+++ b/src/gpu/mtl/GrMtlRenderTarget.mm
@@ -63,10 +63,12 @@ GrMtlGpu* GrMtlRenderTarget::getMtlGpu() const {
return static_cast<GrMtlGpu*>(this->getGpu());
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject GrMtlRenderTarget::getRenderTargetHandle() const {
void* voidRT = (__bridge_retained void*)fRenderTexture;
return (GrBackendObject)voidRT;
}
+#endif
void GrMtlRenderTarget::onAbandon() {
fRenderTexture = nil;
diff --git a/src/gpu/mtl/GrMtlTexture.h b/src/gpu/mtl/GrMtlTexture.h
index 3433f38db0..21f5e13b19 100644
--- a/src/gpu/mtl/GrMtlTexture.h
+++ b/src/gpu/mtl/GrMtlTexture.h
@@ -26,7 +26,9 @@ public:
id<MTLTexture> mtlTexture() const { return fTexture; }
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject getTextureHandle() const override;
+#endif
GrBackendTexture getBackendTexture() const override;
void textureParamsModified() override {}
diff --git a/src/gpu/mtl/GrMtlTexture.mm b/src/gpu/mtl/GrMtlTexture.mm
index 92afe31a9a..534eb6baf7 100644
--- a/src/gpu/mtl/GrMtlTexture.mm
+++ b/src/gpu/mtl/GrMtlTexture.mm
@@ -71,10 +71,12 @@ GrMtlGpu* GrMtlTexture::getMtlGpu() const {
return static_cast<GrMtlGpu*>(this->getGpu());
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject GrMtlTexture::getTextureHandle() const {
void* voidTex = (__bridge_retained void*)fTexture;
return (GrBackendObject)voidTex;
}
+#endif
GrBackendTexture GrMtlTexture::getBackendTexture() const {
return GrBackendTexture(); // invalid
diff --git a/src/gpu/vk/GrVkRenderTarget.cpp b/src/gpu/vk/GrVkRenderTarget.cpp
index 83c3b97776..3cab94d7dc 100644
--- a/src/gpu/vk/GrVkRenderTarget.cpp
+++ b/src/gpu/vk/GrVkRenderTarget.cpp
@@ -352,12 +352,14 @@ void GrVkRenderTarget::onAbandon() {
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject GrVkRenderTarget::getRenderTargetHandle() const {
// If the render target is multisampled, we currently return the ImageInfo for the resolved
// image. If we only wrap the msaa target (currently not implemented) we should return a handle
// to that instead.
return (GrBackendObject)&fInfo;
}
+#endif
GrBackendRenderTarget GrVkRenderTarget::getBackendRenderTarget() const {
return GrBackendRenderTarget(this->width(), this->height(), this->numColorSamples(),
diff --git a/src/gpu/vk/GrVkRenderTarget.h b/src/gpu/vk/GrVkRenderTarget.h
index 64be0b78e4..ed840fc226 100644
--- a/src/gpu/vk/GrVkRenderTarget.h
+++ b/src/gpu/vk/GrVkRenderTarget.h
@@ -70,7 +70,10 @@ public:
return true;
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject getRenderTargetHandle() const override;
+#endif
+
GrBackendRenderTarget getBackendRenderTarget() const override;
void getAttachmentsDescriptor(GrVkRenderPass::AttachmentsDescriptor* desc,
diff --git a/src/gpu/vk/GrVkTexture.cpp b/src/gpu/vk/GrVkTexture.cpp
index 0b9862443c..c4393fdd36 100644
--- a/src/gpu/vk/GrVkTexture.cpp
+++ b/src/gpu/vk/GrVkTexture.cpp
@@ -161,9 +161,11 @@ void GrVkTexture::onAbandon() {
INHERITED::onAbandon();
}
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject GrVkTexture::getTextureHandle() const {
return (GrBackendObject)&fInfo;
}
+#endif
GrBackendTexture GrVkTexture::getBackendTexture() const {
return GrBackendTexture(this->width(), this->height(), fInfo, this->grVkImageLayout());
diff --git a/src/gpu/vk/GrVkTexture.h b/src/gpu/vk/GrVkTexture.h
index e37b53ebbf..79506eff9e 100644
--- a/src/gpu/vk/GrVkTexture.h
+++ b/src/gpu/vk/GrVkTexture.h
@@ -29,7 +29,9 @@ public:
~GrVkTexture() override;
+#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
GrBackendObject getTextureHandle() const override;
+#endif
GrBackendTexture getBackendTexture() const override;
void textureParamsModified() override {}