I am currently trying to share a preallocated d3d12 vertex buffer and make it available in opengl using the opengl extension GL_EXT_memory_object and GL_EXT_memory_object_win32
https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_external_objects.txt https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_external_objects_win32.txt
The following code snippet works on my NVIDIA machine:
HANDLE sharedHandle = 0;
d3dclass.m_device->CreateSharedHandle(d3dclass.m_vertexBuffer.Get(), nullptr, GENERIC_ALL, 0, &sharedHandle);
GLuint memObject;
glCreateMemoryObjectsEXT(1, &memObject);
glImportMemoryWin32HandleEXT(memObject, sizeof(vertices), GL_HANDLE_TYPE_D3D12_RESOURCE_EXT, sharedHandle);
glGenBuffers(1, &m_vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer);
glBufferStorageMemEXT(GL_ARRAY_BUFFER, sizeof(vertices), memObject, 0);
However on my AMD machine (Windows 10 64 Bit, AMD Radeon RX 480 drivers 20.45.01.28) I get an gl error 0x0500 (Invalid enum) when calling glImportMemoryWin32HandleEXT(..). The call to CreateSharedHandle returns 0x0 (S_OK) so the shared handle should be valid.
I also tried to access the vertex buffer by name using glImportMemoryWin32NameEXT - again works on my NVDIA system - but not an my AMD.
So my question is: Should these extensions work on AMD? At least GLEW tells me, the extension is available on my platform. And if so, any ideas what I am doing wrong?
Any help is greatly appreciated!
Thanks
Stefan