diff options
author | Samuel Pitoiset <[email protected]> | 2017-08-21 22:22:29 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-08-22 11:54:32 +0200 |
commit | 46a8c4ef811ce1b909615f29a4059e079db3b930 (patch) | |
tree | 4d25a59de0a897470b8589f275f13c845da714f3 /src/mesa/main/externalobjects.c | |
parent | 44cd9aeeec58ef2c271cc7d5b89ea5eda906e78e (diff) |
mesa: only expose EXT_memory_object functions if the ext is supported
They should not be exposed when the extension is unsupported.
Note that ARB_direct_state_access is always exposed and
EXT_semaphore is not supported at all.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/externalobjects.c')
-rw-r--r-- | src/mesa/main/externalobjects.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c index 127b2039c64..e70280c9652 100644 --- a/src/mesa/main/externalobjects.c +++ b/src/mesa/main/externalobjects.c @@ -90,6 +90,12 @@ _mesa_DeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects) memoryObjects); } + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDeleteMemoryObjectsEXT(unsupported)"); + return; + } + if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteMemoryObjectsEXT(n < 0)"); return; @@ -118,6 +124,13 @@ GLboolean GLAPIENTRY _mesa_IsMemoryObjectEXT(GLuint memoryObject) { GET_CURRENT_CONTEXT(ctx); + + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glIsMemoryObjectEXT(unsupported)"); + return GL_FALSE; + } + struct gl_memory_object *obj = _mesa_lookup_memory_object(ctx, memoryObject); @@ -134,6 +147,12 @@ _mesa_CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects) if (MESA_VERBOSE & (VERBOSE_API)) _mesa_debug(ctx, "%s(%d, %p)", func, n, memoryObjects); + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCreateMemoryObjectsEXT(unsupported)"); + return; + } + if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func); return; @@ -176,6 +195,12 @@ _mesa_MemoryObjectParameterivEXT(GLuint memoryObject, GET_CURRENT_CONTEXT(ctx); struct gl_memory_object *memObj; + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMemoryObjectParameterivEXT(unsupported)"); + return; + } + memObj = _mesa_lookup_memory_object(ctx, memoryObject); if (!memObj) return; @@ -211,6 +236,12 @@ _mesa_GetMemoryObjectParameterivEXT(GLuint memoryObject, GET_CURRENT_CONTEXT(ctx); struct gl_memory_object *memObj; + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetMemoryObjectParameterivEXT(unsupported)"); + return; + } + memObj = _mesa_lookup_memory_object(ctx, memoryObject); if (!memObj) return; @@ -268,6 +299,11 @@ texstorage_memory(GLuint dims, GLenum target, GLsizei levels, GET_CURRENT_CONTEXT(ctx); + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); + return; + } + texObj = _mesa_get_current_tex_object(ctx, target); if (!texObj) return; @@ -292,6 +328,11 @@ texstorage_memory_ms(GLuint dims, GLenum target, GLsizei samples, GET_CURRENT_CONTEXT(ctx); + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); + return; + } + texObj = _mesa_get_current_tex_object(ctx, target); if (!texObj) return; @@ -319,6 +360,11 @@ texturestorage_memory(GLuint dims, GLuint texture, GLsizei levels, GET_CURRENT_CONTEXT(ctx); + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); + return; + } + texObj = _mesa_lookup_texture(ctx, texture); if (!texObj) return; @@ -343,6 +389,11 @@ texturestorage_memory_ms(GLuint dims, GLuint texture, GLsizei samples, GET_CURRENT_CONTEXT(ctx); + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); + return; + } + texObj = _mesa_lookup_texture(ctx, texture); if (!texObj) return; |