<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - [ANV] The Witcher 3 shadows flickering"
href="https://bugs.freedesktop.org/show_bug.cgi?id=109404#c13">Comment # 13</a>
on <a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - [ANV] The Witcher 3 shadows flickering"
href="https://bugs.freedesktop.org/show_bug.cgi?id=109404">bug 109404</a>
from <span class="vcard"><a class="email" href="mailto:danylo.piliaiev@gmail.com" title="Danylo <danylo.piliaiev@gmail.com>"> <span class="fn">Danylo</span></a>
</span></b>
<pre><span class="quote">> I wonder if the constant folding/lowering only just made a certain bug trigger much more often?</span >
Yes, looks like it.
After staring at shader in RenderDoc I found that something wrong with 1-bit
boolean optimizations.
Commenting out
(('bcsel', a, -1, 0), ('ineg', ('b2i', 'a@1'))),
in src/compiler/nir/nir_opt_algebraic.py solves the issue, this optimization is
part of optimizations for 1-bit booleans introduced in:
6bcd2af0
nir/algebraic: Add some optimizations for D3D-style Booleans
I have some doubts that this exact optimization is a root of the issue but
still it's near enough.
So in the shader there is next contruction:
vec4 _893 = shader_in[4];
_893.x = uintBitsToFloat(gl_FrontFacing ? 4294967295u : 0u);
shader_in[4] = _893;
...
_613.x = uintBitsToFloat((0u >= floatBitsToUint(shader_in[4].x)) ? 4294967295u
: 0u);
r1 = _613;
if (floatBitsToUint(r1.x) != 0u)
{
// Something that happens when it should not
}
When problematic optimization kicks in - it is reduced to:
vec1 32 ssa_14 = intrinsic load_front_face () ()
vec1 32 ssa_15 = b2i32 ssa_14
vec1 32 ssa_16 = imov -ssa_15
...
vec1 32 ssa_200 = uge32 ssa_1, ssa_16
/* succs: block_1 block_2 */
if ssa_200 {
block block_1:
And without it:
vec1 32 ssa_14 = intrinsic load_front_face () ()
...
vec1 32 ssa_198 = inot ssa_14
/* succs: block_1 block_2 */
if ssa_198 {
block block_1:
The first one is incorrect, I was unable to find how it happens today.
I'll attach shader and the resulted NIR.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>