aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLGpu.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-04-10 09:34:07 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-10 14:20:22 +0000
commit52e16d984898f18c84de773507da875a7954b922 (patch)
tree61dc6aaa14903f6b8c2e7e55d5d40c136e653354 /src/gpu/gl/GrGLGpu.cpp
parent58627cb8eb559670b86f06225eb87e6c1c5e8504 (diff)
Update getBackendInfo calls on GrBackendTexture to support VkImageLayout better.
The big api level change here is that the getBackendInfo calls now return by value instead of a pointer. These changes are being made in support of Vulkan so that the client can update the VkImageLayout on the GrBackendTexture and have that update get reflected in our internal tracking of the image. This is done by storing a ref counted GrVkImageLayout object on the GrBackendTexture and the GrVkImage. Bug: skia: Change-Id: I8c6158fd3a66eb61fef97ebf09ea5364bca3f1ae Reviewed-on: https://skia-review.googlesource.com/119101 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/gl/GrGLGpu.cpp')
-rw-r--r--src/gpu/gl/GrGLGpu.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 08bca6dcc8..c9cd494233 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -497,12 +497,12 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
static bool check_backend_texture(const GrBackendTexture& backendTex, const GrGLCaps& caps,
GrGLTexture::IDDesc* idDesc) {
- const GrGLTextureInfo* info = backendTex.getGLTextureInfo();
- if (!info || !info->fID) {
+ GrGLTextureInfo info;
+ if (!backendTex.getGLTextureInfo(&info) || !info.fID) {
return false;
}
- idDesc->fInfo = *info;
+ idDesc->fInfo = info;
if (GR_GL_TEXTURE_EXTERNAL == idDesc->fInfo.fTarget) {
if (!caps.shaderCaps()->externalTextureSupport()) {
@@ -618,16 +618,13 @@ sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTa
sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
int sampleCnt) {
- const GrGLTextureInfo* info = tex.getGLTextureInfo();
- if (!info || !info->fID) {
+ GrGLTextureInfo info;
+ if (!tex.getGLTextureInfo(&info) || !info.fID) {
return nullptr;
}
- GrGLTextureInfo texInfo;
- texInfo = *info;
-
- if (GR_GL_TEXTURE_RECTANGLE != texInfo.fTarget &&
- GR_GL_TEXTURE_2D != texInfo.fTarget) {
+ if (GR_GL_TEXTURE_RECTANGLE != info.fTarget &&
+ GR_GL_TEXTURE_2D != info.fTarget) {
// Only texture rectangle and texture 2d are supported. We do not check whether texture
// rectangle is supported by Skia - if the caller provided us with a texture rectangle,
// we assume the necessary support exists.
@@ -642,7 +639,7 @@ sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBacken
surfDesc.fSampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, tex.config());
GrGLRenderTarget::IDDesc rtIDDesc;
- if (!this->createRenderTargetObjects(surfDesc, texInfo, &rtIDDesc)) {
+ if (!this->createRenderTargetObjects(surfDesc, info, &rtIDDesc)) {
return nullptr;
}
return GrGLRenderTarget::MakeWrapped(this, surfDesc, rtIDDesc, 0);
@@ -4413,13 +4410,13 @@ GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(const void* pixels, in
bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
SkASSERT(kOpenGL_GrBackend == tex.backend());
- const GrGLTextureInfo* info = tex.getGLTextureInfo();
- if (!info) {
+ GrGLTextureInfo info;
+ if (!tex.getGLTextureInfo(&info)) {
return false;
}
GrGLboolean result;
- GL_CALL_RET(result, IsTexture(info->fID));
+ GL_CALL_RET(result, IsTexture(info.fID));
return (GR_GL_TRUE == result);
}
@@ -4427,8 +4424,9 @@ bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
void GrGLGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
SkASSERT(kOpenGL_GrBackend == tex.backend());
- if (const auto* info = tex.getGLTextureInfo()) {
- GL_CALL(DeleteTextures(1, &info->fID));
+ GrGLTextureInfo info;
+ if (tex.getGLTextureInfo(&info)) {
+ GL_CALL(DeleteTextures(1, &info.fID));
}
}