mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 19:40:06 +00:00
63dbacaa94
Before this change, the example is rejected by DXC: $ dxc -T ps_6_0 hlsl.namespace.frag hlsl.namespace.frag:22:73: error: call to non-static member function without an object argument return N1::getVec() + N2::getVec() + N2::N3::getVec() + N2::N3::C1::getVec() * N2::gf; ~~~~~~~~~~~~^~~~~~ The call to the class member function requires an object, or we ned to make the function static. This update makes the function static. This also fixes SPIR-V validation: without this change the call to that getVec does not have enough arguments: error: line 69: OpFunctionCall Function <id>'s parameter count does not match the argument count. %43 = OpFunctionCall %v4float %N2__N3__C1__getVec_
24 lines
462 B
GLSL
24 lines
462 B
GLSL
static float4 v1;
|
|
static float4 v2;
|
|
|
|
namespace N1 {
|
|
float4 getVec() { return v1; }
|
|
}
|
|
|
|
namespace N2 {
|
|
static float gf;
|
|
float4 getVec() { return v2; }
|
|
namespace N3 {
|
|
float4 getVec() { return v2; }
|
|
|
|
class C1 {
|
|
static float4 getVec() { return v2; }
|
|
};
|
|
}
|
|
}
|
|
|
|
float4 main() : SV_Target0
|
|
{
|
|
return N1::getVec() + N2::getVec() + N2::N3::getVec() + N2::N3::C1::getVec() * N2::gf;
|
|
}
|