mirror of
https://github.com/RPCS3/glslang.git
synced 2024-11-30 22:51:06 +00:00
0fca0bafaf
Semantic test left over from other source languages is removed, since this is permitted by HLSL. Also, to support the functionality, a targeted test is performed for this case and it is turned into a EvqGlobal qualifier to create an AST initialization segment when needed. Constness is now propagated up aggregate chains during initializer construction. This handles hierarchical cases such as the distinction between: static const float2 a[2] = { { 1, 2 }, { 3, 4} }; vs static const float2 a[2] = { { 1, 2 }, { cbuffer_member, 4} }; The first of which can use a first class constant initalization, and the second cannot.
15 lines
339 B
GLSL
15 lines
339 B
GLSL
|
|
cbuffer CB {
|
|
float4 foo;
|
|
};
|
|
|
|
static const float4 bar = foo; // test const (in the immutable sense) initializer from non-const.
|
|
|
|
static const float2 a1[2] = { { 1, 2 }, { foo.x, 4 } }; // not entirely constant
|
|
static const float2 a2[2] = { { 5, 6 }, { 7, 8 } }; // entirely constant
|
|
|
|
float4 main() : SV_Target0
|
|
{
|
|
return bar;
|
|
}
|