Signed-off-by: Francisco Casas fcasas@codeweavers.com
Hmm, this proves that float1 and float are different things:
January 28, 2022 5:03 AM, "Giovanni Mascellani" gmascellani@codeweavers.com wrote:
+[pixel shader] +float4 main(float4 pos : sv_position) : sv_target +{
- float1 x = float1(10.0);
- float4x4 y = float4x4(1.0, 2.0, 3.0, 4.0,
- 5.0, 6.0, 7.0, 8.0,
- 9.0, 10.0, 11.0, 12.0,
- 13.0, 14.0, 15.0, 16.0);
- return mul(x, y);
+}
+[test] +draw quad +probe all rgba (10.0, 20.0, 30.0, 40.0)
It seems that mul checks whether it is a scalar-scalar, scalar-vector, scalar-matrix, vector-scalar, vector-vector, vector-matrix, matrix-scalar, matrix-vector, or matrix-matrix multiplication, using the equivalent to our hlsl_type_class.
This difference makes me wonder whether we are wrong assuming float and float1 are the same in other parts of the codebase, for instance:
--- static bool fold_redundant_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { if (instr->type == HLSL_IR_EXPR) { struct hlsl_ir_expr *expr = hlsl_ir_expr(instr); const struct hlsl_type *src_type = expr->operands[0].node->data_type; const struct hlsl_type *dst_type = expr->node.data_type;
if (expr->op != HLSL_OP1_CAST) return false;
if (hlsl_types_are_equal(src_type, dst_type) || (src_type->base_type == dst_type->base_type && is_vec1(src_type) && is_vec1(dst_type))) { replace_node(&expr->node, expr->operands[0].node); return true; } }
return false; } ---
would dismiss a cast from float to float1, and, if I am not mistaken, the compiler would be failing with this shader:
--- float4 main(float4 pos : sv_position) : sv_target { float xx = 10.0; float1 x = float1(xx); float4x4 y = float4x4(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
return mul(x, y); } ---