Jump to content
  • Advertisement
Sign in to follow this  
neeker

OpenGL Enabling a buffer but not using it

This topic is 1309 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I'm pretty new to OpenGL, so I'm curious as to what the performance hit might be for enabling a buffer and the not using it.  For example, what if I were to enable GL_TEXTURE_COORD_ARRAY and then never use textures?   My guess is very little and I plan on profiling it when I get the chance, but it'll be a little bit before I can do that and google hasn't helped me dig up an answer yet.

 

Cheers!

Share this post


Link to post
Share on other sites
Advertisement

State changes (Even some redundant ones) that aren't needed are generally considered bad practice. If you do not have to change a state, do not change a state. This -can- lead to performance problems depending on the state and where it's being set, as well as frequency.

Share this post


Link to post
Share on other sites

On older GPUs, enabling a buffer will tell the fixed-function vertex-fetch unit to gather data from that buffer right before every time that the vertex-shader runs. Even if the vertex shader doesn't use that data, you'll still have wasted a lot of time fetching that data to the vertex-shader processor.

Share this post


Link to post
Share on other sites

If you have vertex buffer data containing attribute bytes that are redundant at some shaders stages, but vital to other shader stages, you should   keep them in the buffer interleaved. You have to in first place keep alignment of verticies size rule, meaning vertex size always should be 32 (16/64)byte, or its multiple possibly. Even if you happen to be using 3 bytes per vertex (or 23), GPU will actualy have 32 byte catch register (or 64 byte) and will get very angry if you deliver data in a memory leayouted like 17 bytes.

 

 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!