mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
5cfc8d378f
We are currently not initializing static values to zero by default. Consider the following shader: ```hlsl static float4 va; float4 main() : sv_target { return va; } ``` we get the following output: ``` ps_5_0 dcl_output o0.xyzw dcl_temps 2 mov r0.xyzw, r1.xyzw mov o0.xyzw, r0.xyzw ret ``` where r1.xyzw is not initialized. This patch solves this by assigning the static variable the value of an uint 0, and thus, relying on complex broadcasts. This seems to be the behaviour of the 9.29.952.3111 version of the native compiler, since it retrieves the following error on a shader that lacks an initializer on a data type with object components: ``` error X3017: cannot convert from 'uint' to 'struct <unnamed>' ```
26 lines
327 B
Plaintext
26 lines
327 B
Plaintext
[pixel shader]
|
|
float myfunc()
|
|
{
|
|
return 0.6;
|
|
}
|
|
static float a = myfunc() + 0.2;
|
|
static float b;
|
|
static const float c;
|
|
float4 main() : sv_target
|
|
{
|
|
return float4(a, b, c, 0);
|
|
}
|
|
|
|
[test]
|
|
draw quad
|
|
todo probe all rgba (0.8, 0.0, 0.0, 0.0)
|
|
|
|
|
|
[pixel shader fail]
|
|
static uint i;
|
|
|
|
float4 main() : sv_target
|
|
{
|
|
return 1 / i;
|
|
}
|