[PATCH vkd3d v2 07/10] vkd3d-shader/hlsl: Support complex numeric initializers.

Francisco Casas fcasas at codeweavers.com
Wed Jan 12 11:15:14 CST 2022


January 12, 2022 1:48 PM, "Giovanni Mascellani" <gmascellani at codeweavers.com> wrote:

> Hi again,
> 
> On 12/01/22 17:35, Giovanni Mascellani wrote:
> 
>> In other words, it seems that here you have to test for > "v->initializer.args_count == 1", not
>> "size == 1". But do your own > research.
> 
> Actually, I noticed that this shader does not compile on native:
> 
> ---
> float4 main() : SV_TARGET
> {
> float3 x = {float4(71, 72, 73, 74)};
> return float4(x, 74);
> }
> ---
> 
> (the only difference with my previous email is the pair of braces around the initializer)
> 
> So it seems that the condition you want to discriminate on is whether the initializer is specified
> as a list (in which case you have to fully unpack and match in order) or as a single object (in
> which case you treat it as an assignment). I guess, at least.
> 

No, I think that the original purpose of doing an assignment when "v->initializer.args_count == 1" 
is to cover the cases for when numeric variables are initialized with a single numerical constant.

For instance, this shader:

---
float4 main() : sv_target
{
    float3 aa = 3;
    float4 bb = {aa.x, aa.y, aa.z, 4.0};
    return bb;
} 
---

Retrieves (3.0, 3.0, 3.0, 4.0) with the native compiler.

If I am not mistaken, initializers like float4(1 ,2 ,3 ,4) are treated the same as 
{1, 2, 3, 4} in the code.

Still, I will add these tests in v3.



More information about the wine-devel mailing list