diff options
-rw-r--r-- | src/mesa/main/bufferobj.c | 21 | ||||
-rw-r--r-- | src/mesa/main/externalobjects.c | 51 | ||||
-rw-r--r-- | src/mesa/main/get.c | 10 |
3 files changed, 75 insertions, 7 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index cff1905e162..099648f4198 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1873,13 +1873,20 @@ inlined_buffer_storage(GLenum target, GLuint buffer, GLsizeiptr size, struct gl_memory_object *memObj = NULL; if (mem) { - /* From the EXT_external_objects spec: - * - * "An INVALID_VALUE error is generated by BufferStorageMemEXT and - * NamedBufferStorageMemEXT if <memory> is 0, or ..." - */ - if (!no_error && memory == 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "%s(memory == 0)", func); + if (!no_error) { + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); + return; + } + + /* From the EXT_external_objects spec: + * + * "An INVALID_VALUE error is generated by BufferStorageMemEXT and + * NamedBufferStorageMemEXT if <memory> is 0, or ..." + */ + if (memory == 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s(memory == 0)", func); + } } memObj = _mesa_lookup_memory_object(ctx, memory); 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; diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 93dd927bb01..8c3958b0965 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -2033,6 +2033,11 @@ _mesa_GetUnsignedBytevEXT(GLenum pname, GLubyte *data) GET_CURRENT_CONTEXT(ctx); + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); + return; + } + d = find_value(func, pname, &p, &v); size = get_value_size(d->type, &v); if (size >= 0) { @@ -2812,6 +2817,11 @@ _mesa_GetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte *data) GET_CURRENT_CONTEXT(ctx); + if (!ctx->Extensions.EXT_memory_object) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func); + return; + } + type = find_value_indexed(func, target, index, &v); size = get_value_size(type, &v); if (size <= 0) { |