glTexStorageMem2DEXT generates error 1281 in nvidia, but works in mesa

I am trying to load an image texture with vulkan and draw with opengl.
For this I use the GL_EXT_memory_object extensions.

You can see code bellow:
// loading vulkan image

glCreateMemoryObjectsEXT(1, &gl_mem_obj);
glImportMemoryFdEXT(gl_mem_obj, ImageSize(), GL_HANDLE_TYPE_OPAQUE_FD_EXT, fd);
if (not glIsMemoryObjectEXT(gl_mem_obj)) {
qDebug() << “Memory object does not exists”;
return ;
glBindTexture(GL_TEXTURE_2D, tex_id);
glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8,width,height,gl_mem_obj, 0);

// drawing texture

On AMD gpu everything works, but on NVIDIA it doesn’t.

glTexStorageMem2DEXT generates 1281 error.

Who can help?


Hello and welcome to the NVIDIA developer forums @t96!

My first guess would be that the memory object is somehow incorrect or inadequate for the combination of width, height and color compared to the original memory layout of the incoming image. How memory objects are structured is implementation dependent, which would explain why AMD and NVIDIA behave differently. But how to fix that for your example above is hard to say.

Would you be able to share a minimal repro app that we could try and run locally?

Also, what platform, GPU and driver version are you running this on?


Hi @MarkusHoHo , thank you for your answer.

I am using rtx3090 gpu.
OpenGL version string: 4.6.0 NVIDIA 525.85.05

I have created a small example for you where I am trying to load an image texture with vulkan and draw with opengl.
You can find main.cpp file in the attachments

You need following packages:
find_package(qt REQUIRED)
find_package(Vulkan REQUIRED)
find_package(glew REQUIRED)
find_package(glfw3 REQUIRED)
find_package(stb REQUIRED)

glTexStorageMem2DEXT generetes 1281 error in nvidia,but works in amd.
main.cpp (21.6 KB)

Hi @MarkusHoHo,

Do you have any news?


No update, I personally am not set up to make this kind of Vulkan testing. I first need to find someone from the OpenGL/Vulkan teams.

That said, are you running this on Linux or Windows? Could you give some detail on which Distribution or Windows version?

Also, did you try avoiding using QT or STB in your app to rule out any kind of memory layout issues? You have a format conversion in your app if I saw that correctly, Stuff like that might introduce alignment buffers or similar and make the mem object incompatible.


Hi @MarkusHoHo ,

I am using Ubuntu 22.04.

I tried QT, STB and TurboJpeg but the result is the same.

Do you have any ideas?


Hi @MarkusHoHo ,

I have found the problem. OpenGL and Vulkan memory sizes are not equal.

In OpenGL I set a size withheightchannels, but memRequirements.size in Vulkan is not equal withheightchannels, so we need to set memRequirements.size in OpenGL.


1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.