Organizing GLSL shaders in OpenGL engine

前端 未结 3 1599
说谎
说谎 2021-01-30 10:53

Which is better ?

  1. To have one shader program with a lot of uniforms specifying lights to use, or mappings to do (e.g. I need one mesh to be pa

3条回答
  •  悲&欢浪女
    2021-01-30 11:35

    Most modern engines I know have a "shader cache" and use the second option, because apparently it's faster.

    Also you can take a look at the ARB_shader_subroutine which allows dynamic linkage. But I think it's only available on DX11 class hardware.

提交回复
热议问题