opengl - Should vertex and fragment shader versions always match? -


suppose have fragment shader starting #version 120 , vertex shader #version 150 compatibility. combination appears work afaict, go against opengl or glsl specifications? couldn't find information discusses issue. if there's none indeed, should take "not forbidden" or "not approved"?

no, there no requirement shader versions match. there requirement profiles match, relates mixing desktop , embedded glsl. discussed briefly in glsl specification, implications of mixing different shader versions of compatible profiles not discussed.

opengl shading language 4.50  -  3.3 preprocessor  -  p. 14

shaders core or compatibility profiles declare different versions can linked together. however, es profile shaders cannot linked non-es profile shaders or es profile shaders of different version, or link-time error result. when linking shaders of versions allowed these rules, remaining link-time errors given per linking rules in glsl version corresponding version of context shaders linked under. shader compile-time errors must still given strictly based on version declared (or defaulted to) within each shader.

you run syntax differences become unwieldy mess between 1.20 , 1.50 however. example, 150 compatibility understands use of in , out declared variables shader stage i/o 120 must declare these either attribute or varying. varying in 1.20 vertex shader can pass data in variable of same name in 1.50 fragment shader despite different syntax.

there may minor changes behavior of functions when change shader version. glsl 1.30, example, stops respecting gl_depth_texture_mode , returns rrrr ... if sample depth texture 1.20 vertex shader , again 1.50 fragment shader, may different results gba part of result. sort of thing not common, it's keep in mind.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -