Bug 1920748 - Add EXT_memory_object and EXT_memory_object_fd support to GLContext r=gfx-reviewers,nical
EXT_memory_object and EXT_memory_object_fd are used to import a memory object into OpenGL from POSIX file descriptor external handle. The following functions are not loaded for now, since they are available in OpenGL only - void TexStorageMem1DEXT() - void TextureStorageMem1DEXT() Differential Revision: https://phabricator.services.mozilla.com/D223369
This commit is contained in:
@@ -180,6 +180,8 @@ static const char* const sExtensionNames[] = {
|
||||
"GL_EXT_unpack_subimage",
|
||||
"GL_EXT_semaphore",
|
||||
"GL_EXT_semaphore_fd",
|
||||
"GL_EXT_memory_object",
|
||||
"GL_EXT_memory_object_fd",
|
||||
"GL_IMG_read_format",
|
||||
"GL_IMG_texture_compression_pvrtc",
|
||||
"GL_IMG_texture_npot",
|
||||
@@ -1523,6 +1525,50 @@ void GLContext::LoadMoreSymbols(const SymbolLoader& loader) {
|
||||
fnLoadForExt(symbols, EXT_semaphore_fd);
|
||||
}
|
||||
|
||||
if (IsExtensionSupported(EXT_memory_object)) {
|
||||
const SymLoadStruct symbols[] = {
|
||||
{(PRFuncPtr*)&mSymbols.fGetUnsignedBytevEXT,
|
||||
{{"glGetUnsignedBytevEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fGetUnsignedBytei_vEXT,
|
||||
{{"glGetUnsignedBytei_vEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fDeleteMemoryObjectsEXT,
|
||||
{{"glDeleteMemoryObjectsEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fIsMemoryObjectEXT, {{"glIsMemoryObjectEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fCreateMemoryObjectsEXT,
|
||||
{{"glCreateMemoryObjectsEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fMemoryObjectParameterivEXT,
|
||||
{{"glMemoryObjectParameterivEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fGetMemoryObjectParameterivEXT,
|
||||
{{"glGetMemoryObjectParameterivEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fTexStorageMem2DEXT, {{"glTexStorageMem2DEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fTexStorageMem2DMultisampleEXT,
|
||||
{{"glTexStorageMem2DMultisampleEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fTexStorageMem3DEXT, {{"glTexStorageMem3DEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fTexStorageMem3DMultisampleEXT,
|
||||
{{"glTexStorageMem3DMultisampleEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fBufferStorageMemEXT,
|
||||
{{"glBufferStorageMemEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fTextureStorageMem2DEXT,
|
||||
{{"glTextureStorageMem2DEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fTextureStorageMem2DMultisampleEXT,
|
||||
{{"glTextureStorageMem2DMultisampleEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fTextureStorageMem3DEXT,
|
||||
{{"glTextureStorageMem3DEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fTextureStorageMem3DMultisampleEXT,
|
||||
{{"glTextureStorageMem3DMultisampleEXT"}}},
|
||||
{(PRFuncPtr*)&mSymbols.fNamedBufferStorageMemEXT,
|
||||
{{"glNamedBufferStorageMemEXT"}}},
|
||||
END_SYMBOLS};
|
||||
fnLoadForExt(symbols, EXT_memory_object);
|
||||
}
|
||||
|
||||
if (IsExtensionSupported(EXT_memory_object_fd)) {
|
||||
const SymLoadStruct symbols[] = {
|
||||
{(PRFuncPtr*)&mSymbols.fImportMemoryFdEXT, {{"glImportMemoryFdEXT"}}},
|
||||
END_SYMBOLS};
|
||||
fnLoadForExt(symbols, EXT_memory_object_fd);
|
||||
}
|
||||
|
||||
// Load developer symbols, don't fail if we can't find them.
|
||||
const SymLoadStruct devSymbols[] = {CORE_SYMBOL(GetTexImage),
|
||||
CORE_SYMBOL(GetTexLevelParameteriv),
|
||||
|
||||
@@ -459,6 +459,8 @@ class GLContext : public GenericAtomicRefCounted, public SupportsWeakPtr {
|
||||
EXT_unpack_subimage,
|
||||
EXT_semaphore,
|
||||
EXT_semaphore_fd,
|
||||
EXT_memory_object,
|
||||
EXT_memory_object_fd,
|
||||
IMG_read_format,
|
||||
IMG_texture_compression_pvrtc,
|
||||
IMG_texture_npot,
|
||||
@@ -3496,6 +3498,161 @@ class GLContext : public GenericAtomicRefCounted, public SupportsWeakPtr {
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Extension EXT_memory_object
|
||||
void fGetUnsignedBytevEXT(GLenum pname, GLubyte* data) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fGetUnsignedBytevEXT(pname, data);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fGetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte* data) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fGetUnsignedBytei_vEXT(target, index, data);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fDeleteMemoryObjectsEXT(GLsizei n, const GLuint* memoryObjects) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fDeleteMemoryObjectsEXT(n, memoryObjects);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fIsMemoryObjectEXT(GLuint memoryObject) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fIsMemoryObjectEXT(memoryObject);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fCreateMemoryObjectsEXT(GLsizei n, GLuint* memoryObjects) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fCreateMemoryObjectsEXT(n, memoryObjects);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fMemoryObjectParameterivEXT(GLuint memoryObject, GLenum pname,
|
||||
const GLint* params) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fMemoryObjectParameterivEXT(memoryObject, pname, params);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fGetMemoryObjectParameterivEXT(GLuint memoryObject, GLenum pname,
|
||||
GLint* params) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fGetMemoryObjectParameterivEXT(memoryObject, pname, params);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fTexStorageMem2DEXT(GLenum target, GLsizei levels, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLuint memory,
|
||||
GLuint64 offset) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fTexStorageMem2DEXT(target, levels, internalFormat, width, height,
|
||||
memory, offset);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fTexStorageMem2DMultisampleEXT(GLenum target, GLsizei samples,
|
||||
GLenum internalFormat, GLsizei width,
|
||||
GLsizei height,
|
||||
realGLboolean fixedSampleLocations,
|
||||
GLuint memory, GLuint64 offset) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fTexStorageMem2DMultisampleEXT(target, samples, internalFormat,
|
||||
width, height, fixedSampleLocations,
|
||||
memory, offset);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fTexStorageMem3DEXT(GLenum target, GLsizei levels, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLuint memory, GLuint64 offset) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fTexStorageMem3DEXT(target, levels, internalFormat, width, height,
|
||||
depth, memory, offset);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fTexStorageMem3DMultisampleEXT(GLenum target, GLsizei samples,
|
||||
GLenum internalFormat, GLsizei width,
|
||||
GLsizei height, GLsizei depth,
|
||||
realGLboolean fixedSampleLocations,
|
||||
GLuint memory, GLuint64 offset) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fTexStorageMem3DMultisampleEXT(
|
||||
target, samples, internalFormat, width, height, depth,
|
||||
fixedSampleLocations, memory, offset);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fBufferStorageMemEXT(GLenum target, GLsizeiptr size, GLuint memory,
|
||||
GLuint64 offset) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fBufferStorageMemEXT(target, size, memory, offset);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fTextureStorageMem2DEXT(GLuint texture, GLsizei levels,
|
||||
GLenum internalFormat, GLsizei width,
|
||||
GLsizei height, GLuint memory, GLuint64 offset) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fTextureStorageMem2DEXT(texture, levels, internalFormat, width,
|
||||
height, memory, offset);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fTextureStorageMem2DMultisampleEXT(GLuint texture, GLsizei samples,
|
||||
GLenum internalFormat, GLsizei width,
|
||||
GLsizei height,
|
||||
realGLboolean fixedSampleLocations,
|
||||
GLuint memory, GLuint64 offset) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fTextureStorageMem2DMultisampleEXT(
|
||||
texture, samples, internalFormat, width, height, fixedSampleLocations,
|
||||
memory, offset);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fTextureStorageMem3DEXT(GLuint texture, GLsizei levels,
|
||||
GLenum internalFormat, GLsizei width,
|
||||
GLsizei height, GLsizei depth, GLuint memory,
|
||||
GLuint64 offset) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fTextureStorageMem3DEXT(texture, levels, internalFormat, width,
|
||||
height, depth, memory, offset);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fTextureStorageMem3DMultisampleEXT(GLuint texture, GLsizei samples,
|
||||
GLenum internalFormat, GLsizei width,
|
||||
GLsizei height, GLsizei depth,
|
||||
realGLboolean fixedSampleLocations,
|
||||
GLuint memory, GLuint64 offset) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fTextureStorageMem3DMultisampleEXT(
|
||||
texture, samples, internalFormat, width, height, depth,
|
||||
fixedSampleLocations, memory, offset);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fNamedBufferStorageMemEXT(GLuint buffer, GLsizeiptr size, GLuint memory,
|
||||
GLuint64 offset) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fNamedBufferStorageMemEXT(buffer, size, memory, offset);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Extension EXT_memory_object_fd
|
||||
|
||||
void fImportMemoryFdEXT(GLuint memory, GLuint64 size, GLenum handleType,
|
||||
GLint fd) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fImportMemoryFdEXT(memory, size, handleType, fd);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
// -
|
||||
|
||||
#undef BEFORE_GL_CALL
|
||||
|
||||
@@ -474,6 +474,45 @@ struct GLContextSymbols final {
|
||||
|
||||
// GL_EXT_semaphore_fd
|
||||
void(GLAPIENTRY* fImportSemaphoreFdEXT)(GLuint, GLenum, GLint);
|
||||
|
||||
// EXT_memory_object
|
||||
void(GLAPIENTRY* fGetUnsignedBytevEXT)(GLenum, GLubyte*);
|
||||
void(GLAPIENTRY* fGetUnsignedBytei_vEXT)(GLenum, GLuint, GLubyte*);
|
||||
void(GLAPIENTRY* fDeleteMemoryObjectsEXT)(GLsizei, const GLuint*);
|
||||
void(GLAPIENTRY* fIsMemoryObjectEXT)(GLuint);
|
||||
void(GLAPIENTRY* fCreateMemoryObjectsEXT)(GLsizei, GLuint*);
|
||||
void(GLAPIENTRY* fMemoryObjectParameterivEXT)(GLuint, GLenum, const GLint*);
|
||||
void(GLAPIENTRY* fGetMemoryObjectParameterivEXT)(GLuint, GLenum, GLint*);
|
||||
void(GLAPIENTRY* fTexStorageMem2DEXT)(GLenum, GLsizei, GLenum, GLsizei,
|
||||
GLsizei, GLuint, GLuint64);
|
||||
void(GLAPIENTRY* fTexStorageMem2DMultisampleEXT)(GLenum, GLsizei, GLenum,
|
||||
GLsizei, GLsizei,
|
||||
realGLboolean, GLuint,
|
||||
GLuint64);
|
||||
void(GLAPIENTRY* fTexStorageMem3DEXT)(GLenum, GLsizei, GLenum, GLsizei,
|
||||
GLsizei, GLsizei, GLuint, GLuint64);
|
||||
void(GLAPIENTRY* fTexStorageMem3DMultisampleEXT)(GLenum, GLsizei, GLenum,
|
||||
GLsizei, GLsizei, GLsizei,
|
||||
realGLboolean, GLuint,
|
||||
GLuint64);
|
||||
void(GLAPIENTRY* fBufferStorageMemEXT)(GLenum, GLsizeiptr, GLuint, GLuint64);
|
||||
void(GLAPIENTRY* fTextureStorageMem2DEXT)(GLuint, GLsizei, GLenum, GLsizei,
|
||||
GLsizei, GLuint, GLuint64);
|
||||
void(GLAPIENTRY* fTextureStorageMem2DMultisampleEXT)(GLuint, GLsizei, GLenum,
|
||||
GLsizei, GLsizei,
|
||||
realGLboolean, GLuint,
|
||||
GLuint64);
|
||||
void(GLAPIENTRY* fTextureStorageMem3DEXT)(GLuint, GLsizei, GLenum, GLsizei,
|
||||
GLsizei, GLsizei, GLuint, GLuint64);
|
||||
void(GLAPIENTRY* fTextureStorageMem3DMultisampleEXT)(GLuint, GLsizei, GLenum,
|
||||
GLsizei, GLsizei,
|
||||
GLsizei, realGLboolean,
|
||||
GLuint, GLuint64);
|
||||
void(GLAPIENTRY* fNamedBufferStorageMemEXT)(GLuint, GLsizeiptr, GLuint,
|
||||
GLuint64);
|
||||
|
||||
// EXT_memory_object_fd
|
||||
void(GLAPIENTRY* fImportMemoryFdEXT)(GLuint, GLuint64, GLenum, GLint);
|
||||
};
|
||||
|
||||
} // namespace gl
|
||||
|
||||
Reference in New Issue
Block a user