aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2016-10-25 10:44:02 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-26 00:43:29 +0000
commit18b61f9cb9d0bea03dc4f69f63f53ad44f171526 (patch)
treeb9f92fd29c7dfe69e7b578ce49c2a1d15846c7cb
parent8a4e9c51f4ef57f9a1d5d128e778657d96f14e53 (diff)
Remove SK_IGNORE_GL_TEXTURE_TARGET.
This code was added with "Use a struct for client GL texture handles" https://codereview.chromium.org/1429863009. This define no longer appears to be set anywhere, so it and the code it guards can be removed. Change-Id: I80bb2a77b1f076143851c1d112937221eff2111a Reviewed-on: https://skia-review.googlesource.com/3902 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
-rw-r--r--src/gpu/gl/GrGLGpu.cpp63
-rw-r--r--src/gpu/gl/GrGLTexture.cpp4
2 files changed, 6 insertions, 61 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 6b534a01bb..1e8049727b 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -25,6 +25,7 @@
#include "glsl/GrGLSLCaps.h"
#include "glsl/GrGLSLPLSPathRendering.h"
#include "instanced/GLInstancedRendering.h"
+#include "SkMakeUnique.h"
#include "SkMipMap.h"
#include "SkPixmap.h"
#include "SkStrokeRec.h"
@@ -625,33 +626,16 @@ static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget)
GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
GrWrapOwnership ownership) {
-#ifdef SK_IGNORE_GL_TEXTURE_TARGET
- if (!desc.fTextureHandle) {
- return nullptr;
- }
-#else
const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(desc.fTextureHandle);
if (!info || !info->fID) {
return nullptr;
}
-#endif
// next line relies on GrBackendTextureDesc's flags matching GrTexture's
bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFlag);
GrGLTexture::IDDesc idDesc;
- GrSurfaceDesc surfDesc;
-
-#ifdef SK_IGNORE_GL_TEXTURE_TARGET
- idDesc.fInfo.fID = static_cast<GrGLuint>(desc.fTextureHandle);
- // When we create the texture, we only
- // create GL_TEXTURE_2D at the moment.
- // External clients can do something different.
-
- idDesc.fInfo.fTarget = GR_GL_TEXTURE_2D;
-#else
idDesc.fInfo = *info;
-#endif
if (GR_GL_TEXTURE_EXTERNAL == idDesc.fInfo.fTarget) {
if (renderTarget) {
@@ -681,6 +665,7 @@ GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
idDesc.fOwnership = GrBackendObjectOwnership::kBorrowed;
}
+ GrSurfaceDesc surfDesc;
surfDesc.fFlags = (GrSurfaceFlags) desc.fFlags;
surfDesc.fWidth = desc.fWidth;
surfDesc.fHeight = desc.fHeight;
@@ -738,27 +723,13 @@ GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe
}
GrRenderTarget* GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& desc) {
-#ifdef SK_IGNORE_GL_TEXTURE_TARGET
- if (!desc.fTextureHandle) {
- return nullptr;
- }
-#else
const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(desc.fTextureHandle);
if (!info || !info->fID) {
return nullptr;
}
-#endif
GrGLTextureInfo texInfo;
- GrSurfaceDesc surfDesc;
-
-#ifdef SK_IGNORE_GL_TEXTURE_TARGET
- texInfo.fID = static_cast<GrGLuint>(desc.fTextureHandle);
- // We only support GL_TEXTURE_2D at the moment.
- texInfo.fTarget = GR_GL_TEXTURE_2D;
-#else
texInfo = *info;
-#endif
if (GR_GL_TEXTURE_RECTANGLE != texInfo.fTarget &&
GR_GL_TEXTURE_2D != texInfo.fTarget) {
@@ -768,6 +739,7 @@ GrRenderTarget* GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTextu
return nullptr;
}
+ GrSurfaceDesc surfDesc;
surfDesc.fFlags = (GrSurfaceFlags) desc.fFlags;
surfDesc.fWidth = desc.fWidth;
surfDesc.fHeight = desc.fHeight;
@@ -4576,7 +4548,7 @@ GrBackendObject GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, in
if (!this->caps()->isConfigTexturable(config)) {
return false;
}
- GrGLTextureInfo* info = new GrGLTextureInfo;
+ std::unique_ptr<GrGLTextureInfo> info = skstd::make_unique<GrGLTextureInfo>();
info->fTarget = GR_GL_TEXTURE_2D;
info->fID = 0;
GL_CALL(GenTextures(1, &info->fID));
@@ -4595,32 +4567,17 @@ GrBackendObject GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, in
if (!this->glCaps().getTexImageFormats(config, config, &internalFormat, &externalFormat,
&externalType)) {
- delete info;
-#ifdef SK_IGNORE_GL_TEXTURE_TARGET
- return 0;
-#else
return reinterpret_cast<GrBackendObject>(nullptr);
-#endif
}
GL_CALL(TexImage2D(info->fTarget, 0, internalFormat, w, h, 0, externalFormat,
externalType, pixels));
-#ifdef SK_IGNORE_GL_TEXTURE_TARGET
- GrGLuint id = info->fID;
- delete info;
- return id;
-#else
- return reinterpret_cast<GrBackendObject>(info);
-#endif
+ return reinterpret_cast<GrBackendObject>(info.release());
}
bool GrGLGpu::isTestingOnlyBackendTexture(GrBackendObject id) const {
-#ifdef SK_IGNORE_GL_TEXTURE_TARGET
- GrGLuint texID = (GrGLuint)id;
-#else
GrGLuint texID = reinterpret_cast<const GrGLTextureInfo*>(id)->fID;
-#endif
GrGLboolean result;
GL_CALL_RET(result, IsTexture(texID));
@@ -4629,20 +4586,12 @@ bool GrGLGpu::isTestingOnlyBackendTexture(GrBackendObject id) const {
}
void GrGLGpu::deleteTestingOnlyBackendTexture(GrBackendObject id, bool abandonTexture) {
-#ifdef SK_IGNORE_GL_TEXTURE_TARGET
- GrGLuint texID = (GrGLuint)id;
-#else
- const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(id);
+ std::unique_ptr<const GrGLTextureInfo> info(reinterpret_cast<const GrGLTextureInfo*>(id));
GrGLuint texID = info->fID;
-#endif
if (!abandonTexture) {
GL_CALL(DeleteTextures(1, &texID));
}
-
-#ifndef SK_IGNORE_GL_TEXTURE_TARGET
- delete info;
-#endif
}
void GrGLGpu::resetShaderCacheForTesting() const {
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index 9fd9ad8783..ed753472a8 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -81,11 +81,7 @@ void GrGLTexture::onAbandon() {
}
GrBackendObject GrGLTexture::getTextureHandle() const {
-#ifdef SK_IGNORE_GL_TEXTURE_TARGET
- return static_cast<GrBackendObject>(this->textureID());
-#else
return reinterpret_cast<GrBackendObject>(&fInfo);
-#endif
}
void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,