On Thu Jun 1 21:26:47 2023 +0000, Francisco Casas wrote:
Just to summarize what we discussed in IRC: there are few hlsl_ir_expr ops that are allowed to handle different types of arguments and return value. My understanding is that HLSL_OP2_DIV is not one of them (like, e.g. HLSL_OP2_DOT). When replacing this hlsl_new_expr() call with a call to hlsl_new_binary_expr(), the assertion should hold true. This is not happening however, because `load->coords.node` is float4 and the swizzle is float2 (or float3 for tex3Dproj). What is missing is to create a new .XY (or .XYZ) swizzle for `load->coords.node` and pass it as arg1 instead of `load->coords.node` directly.
Turns out 1D case works differently. It's using 2d resource for all profiles, using (x/w, 0.5) as a coordinate in SM4+, I think this justifies moving profile-specific logic out of codegen.c, back to the function.