Created attachment 138611 [details]
Video showing the bug
Overview: In the game Insurgency, fire effects (as those from Molotov Cocktail) create black circles around the fire, creating difficulties to see what is behind the fire.
I have tried to change graphical settings, and no setting solved this.
Insurgency is a 32-bit game, so it is required to build 32-bit mesa.
Steps to Reproduce:
1) Open the game Insurgency;
2) Choose a server to enter;
3) Play with a class with Molotov Cocktail;
4) Throw Molotov;
5) See the black circles around the fire.
Actual Results: black circles with variable radius appear around the fire, making it nearly impossible to see behind the fire.
Expected Results: there is a reddish/orange lightning and there are no black or non transparent circles.
Hardware: Intel Core i3-6100U
Intel HD Graphics 520
8 GB RAM
Operating system: Xubuntu 18.04 Bionic Beaver (development branch) amd64
Kernel version: 4.16.0-041600-generic
Mesa version: 18.1.0-devel (git-498d9d0f4d)
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Intel Open Source Technology Center (0x8086)
Device: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2) (0x1916)
Video memory: 3072MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.5
Max compat profile version: 3.0
Max GLES1 profile version: 1.1
Max GLES profile version: 3.2
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.1.0-devel (git-498d9d0f4d)
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 3.0 Mesa 18.1.0-devel (git-498d9d0f4d)
OpenGL shading language version string: 1.40
OpenGL context flags: (none)
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 18.1.0-devel (git-498d9d0f4d)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
Build options for mesa 64-bit:
./configure --with-dri-drivers=i965 swrast --with-vulkan-drivers=intel --with-dri-driverdir=/usr/local/mesa/lib/dri --prefix=/usr/local/mesa --with-gallium-drivers=i915 svga swrast --with-platforms=x11,drm,wayland,surfaceless --enable-texture-float --enable-gbm --enable-glx-tls --enable-glx --enable-dri3 --enable-lmsensors --enable-gles1 --enable-gles2 --enable-opencl --enable-opencl-icd --enable-va --enable-xa --enable-osmesa --enable-shared-glapi --enable-vdpau --enable-libglvnd --enable-llvm --enable-valgrind --enable-debug
Build options for mesa 32-bit:
./configure --with-dri-drivers=i965 swrast --with-vulkan-drivers=intel --with-dri-driverdir=/usr/local/mesa32/lib/dri --prefix=/usr/local/mesa32 --with-gallium-drivers=i915 svga swrast --with-platforms=x11,drm,wayland,surfaceless --enable-texture-float --enable-gbm --enable-glx-tls --enable-glx --enable-dri3 --enable-lmsensors --enable-gles1 --enable-gles2 --enable-opencl --enable-opencl-icd --enable-va --enable-xa --enable-osmesa --enable-shared-glapi --enable-vdpau --enable-libglvnd --enable-llvm --enable-valgrind --enable-debug
an apitrace of this would help us understand what is going on. Are you able to trace it?
I have traced it, but I don't know what to do with them and the files are very big (the smallest one has 410 MB), so I can't upload them here.
Hello. You can use anything, like, google drive sharing, or any other "sharing" tool (search in google "file sharing web site" etc.
Also please archive it before uploading, it will decrease size.
Here is the compressed trace file: https://mega.nz/#!llQgCRhB!SHYZwE0Qy7_dcKQaUC1YpTPajXb0wKgS0D0RZBu2kxA
Issue is reproduced on Haswell and Kabylake but not reproducible with radeon cards. I also noticed another one issue which is quite similar to the original one: when shooting on the water area there are some black polygons rendered (see attached screen shot).
For the original issue with the Molotov Cocktail I found fragment shader which looks like causes rendering issues:
Replacing last line in the shader with "gl_FragData = vec4( 0.0, 0.0, 0.0, 0.0);" fixing this issue. But I'm not sure if this a mesa issue or not.
Issue with the black polygons on the water area can be fixed in the following fragment shader:
using the same workaround as above.
Created attachment 139268 [details]
Hello, I have found the issue which seems not to be in Mesa.
In shader FS_19de0fe8981e63840fa1221c1fc63023e07bc23d.glsl (shader for fire) there is a 'uniform vec4 pc' which has different values on Intel and Radeon GPU:
Intel - set program 1564 uniform "pc" (loc 62, type "vec4", length 2, transpose = false) to: 0 2 0 1 , 0.214041 0 0 0
Radeon - set program 1623 uniform "pc" (loc 62, type "vec4", length 2, transpose = false) to: 0 2 0 1 , 0.5 0 0 0
In shader 'pc.x' is used several times which leads to the found visual difference. When changing usage of 'pc.x' to '0.5' the results are visually identical.
I have attached the result of changing 'pc.x' into '0.5' on Intel GPU.
Also when I debugged Mesa I saw that the memory from where pc uniform is taken is always changed by game including setting of value '0.214041':
#0 0xf7c4506a in ?? () from /lib/i386-linux-gnu/libc.so.6
#1 0xefddf6ba in ?? () from insurgency2/bin/shaderapidx9.so
#2 0xeda2e338 in ?? () from insurgency2/bin/stdshader_dx9.so
#3 0xeda7a423 in ?? () from insurgency2/bin/stdshader_dx9.so
#4 0xf1d51d28 in ?? () from insurgency2/bin/materialsystem.so
#5 0xf1ce7dba in ?? () from insurgency2/bin/materialsystem.so
Created attachment 139828 [details]
Fire effect with fixed uniform value on Intel GPU
Oh. Does UNITY_DISABLE_GRAPHICS_DRIVER_WORKAROUNDS=1 help?
UNITY_DISABLE_GRAPHICS_DRIVER_WORKAROUNDS=1 doesn't help, unfortunately.
Hi, is there something I can do to make the bug disappear then while playing the game? If yes, how do I do?
Is there a solution yet?
Where can I find the fire shader file or the PC.x file?
Unfortunately the way I *fixed* it is not something common user can and should do.
It is an error in the game itself and could be only fixed by its developers.