Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am relevantly new to Graphics Programming. I have written some basic games in xna in the past but I am trying to understand what the point of all these surface formats is. For instance Xna and DDS support the standard RGBA (8bpp). Why does one need 32 bpp or even stranger combinations of bits per channel like Rg32. Isn't it enough to have the standard DXn, RGBA, and HDR formats?

share|improve this question
add comment

1 Answer

up vote 14 down vote accepted

You think XNA has a lot of surface formats? Boy, you ain't seen nothing yet.

Joking aside, I suspect the reason has to do with a combination of legacy/backwards compatibility and flexibility.

Obviously, once a surface format is introduced it needs to be supported forward for some time, or the entire API takes a backwards compatibility hit. So there are probably a few surface formats that float about just due to that reason alone.

But the bigger reason is the flexibility that is afforded to developers by having many surface format options to choose from -- this allows developers to do things like use as few bits as possible for a particular channel, or as few channels as possible for scenarios where optimizing space is an important consideration. It allows for the possibility of expanding to very large bit-widths when broad ranges of color data are going to be required (for example, for HDR, as you mentioned). Some formats exist for relatively specialized (but very common, possibly performance critical graphics operations) tasks -- the NormalizedByte2 format, for example, is commonly used in bump-map related operations (per the documentation).

Some of the strange looking formats can be useful for non-graphics operations, too, like general GPU computation where you may only need two channels of input data (and thus, why waste space on the third when that video memory could be put to better use -- such as allowing more of the two-channel data you're trying to process?)

Having a variety of formats also allows the developer to communicate to the GPU how the data will be arranged and used (this is why the DXGI format list is so big, because it not only includes bit-width variations, but some type information as well, such as whether the values will be signed or unsigned), which in turn can allow the GPU to optimize its buffer layouts for maximum pipeline throughput.

Finally, some of the formats are restricted in where and when they can be used, which necessitates a list that may seem sprawling at first, but is actually relatively compact for any given scenario. Relatively few formats can be used for a depth buffer, for example.

share|improve this answer
1  
Seeing as this is tagged XNA, the Reach vs HiDef profile comparison is also worth linking. –  Andrew Russell Feb 9 '11 at 6:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.