castle-engine icon indicating copy to clipboard operation
castle-engine copied to clipboard

Fragment shader not compiled: error C7538: OpenGL does not allow 'mediump' after 'inout'

Open eugeneloza2factor opened this issue 2 years ago • 3 comments

Today we were trying to run fps_demo on a Windows 7 x32 bit using the CGE snapshot, however it crashes when trying to compile the shader:

Exception: Exception "EGLSLShaderCompileError":
Fragment shader not compiled:
0(10) : error C7538: OpenGL does not allow 'mediump' after 'inout'

Full log: message.txt

Looks like it's a driver issue for some Nvidia cards: https://community.khronos.org/t/opengl-does-not-allow-mediump-after-inout/67417 but I guess it needs someone smarter than me to resolve :)

eugeneloza2factor avatar Oct 23 '23 23:10 eugeneloza2factor

The videocard in question is nVidia Geforce, 210, the latest available drivers version is installed (from 2016)

eugeneloza2factor avatar Oct 24 '23 21:10 eugeneloza2factor

The issue seems to come from this line: https://github.com/castle-engine/castle-engine/blob/master/src/base_rendering/castleglshaders.pas#L1519 . At the beginning, I would say to try to change this line, so from:

'out mediump vec4 castle_FragColor;' + NL

->

'out vec4 castle_FragColor;' + NL

Just remove mediump -- for OpenGL it should not be necessary.

michaliskambi avatar Nov 02 '23 12:11 michaliskambi

TODO for me:

  • Is it maybe our bug? OpenGL is 3.3 here, not more modern 4.x. Maybe mediump is not allowed at that OpenGL level? This would mean we should fix it in CGE with condition like "if OpenGL is not newer than 3.3...", not a specific hack for this GPU.

michaliskambi avatar Nov 02 '23 12:11 michaliskambi