D3DFORMAT

Started by
2 comments, last by Namethatnobodyelsetook 15 years, 11 months ago
When I create a device, there is a parameter to specify the back buffer format in the D3DPRESENT_PARAMETERS. Similarly, when I create a texture, there is an option of specifying the format. Question 1: Do these 2 formats need to match? Question 2: For the FOURCC formats, in the documentation, I see that I can specify only either ('M','E','T','I') ('G','R','G','B'), ('R','G','B','G') ('U','Y','V','Y'). How can I specify other formats such as I420, YV12, YVU9 etc. Thanks
Advertisement
1: They don't. Texture sampler converts texture format to floating point and later in pipeline it's converted to the format of whatever surface you are rendering to. If you aren't using shaders, exactly the same things happen automatically.

2: Use FOURCC macro, exactly like in examples you've mentioned.
Thanks a lot!
While the formats often don't have to match, there are certain cards which may be more strict than others. Technically you're supposed to use "CheckDeviceFormat" to ensure the format is available for the use you want, when using a certain backbuffer type. It's possible the card won't allow a YUV texture with an RGB backbuffer. Some cards only support YUV for DirectDraw overlays.

As I've never tried using any obscure formats I can't really comment on how widespread support for them is.

This topic is closed to new replies.

Advertisement