Uniform vs Constant Attribute?

This topic contains 2 replies, has 2 voices, and was last updated by  Adventus 8 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29661

    Adventus
    Member

    I’m a bit confused on the circumstances in which a constant Attribute should be used. Presumably changing a uniform may end up with the shader being recompiled, whereas attributes will not attempt optimisation. 

    Using PVR OGLES2.0 emulation i found that passing regularly changing values as constant attributes gave a significant performance advantage. Is this true on actual devices? Or is it entirely driver dependant?

    #32567

    Xmas
    Member
    Adventus wrote:
    I’m a bit confused on the circumstances in which a constant Attribute should be used. Presumably changing a uniform may end up with the shader being recompiled, whereas attributes will not attempt optimisation.

    Constant attributes are merely a convenience feature so you don’t have to modify a shader for just a few meshes which happen to have a constant value for an attribute. Plus you can fit a few more constants if you run out of uniform space.

    Apart from that, you should use them for what they were intended: attributes for values that may change per vertex, uniforms for values that may change per draw call.

    Quote:
    Using PVR OGLES2.0 emulation i found that passing regularly changing values as constant attributes gave a significant performance advantage. Is this true on actual devices? Or is it entirely driver dependant?

    PC Emulation performance is very much dependent on the underlying desktop OpenGL driver.

    #32568

    Adventus
    Member

    Thanks, I suspected that might be the answer. I’ll see if my 8600GT driver is the cause of my woes.

    Edit: Yep it was my drivers, changing from 169.X to 180.X drivers caused it to go from ~25 fps to ~300 fps. Something was messed up.

    Adventus2009-01-07 02:51:43

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.