summaryrefslogtreecommitdiff
path: root/libs/hwui/AutoBackendTextureRelease.cpp
diff options
context:
space:
mode:
author Kevin Lubick <kjlubick@google.com> 2023-08-07 15:29:12 +0000
committer Kevin Lubick <kjlubick@google.com> 2023-08-11 14:51:56 +0000
commit60d0686e5326be7df1a735c868b7d76961324607 (patch)
tree324f51358981dbf0e239b821147bf9e87b897ea8 /libs/hwui/AutoBackendTextureRelease.cpp
parentb819673da1c2737c934654fb4ba4a349c7aaa558 (diff)
[base] Migrate deprecated GL GrSurfaceBackend related functions
Skia-side changes: - https://skia-review.googlesource.com/c/skia/+/735976 - https://skia-review.googlesource.com/c/skia/+/701398 Change-Id: Ia3aca705a022b334081e993bdd1aa185c5eaa3aa
Diffstat (limited to 'libs/hwui/AutoBackendTextureRelease.cpp')
-rw-r--r--libs/hwui/AutoBackendTextureRelease.cpp42
1 files changed, 37 insertions, 5 deletions
diff --git a/libs/hwui/AutoBackendTextureRelease.cpp b/libs/hwui/AutoBackendTextureRelease.cpp
index d237cc261b53..fcb1bfeae6b5 100644
--- a/libs/hwui/AutoBackendTextureRelease.cpp
+++ b/libs/hwui/AutoBackendTextureRelease.cpp
@@ -35,15 +35,47 @@ AutoBackendTextureRelease::AutoBackendTextureRelease(GrDirectContext* context,
AHardwareBuffer_Desc desc;
AHardwareBuffer_describe(buffer, &desc);
bool createProtectedImage = 0 != (desc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT);
- GrBackendFormat backendFormat =
- GrAHardwareBufferUtils::GetBackendFormat(context, buffer, desc.format, false);
+
+ GrBackendFormat backendFormat;
+ GrBackendApi backend = context->backend();
+ if (backend == GrBackendApi::kOpenGL) {
+ backendFormat =
+ GrAHardwareBufferUtils::GetGLBackendFormat(context, desc.format, false);
+ mBackendTexture =
+ GrAHardwareBufferUtils::MakeGLBackendTexture(context,
+ buffer,
+ desc.width,
+ desc.height,
+ &mDeleteProc,
+ &mUpdateProc,
+ &mImageCtx,
+ createProtectedImage,
+ backendFormat,
+ false);
+ } else if (backend == GrBackendApi::kVulkan) {
+ backendFormat =
+ GrAHardwareBufferUtils::GetVulkanBackendFormat(context,
+ buffer,
+ desc.format,
+ false);
+ mBackendTexture =
+ GrAHardwareBufferUtils::MakeVulkanBackendTexture(context,
+ buffer,
+ desc.width,
+ desc.height,
+ &mDeleteProc,
+ &mUpdateProc,
+ &mImageCtx,
+ createProtectedImage,
+ backendFormat,
+ false);
+ } else {
+ LOG_ALWAYS_FATAL("Unexpected backend %d", backend);
+ }
LOG_ALWAYS_FATAL_IF(!backendFormat.isValid(),
__FILE__ " Invalid GrBackendFormat. GrBackendApi==%" PRIu32
", AHardwareBuffer_Format==%" PRIu32 ".",
static_cast<int>(context->backend()), desc.format);
- mBackendTexture = GrAHardwareBufferUtils::MakeBackendTexture(
- context, buffer, desc.width, desc.height, &mDeleteProc, &mUpdateProc, &mImageCtx,
- createProtectedImage, backendFormat, false);
LOG_ALWAYS_FATAL_IF(!mBackendTexture.isValid(),
__FILE__ " Invalid GrBackendTexture. Width==%" PRIu32 ", height==%" PRIu32
", protected==%d",