defold icon indicating copy to clipboard operation
defold copied to clipboard

Option to set GLSL ES precision for the whole shader

Open aglitchman opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe (REQUIRED): The GLSL ES spec does not define a default float precision for fragment shaders, so Defold have to specify it, and now it is mediump by default.

If you have a large fragment shader and want to use highp everywhere by default, then you have to bloat shader's source code by adding highp prefix everywhere.

Describe the solution you'd like (REQUIRED): Defold's shader compiler should check for the line precision <PRECISIONHERE> float; in the shader's code to not add the line with the precision again, i.e. Defold adds precision mediump float into all fragment shaders.

Describe alternatives you've considered (REQUIRED): We had to add "highp" at almost every line.

aglitchman avatar Apr 12 '22 12:04 aglitchman

hmm, It seems like we have this logic in the ShaderUtil code. Now I'm not sure if it's outdated issue or bug in this code

AGulev avatar Oct 21 '23 08:10 AGulev

ah, ok. it seems like it is bug

AGulev avatar Oct 21 '23 08:10 AGulev

With the new pipeline you can specify this in the shader, so I’m not sure this issue is needed any more :)

EDIT: I’ll close this once I’ve added the info to the manual on how to set it

Jhonnyg avatar Aug 13 '24 20:08 Jhonnyg