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;
|
struct gl_memory_object *memObj = NULL;
|
||||||
|
|
||||||
if (mem) {
|
if (mem) {
|
||||||
/* From the EXT_external_objects spec:
|
if (!no_error) {
|
||||||
*
|
if (!ctx->Extensions.EXT_memory_object) {
|
||||||
* "An INVALID_VALUE error is generated by BufferStorageMemEXT and
|
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
|
||||||
* NamedBufferStorageMemEXT if <memory> is 0, or ..."
|
return;
|
||||||
*/
|
}
|
||||||
if (!no_error && memory == 0) {
|
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "%s(memory == 0)", func);
|
/* 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);
|
memObj = _mesa_lookup_memory_object(ctx, memory);
|
||||||
|
|
|
@ -90,6 +90,12 @@ _mesa_DeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects)
|
||||||
memoryObjects);
|
memoryObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ctx->Extensions.EXT_memory_object) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
|
"glDeleteMemoryObjectsEXT(unsupported)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glDeleteMemoryObjectsEXT(n < 0)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glDeleteMemoryObjectsEXT(n < 0)");
|
||||||
return;
|
return;
|
||||||
|
@ -118,6 +124,13 @@ GLboolean GLAPIENTRY
|
||||||
_mesa_IsMemoryObjectEXT(GLuint memoryObject)
|
_mesa_IsMemoryObjectEXT(GLuint memoryObject)
|
||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
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 =
|
struct gl_memory_object *obj =
|
||||||
_mesa_lookup_memory_object(ctx, memoryObject);
|
_mesa_lookup_memory_object(ctx, memoryObject);
|
||||||
|
|
||||||
|
@ -134,6 +147,12 @@ _mesa_CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects)
|
||||||
if (MESA_VERBOSE & (VERBOSE_API))
|
if (MESA_VERBOSE & (VERBOSE_API))
|
||||||
_mesa_debug(ctx, "%s(%d, %p)", func, n, memoryObjects);
|
_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) {
|
if (n < 0) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func);
|
_mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func);
|
||||||
return;
|
return;
|
||||||
|
@ -176,6 +195,12 @@ _mesa_MemoryObjectParameterivEXT(GLuint memoryObject,
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
struct gl_memory_object *memObj;
|
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);
|
memObj = _mesa_lookup_memory_object(ctx, memoryObject);
|
||||||
if (!memObj)
|
if (!memObj)
|
||||||
return;
|
return;
|
||||||
|
@ -211,6 +236,12 @@ _mesa_GetMemoryObjectParameterivEXT(GLuint memoryObject,
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
struct gl_memory_object *memObj;
|
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);
|
memObj = _mesa_lookup_memory_object(ctx, memoryObject);
|
||||||
if (!memObj)
|
if (!memObj)
|
||||||
return;
|
return;
|
||||||
|
@ -268,6 +299,11 @@ texstorage_memory(GLuint dims, GLenum target, GLsizei levels,
|
||||||
|
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
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);
|
texObj = _mesa_get_current_tex_object(ctx, target);
|
||||||
if (!texObj)
|
if (!texObj)
|
||||||
return;
|
return;
|
||||||
|
@ -292,6 +328,11 @@ texstorage_memory_ms(GLuint dims, GLenum target, GLsizei samples,
|
||||||
|
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
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);
|
texObj = _mesa_get_current_tex_object(ctx, target);
|
||||||
if (!texObj)
|
if (!texObj)
|
||||||
return;
|
return;
|
||||||
|
@ -319,6 +360,11 @@ texturestorage_memory(GLuint dims, GLuint texture, GLsizei levels,
|
||||||
|
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
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);
|
texObj = _mesa_lookup_texture(ctx, texture);
|
||||||
if (!texObj)
|
if (!texObj)
|
||||||
return;
|
return;
|
||||||
|
@ -343,6 +389,11 @@ texturestorage_memory_ms(GLuint dims, GLuint texture, GLsizei samples,
|
||||||
|
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
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);
|
texObj = _mesa_lookup_texture(ctx, texture);
|
||||||
if (!texObj)
|
if (!texObj)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2033,6 +2033,11 @@ _mesa_GetUnsignedBytevEXT(GLenum pname, GLubyte *data)
|
||||||
|
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
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);
|
d = find_value(func, pname, &p, &v);
|
||||||
size = get_value_size(d->type, &v);
|
size = get_value_size(d->type, &v);
|
||||||
if (size >= 0) {
|
if (size >= 0) {
|
||||||
|
@ -2812,6 +2817,11 @@ _mesa_GetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte *data)
|
||||||
|
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
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);
|
type = find_value_indexed(func, target, index, &v);
|
||||||
size = get_value_size(type, &v);
|
size = get_value_size(type, &v);
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
|
|
Loading…
Reference in New Issue