Am Montag, 16. Juli 2012, 20:39:23 schrieb Matteo Bruni:
> +    HLSL_IR_BINOP_MUL,
> ...
> +    HLSL_IR_BINOP_DOT,
HLSL has 3 somewhat related multiplication operations: "*", "mul" and "dot". 
Dot is fairly straightforward, but "*" and "mul" have subtle differences. I 
recommend to write tests to find out the exact details, but as far as I 
remember "float4 * float4" gives you a float4 with a component-wise 
multiplication, whereas mul(float, float) returns a scalar like the dot 
product. "float4x4 * float4" is an error, but mul(float4x4, float4) performs a 
matrix-vector multiplication and returns a float4.

> +static struct hlsl_type *expr_common_type(struct hlsl_type *t1, struct
> hlsl_type *t2,
> +        struct source_location *loc)
This type inference system might be a bit too limited, you have to take the 
operation into account. e.g. a dot(float3, float4) returns a scalar and 
crs(float4, float4) returns a float3.

Attachment: signature.asc
Description: This is a digitally signed message part.



Reply via email to