PDA

View Full Version : would unsinged_byte index hurts the speed of rendering



Sobeit
12-24-2013, 05:59 AM
using unsinged byte as index data type would save memory. I'm wondering would that slow down the rendering? because i learned that on cpu any data that will be retrieved frequently should be at least 4 bytes aligned due to the way cpu instruction accesses memory. Is this also true for GPU? Thanks.

Cornix
12-24-2013, 06:58 AM
I dont know if this is true in general, but it is true on my hardware. I get better performance with unsigned shorts / ints. But there is no difference between those two.

tonyo_au
12-24-2013, 03:16 PM
but it is true on my hardware
I don't know you can guarantee this but it would be what I would expect on newer gpu hardware. You would have to know how the memory fetch logic works to know for sure and since this is rarely published you can only interrupt from tests that you run.

mhagain
12-24-2013, 04:09 PM
The easiest way to find out is to profile - this should be something you can very quickly and easily set up with minimal disruption to your code.

My own hunch however is that unsigned byte indices are less likely to be supported in hardware than unsigned short or unsigned int, and if they're not supported in hardware then at least part of the pipeline must drop back to software emulation. That's going to seriously make any memory saving become a case of getting your priorities skewed.

However don't take my hunch's word for it - profile.

Sobeit
12-24-2013, 11:09 PM
Thanks guys, I will try some profile later. before that I think I will just use unsigned int, after all I'm working on PC.

Aleksandar
12-25-2013, 12:11 PM
before that I think I will just use unsigned int, after all I'm working on PC.
What's the point of this claim? What is the connection between unsigned int data type and PCs?


because i learned that on cpu any data that will be retrieved frequently should be at least 4 bytes aligned due to the way cpu instruction accesses memory. Is this also true for GPU? Thanks.
I think there is some misunderstanding here. Could you explain it? Starting addresses (of a buffers) are aligned, but if you have a buffer of short values it is not true that each short location starts at 4B address.