opengl - Cost of Branching on uniforms on modern GPUs -


when using glsl on modern (gl3.3+) gpus, cost of branching on uniform?

in engine i'm getting point have lot of shaders. , have several different quality presets lot of those. stands, i'm using uniforms if() in shaders choose different quality presets. i'm worried might achieve better performance recompiling shaders , using #ifdef. problem need worry tracking , resetting other uniforms when recompile shader.

basically want know if fears unfounded. branching on uniform cheap on modern gpus? have done few tests myself , found little difference either way, i've tested on nvidia 680.

i admit i'm not expert, perhaps speculation better nothing.

i think branching on uniforms indeed cheap. it's different branching on texture or attribute data, since alus in simd follow same code path shader, "real" branch rather execution mask. i'm not sure how shader processors suffer branch bubbles in pipeline, pipeline bound more shallow in general-purpose cpus (particularly given lower clock-speeds typically run at).

i wish more helpful , i'd appreciate if else can answer more authoritatively. i, one, wouldn't worry branching on uniforms, however. always, if have possibility, profile shader , see if makes noticeable difference.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -