diff options
author | Andres Rodriguez <[email protected]> | 2017-07-12 18:45:08 -0400 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-08-06 12:42:06 +1000 |
commit | 1e8e4ee230af2484d6aa22dfcc99ed4354f5842e (patch) | |
tree | cfb0f470322a396ae0f0b4798c8e51104135a12a /src/mesa/main/externalobjects.c | |
parent | 8b7c5744791fe403375dd1d61c4a99b882044415 (diff) |
mesa: add support for memory object parameters
V2 (Timothy Arceri):
- fix copy and paste error with error message
V3 (Timothy Arceri):
- drop the Protected field for now as its unused
Signed-off-by: Andres Rodriguez <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/mesa/main/externalobjects.c')
-rw-r--r-- | src/mesa/main/externalobjects.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c index 6c5b07d110e..9241fe1fe6a 100644 --- a/src/mesa/main/externalobjects.c +++ b/src/mesa/main/externalobjects.c @@ -73,6 +73,7 @@ _mesa_initialize_memory_object(struct gl_context *ctx, { memset(obj, 0, sizeof(struct gl_memory_object)); obj->Name = name; + obj->Dedicated = GL_FALSE; } void GLAPIENTRY @@ -168,7 +169,34 @@ _mesa_MemoryObjectParameterivEXT(GLuint memoryObject, GLenum pname, const GLint *params) { + GET_CURRENT_CONTEXT(ctx); + struct gl_memory_object *memObj; + + memObj = _mesa_lookup_memory_object(ctx, memoryObject); + if (!memObj) + return; + if (memObj->Immutable) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMemoryObjectParameterivEXT(memoryObject is immutable"); + return; + } + + switch (pname) { + case GL_DEDICATED_MEMORY_OBJECT_EXT: + memObj->Dedicated = (GLboolean) params[0]; + break; + case GL_PROTECTED_MEMORY_OBJECT_EXT: + /* EXT_protected_textures not supported */ + goto invalid_pname; + default: + goto invalid_pname; + } + return; + +invalid_pname: + _mesa_error(ctx, GL_INVALID_ENUM, + "glMemoryObjectParameterivEXT(pname=0x%x)", pname); } void GLAPIENTRY @@ -176,7 +204,28 @@ _mesa_GetMemoryObjectParameterivEXT(GLuint memoryObject, GLenum pname, GLint *params) { + GET_CURRENT_CONTEXT(ctx); + struct gl_memory_object *memObj; + + memObj = _mesa_lookup_memory_object(ctx, memoryObject); + if (!memObj) + return; + + switch (pname) { + case GL_DEDICATED_MEMORY_OBJECT_EXT: + *params = (GLint) memObj->Dedicated; + break; + case GL_PROTECTED_MEMORY_OBJECT_EXT: + /* EXT_protected_textures not supported */ + goto invalid_pname; + default: + goto invalid_pname; + } + return; +invalid_pname: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetMemoryObjectParameterivEXT(pname=0x%x)", pname); } void GLAPIENTRY @@ -380,6 +429,7 @@ _mesa_ImportMemoryFdEXT(GLuint memory, return; ctx->Driver.ImportMemoryObjectFd(ctx, memObj, size, fd); + memObj->Immutable = GL_TRUE; } void GLAPIENTRY |