locked
How to convert DXGI_FORMAT_NV12 to DXGI_FORMAT_R8G8B8A8_UNORM?

    Question

  • first, I must use the DXGI_FORMAT_NV12 format to create a texture, then I map this texture to a mesh. But the render result is not right.I think the texture should be created with DXGI_FORMAT_R8G8B8A8_UNORM format ,and that will be render well.

    So how can I convert DXGI_FORMAT_NV12 to DXGI_FORMAT_R8G8B8A8_UNORM?

    I found the DXGI_FORMAT_NV12 is YUV 4:2:0 video resource format. if it doesn't need to convert, How to render right with DXGI_FORMAT_NV12 ?

    Thursday, March 29, 2012 6:32 AM

All replies

  • See http://msdn.microsoft.com/en-us/library/windows/desktop/bb173059(v=vs.85).aspx

    DXGI_FORMAT_NV12

    Most common YUV 4:2:0 video resource format. Valid luminance data view formats for this video resource format are DXGI_FORMAT_R8_UNORM and DXGI_FORMAT_R8_UINT. Valid chrominance data view formats (width and height are each 1/2 of luminance view) for this video resource format are DXGI_FORMAT_R8G8_UNORM and DXGI_FORMAT_R8G8_UINT. Supported view types are SRV, RTV, and UAV. For luminance data view, the mapping to the view channel is Y->R8. For chrominance data view, the mapping to the view channel is U->R8 and V->G8.

    Friday, March 30, 2012 12:22 AM
  • the document says , for luminance data view, the mapping to the view channel is Y->R8, that is the image can only show the red channel?

    the document doesn't say how to convert  DXGI_FORMAT_NV12 to DXGI_FORMAT_R8G8B8A8_UNORM, How to do it?

    Friday, March 30, 2012 3:44 AM
  • You don't. You can only use the aliasing to create a resource of hte format NV12 and then use shader resource views of the format R8 and R8G8 pointing to the same NV12 resource.
    Friday, March 30, 2012 8:10 PM
  • If I use shader resource views of the format R8 , the result of the render is only Red channel?

    If I use the R8G8, the result of render is only Red and Green Channel ?

    I want the result of render is RGB format.How can I do it?


    • Edited by zjubaoli Thursday, April 05, 2012 8:46 AM
    Thursday, April 05, 2012 8:44 AM
  • How to use shader resource views of the format R8 and R8G8 pointing to the same NV12 resource?
    Thursday, April 26, 2012 8:24 AM