On Fri Apr 28 23:27:41 2023 +0000, Francisco Casas wrote:
I just realized one more thing. I think we are not properly following the specification for both sample_l and sample_b. In the **Restrictions** section of the documentation for sample_b it is mentioned that the last src register must use a single component selector if it is not a scalar immediate. This "select_component" is also ilustrated in the sample_l format:
sample_l[_aoffimmi(u,v,w)] dest[.mask], srcAddress[.swizzle], srcResource[.swizzle], srcSampler, srcLOD.select_component
Currently, we are not respecting that since sm4_src_from_node() sets
src->swizzle_type = VKD3D_SM4_SWIZZLE_VEC4;
by default. It should be VKD3D_SM4_SWIZZLE_SCALAR in this case. If I am not mistaken, a simple:
instr.srcs[3].swizzle_type = VKD3D_SM4_SWIZZLE_SCALAR;
after calling sm4_src_from_node() should do. The disassembly should show a single component in the swizzle of the last src register.
Added this as a new commit on top - the disassembly before this commit shows a single component already, which made me think it might have been getting set elsewhere, but _after_ the change the binary output was different, so it might be a coincidence.