Skip to content

OpenGL interop should supply the texture format to the sampler

The swizzle configuration for texture sampling is decided in sampler.c depending on whether GL_ARB_texture_rg is available or not. However, interop might not follow the format that is expected in this test.

In particular, vaapi interop is using GL_EGL_image extension and call EGLImageTargetTexture2DOES to assign the EGL image, which will change the internal format and use a format like GL_RG instead for NV12. Since after GL 3.0, GL_RG is core, there is no extension for it and we use the wrong code path, leading to #26735 (closed).

Instead, the sampler should use a texture configuration from the interop, and the checks should be moved to where the textures are actually created, for instance when using interop_sw.

In addition, after being moved, the checks should favor GL_RG when OpenGL >= 3.0 is used, and check https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_rg.txt on OpenGL ES too.

interop_cvpx is already doing some code like this to handle BGRA and UYVY CVPX chroma.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information