Open SnapperTT opened 6 years ago
As discussed on gitter, the issue appears to be here: https://github.com/bkaradzic/bgfx/blob/master/3rdparty/glsl-optimizer/src/glsl/ir_print_glsl_visitor.cpp#L939
Shaderc appears to be adding both a LoD and a Sample Index argument if (ir->op == ir_txf_ms)
. If we are using a multisampled then only sample index is needed
Suggested fix: remove || ir->op == ir_txf_ms
from line 939, or update glsl optimiser
In the current version of glsl optimiser this appears to be fixed: https://github.com/aras-p/glsl-optimizer/blob/master/src/glsl/ir_print_glsl_visitor.cpp#L934
Writing a fragment shader that reads a msaa depth buffer. Shaderc appears to be translating texelfetch incorrectly, it adds a superfluous argument when a sampler2DMS is passed
../../../src/renderer_gl.cpp (5820): BGFX Failed to compile shader. 0: 0(18) : error C1115: unable to find compatible overloaded function "texelFetch(sampler2DMS, ivec2, int, int)"
Note the second int.
Steps to reproduce:
Test frag shader:
When compiled with shaderc:
./../../tools/shadercRelease -f fs_test.sc -o ../glsl/fs_test.bin --type f -i . --platform linux -p 120
Note that an extra ", 0" is being added to the texelFetch line:
tmpvar_1 = texelFetch (s_texDepth, ivec2((v_texcoord0 * vec2(1080.0, 720.0))), 0, 0).x;
This causes bgfx to throw the wobbly when it reaches this line. Opening the compiled .bin and removing the extra ", 0" allows the shader to work.