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.

This is probably API independent (more dependent on hardware implementation), but just in case, I'm using OpenGL.

The question is restricted to PC hardware.

I have a couple of questions concerning the output textures that are being rendered to (e.g. in gbuffer geometry pass)

  • Is there a (noticeable, measurable) performance penalty of using different formats for the different output textures? e.g. RGB8 (unsigned byte) (8 bits for each component) for diffuse color, RGBA8 (unsigned byte) for specular color + roughness, RGB16F for normals?
  • Is it worth it to pack smaller component data into larger types just so I can have equal render targets (and fewer of them in number)? E.g. just having two RGBA16F render targets, packing diffuse + specular + roughness into the first, and normals and other stuff into the second render target using bitmasking?
  • Are there output texture data types/formats that I should avoid entirely?
share|improve this question

1 Answer 1

up vote 3 down vote accepted

It's going to depend on the hardware and app, of course, but on current generation GPUs (NVIDIA Kepler, AMD GCN), I believe there is no penalty for using different render target formats at once. On older GPUs you simply couldn't do it; all render targets had to be the same format.

Writing out to multiple render targets is usually memory-bound, so you can expect performance to scale based on the total number of bytes per pixel. In other words, thinner formats are better. This also applies to reading the data back in for subsequent passes: thinner formats take less memory bandwidth to read, and bilinear filtering might also be faster for thin formats.

However, the number of render targets also has an effect; 4xRGBA8 will likely be slower than 2xRGBA16F, even though they have the same memory size. This is due to cache effects as well as the shader needing a separate write instruction for each render target.

share|improve this answer

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.