Is using multiple shaders for a single stage a bad idea?

I read that you can connect multiple shaders to the same program stage in OpenGL to create "libraries" of auxiliary functions. I tried this and it worked well on my machine. However, the OpenGL Wiki warns

Saying that although this power is available, it’s best not to use it. This usually works, but since most OpenGL applications do not, it does not go as carefully as the other components of the OpenGL API. Thus, you are likely to come across a lot of driver errors. As a rule, stick to one shader object at the shader stage.

This section was written in 2013. Is this still true for reasonably modern hardware / drivers?

+4
source share
1 answer

IMHO. The wiki note is understandable. API limitation because it is possible to encounter an error? Come on, then just abandon coding: no main (), no errors.

Personally, I have never encountered problems in separating shaders in several objects, mainly on Nvidia, Amd and Intel. There may be limited drivers on other platforms, but this can be circumvented by processing text from multiple sources.

Personally, I see no good reason to avoid multiple objects, but I would say that it is rarely enough to cache objects to associate it with several programs.

+1
source

Source: https://habr.com/ru/post/1675798/


All Articles