Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: would unsinged_byte index hurts the speed of rendering

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    20

    would unsinged_byte index hurts the speed of rendering

    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.

  2. #2
    Intern Contributor
    Join Date
    Sep 2013
    Posts
    70
    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.

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,106
    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.
    Last edited by tonyo_au; 12-24-2013 at 05:58 PM.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,138
    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.

  5. #5
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    20
    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.

  6. #6
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,077
    Quote Originally Posted by Sobeit
    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?

    Quote Originally Posted by Sobeit View Post
    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •