naga
naga copied to clipboard
[hlsl-out] Incorrect behaviour with firstTrailingBit
This program incorrectly outputs -1
with DirectX. I think this is because of the use of firstbitlow
, since it works correctly with tint which uses its own polyfill for firstbitlow
- perhaps naga needs to do the same?
WGSL:
@group(0)
@binding(1)
var<storage, read_write> k: i32;
@compute
@workgroup_size(1)
fn main() {
k = max(~0, firstTrailingBit(1));
}
HLSL:
RWByteAddressBuffer k : register(u1);
[numthreads(1, 1, 1)]
void main()
{
k.Store(0, asuint(max(~0, firstbitlow(1))));
return;
}