Create and plumb SkiaBackendTexture abstraction layer over GrBackendTexture
This means AutoBackendTexture is not aware of backend-specific texture
type and API details, and will be able to accept either a Ganesh or
Graphite variant of SkiaBackendTexture.
Also delegated SkiaBackendTexture creation to SkiaGpuContext, so that
backend-specific contexts handle creating backend-specifc textures.
Test: manual validation (GL+VK) & existing tests (refactor)
Bug: b/293371537
Change-Id: Ia65306cc825b71fe0b89c7f8545ce1c71a81d86b
diff --git a/libs/renderengine/skia/compat/GaneshGpuContext.cpp b/libs/renderengine/skia/compat/GaneshGpuContext.cpp
index 51c6a6c..87f00e4 100644
--- a/libs/renderengine/skia/compat/GaneshGpuContext.cpp
+++ b/libs/renderengine/skia/compat/GaneshGpuContext.cpp
@@ -27,8 +27,13 @@
#include <include/gpu/gl/GrGLInterface.h>
#include <include/gpu/vk/GrVkBackendContext.h>
+#include "../AutoBackendTexture.h"
+#include "GaneshBackendTexture.h"
+#include "skia/compat/SkiaBackendTexture.h"
+
#include <android-base/macros.h>
#include <log/log_main.h>
+#include <memory>
namespace android::renderengine::skia {
@@ -66,6 +71,11 @@
return mGrContext;
}
+std::unique_ptr<SkiaBackendTexture> GaneshGpuContext::makeBackendTexture(AHardwareBuffer* buffer,
+ bool isOutputBuffer) {
+ return std::make_unique<GaneshBackendTexture>(mGrContext, buffer, isOutputBuffer);
+}
+
sk_sp<SkSurface> GaneshGpuContext::createRenderTarget(SkImageInfo imageInfo) {
constexpr int kSampleCount = 1; // enable AA
constexpr SkSurfaceProps* kProps = nullptr;