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 <samuel.pitoiset@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
44cd9aeeec
commit
46a8c4ef81
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue