summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/externalobjects.h
diff options
context:
space:
mode:
authorAndres Rodriguez <[email protected]>2017-07-12 18:45:07 -0400
committerTimothy Arceri <[email protected]>2017-08-06 12:42:06 +1000
commit8b7c5744791fe403375dd1d61c4a99b882044415 (patch)
treeec5728914a1f98d8d55c9919d304f479e225481e /src/mesa/main/externalobjects.h
parent322ee1b3636a38c22bc65009f13667a9d5f438cf (diff)
mesa: add support for memory object creation/import/delete
Used by EXT_external_objects and EXT_external_objects_fd V2 (Timothy Arceri): - Throw GL_OUT_OF_MEMORY error if CreateMemoryObjectsEXT() fails. - C99 tidy ups - remove void cast (Constantine Kharlamov) V3 (Timothy Arceri): - rename mo -> memObj - check that the object is not NULL before initializing - add missing "EXT" in function error message V4 (Timothy Arceri): - remove checks for (memory objecy id == 0) and catch in _mesa_lookup_memory_object() instead. Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/mesa/main/externalobjects.h')
-rw-r--r--src/mesa/main/externalobjects.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mesa/main/externalobjects.h b/src/mesa/main/externalobjects.h
index f70be8e8ab9..a9a12b821f7 100644
--- a/src/mesa/main/externalobjects.h
+++ b/src/mesa/main/externalobjects.h
@@ -35,6 +35,37 @@
#define EXTERNALOBJECTS_H
#include "glheader.h"
+#include "hash.h"
+
+static inline struct gl_memory_object *
+_mesa_lookup_memory_object(struct gl_context *ctx, GLuint memory)
+{
+ if (!memory)
+ return NULL;
+
+ return (struct gl_memory_object *)
+ _mesa_HashLookup(ctx->Shared->MemoryObjects, memory);
+}
+
+static inline struct gl_memory_object *
+_mesa_lookup_memory_object_locked(struct gl_context *ctx, GLuint memory)
+{
+ if (!memory)
+ return NULL;
+
+ return (struct gl_memory_object *)
+ _mesa_HashLookupLocked(ctx->Shared->MemoryObjects, memory);
+}
+
+extern void
+_mesa_init_memory_object_functions(struct dd_function_table *driver);
+
+extern void
+_mesa_initialize_memory_object(struct gl_context *ctx,
+ struct gl_memory_object *obj,
+ GLuint name);
+extern void
+_mesa_delete_memory_object(struct gl_context *ctx, struct gl_memory_object *mo);
extern void GLAPIENTRY
_mesa_DeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects);