Skip to content

Conversation

@valbok
Copy link
Owner

@valbok valbok commented Apr 6, 2025

OpenGL does not support NV12 textures natively, so
we should return 2 textures: for Y and UV planes.
Need to copy planes to specific texture:

  1. DXGI_FORMAT_NV12 cannot be used in wglDXRegisterObjectNV
  2. Creating few ID3D11Texture2D and copying the data to it
    via CopySubresourceRegion(nv12Texture) is not allowed.

Solution:

  1. Create 2 shared ID3D11Texture2D textures: R8 and BGRA (not R8G8)
  2. Create Shader Resource Views (SRV): R8 and R8G8
  3. Create Unordered Access Views (UAV) for ID3D11Texture2D textures: plane 0 and plane 1
  4. Extract planes in HLSL and copy to ID3D11Texture2D: R8 and BGRA
    NOTE: BGRA (and not R8G8) is needed by OpenGL shader used to render in QAVWidget_OpenGL
  5. Generate OpenGL textures and bind ID3D11Texture2D R8 and BGRA to OpenGL via wglDXRegisterObjectNV

@valbok valbok changed the title Introduce Interop Converting of ID3D11Texture2D to OpenGL textures Introduce Converting of ID3D11Texture2D to OpenGL textures Apr 6, 2025
@valbok valbok force-pushed the d3d11_to_gl branch 14 times, most recently from d470e00 to 93f361d Compare April 7, 2025 08:24
@valbok valbok merged commit 3b1b45f into master Apr 7, 2025
7 checks passed
@valbok valbok deleted the d3d11_to_gl branch April 7, 2025 15:28
@valbok valbok mentioned this pull request Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants