Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/spirv.c:
return vkd3d_compact_swizzle(VKD3D_SHADER_NO_SWIZZLE, dst_write_mask) == vkd3d_compact_swizzle(swizzle, write_mask);
}
+static bool vkd3d_swizzle_is_scalar(unsigned int swizzle) +{
- return swizzle == (swizzle | (swizzle << VKD3D_SHADER_SWIZZLE_SHIFT(1)));
This is pretty obscure to me, what is it supposed to catch? "Constant" swizzles, i.e., swizzles that select the same component for each slot (like `.xxxx`, `.yyyy`)? If that's the intention, it seems to be broken; for example, I think that `.xxxw` is accepted too, because the topmost component `w` falls out of the `unsigned int` after the bitshift anyway. Or am I misunderstanding?
Could it be rewritten in a more understandable way?