BUG: EGLImage sibling created from Texture2D which imported from Vulkan doesn't honor the offset parameter


Sorry for my English, this bug is a little complicated for me to describe, so I attached a sample code, hope it can help.

Basically, the bug involves following steps:

  1. in Vulkan, create a VkDeviceMemory which is large(like 2048x2048), export it with extension VK_KHR_external_memory_fd.
  2. in EGL/OpenGL ES, import the VkDeviceMemory with glCreateMemoryObjectEXT and glImportMemoryFdEXT
  3. in EGL/OpenGL ES, bind different portions of VkDeviceMemory to several smaller GL_TEXTURE_2D objects, like below
    glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8, width, height, memoryObject, offset);
    here the width/height are smaller(eg. 4x4), offset is aligned to alignment which is calculated by vkGetImageMemoryRequirements, and the textures are guaranteed not to overlap with each other.
  4. create EGLImage from these textures with:
    eglCreateImageKHR(display, context, EGL_GL_TEXTURE_2D_KHR, reinterpret_cast(texture), nullptr);

I can confirm the first 3 steps are executed correctly and the textures created in step 3 can be used inside OpenGL without any problems. however the EGLImage created in step4 seems ignore the offset parameter specified in step 3. no matter which offset parameter i specified, the result EGLImage seems always point to the beginning of VkDeviceMemory, I believe this is not the correct behavior.

I can reproduce this problem under Ubuntu 16.04, driver 384.90 and 390.42, with GeForce 1050 and Quadro P2000.

The sample code can be found at: