aboutsummaryrefslogtreecommitdiff
path: root/src/gpu/GrAHardwareBufferUtils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrAHardwareBufferUtils.h')
-rw-r--r--src/gpu/GrAHardwareBufferUtils.h39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/gpu/GrAHardwareBufferUtils.h b/src/gpu/GrAHardwareBufferUtils.h
index 31cb1407a5..8e637452df 100644
--- a/src/gpu/GrAHardwareBufferUtils.h
+++ b/src/gpu/GrAHardwareBufferUtils.h
@@ -27,13 +27,46 @@ SkColorType GetSkColorTypeFromBufferFormat(uint32_t bufferFormat);
GrBackendFormat GetBackendFormat(GrContext* context, AHardwareBuffer* hardwareBuffer,
uint32_t bufferFormat, bool requireKnownFormat);
-typedef void* DeleteImageCtx;
-typedef void (*DeleteImageProc)(DeleteImageCtx);
+typedef void* TexImageCtx;
+typedef void (*DeleteImageProc)(TexImageCtx);
+typedef void (*UpdateImageProc)(TexImageCtx, GrContext*);
+//TODO: delete this function after clients stop using it.
GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwareBuffer,
int width, int height,
DeleteImageProc* deleteProc,
- DeleteImageCtx* deleteCtx,
+ TexImageCtx* imageCtx,
+ bool isProtectedContent,
+ const GrBackendFormat& backendFormat,
+ bool isRenderable);
+
+/**
+ * Create a GrBackendTexture from AHardwareBuffer
+ *
+ * @param context GPU context
+ * @param hardwareBuffer AHB
+ * @param width texture width
+ * @param height texture height
+ * @param deleteProc returns a function that deletes the texture and
+ * other GPU resources. Must be invoked on the same
+ * thread as MakeBackendTexture
+ * @param updateProc returns a function, that needs to be invoked, when
+ * AHB buffer content has changed. Must be invoked on
+ * the same thread as MakeBackendTexture
+ * @param imageCtx returns an opaque image context, that is passed as
+ * first argument to deleteProc and updateProc
+ * @param isProtectedContent if true, GL backend uses EXT_protected_content
+ * @param backendFormat backend format, usually created with helper
+ * function GetBackendFormat
+ * @param isRenderable true if GrBackendTexture can be used as a color
+ * attachment
+ * @return valid GrBackendTexture object on success
+ */
+GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwareBuffer,
+ int width, int height,
+ DeleteImageProc* deleteProc,
+ UpdateImageProc* updateProc,
+ TexImageCtx* imageCtx,
bool isProtectedContent,
const GrBackendFormat& backendFormat,
bool isRenderable);