2

I need to convert an RGB texture to the NV12 format which the video codec understands (Y plane immediately followed by UV plane). DXGI_FORMAT_NV12 provides a straightforward view format mapping using R8 for Y and R8G8 for UV, so I use two pixel shaders with an NV12 texture. Unfortunately, this only works on Windows 8. Can I somehow create a texture that has both R8 and R8G8 shader resource views on Windows 7? Or is there another way I can render the YUV data?

Timothy003
  • 2,348
  • 5
  • 28
  • 33

1 Answers1

0

create CreateOffscreenPlainSurface() with following D3DFORMAT

(D3DFORMAT)MAKEFOURCC('N', 'V', '1', '2') //842094158

more detail source code available at my git repo:

https://github.com/sailfish009/sample_direct3d_nv12

sailfish009
  • 2,561
  • 1
  • 24
  • 31
  • Thanks, but that's D3D9. The question is asking about D3D10. – Timothy003 Mar 14 '18 at 18:35
  • @Timothy003 i hadn't tried D3D10, there is rare information about it. if you have to use shader, opengl is better alternative solution: https://github.com/sailfish009/sample_opengl_nv12 – sailfish009 Mar 15 '18 at 00:18