HLSL: Fix #1432: Globally initialize local static variables.
This commit is contained in:
parent
64315a8aed
commit
cf6bd066b9
7 changed files with 257 additions and 12 deletions
20
Test/hlsl.staticFuncInit.frag
Executable file
20
Test/hlsl.staticFuncInit.frag
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
static float x = 1.0;
|
||||
|
||||
float f1()
|
||||
{
|
||||
static float x = 2.0;
|
||||
x += 10.0;
|
||||
return x;
|
||||
}
|
||||
|
||||
float f2(float p)
|
||||
{
|
||||
static float x = 7.0;
|
||||
x += p;
|
||||
return x;
|
||||
}
|
||||
|
||||
float4 main() : SV_TARGET
|
||||
{
|
||||
return x + f1() + f1() + f2(5.0) + f2(x);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue