Hello,
in my engine i'm using uber GLSL shaders with specialization constants, which are declared like this:
layout(constant_id = 10)const bool VARIANT_HAS_ALBEDO_MAP = false;
layout(constant_id = 11)const bool VARIANT_HAS_OCCLUSION_MAP = false;
layout(constant_id = 12)const bool VARIANT_HAS_EMISSIVE_MAP = false;
layout(constant_id = 13)const bool VARIANT_HAS_VERTEX_UV0 = false;
layout(constant_id = 14)const bool VARIANT_HAS_VERTEX_UV1 = false;
layout(constant_id = 15)const bool VARIANT_HAS_TEXTURE_TRANSFORM = false;
layout(constant_id = 16)const bool VARIANT_HAS_CHROMA_KEY = false;
Inside the code i'm using them this way:
if (VARIANT_HAS_VERTEX_UV0 && VARIANT_HAS_VERTEX_UV1)
{
uv = vec4(getUV0(), getUV1());
}
else
if (VARIANT_HAS_VERTEX_UV0 && !VARIANT_HAS_VERTEX_UV1)
{
uv = vec4(getUV0(), getUV0());
}
else
if (!VARIANT_HAS_VERTEX_UV0 && VARIANT_HAS_VERTEX_UV1)
{
uv = vec4(getUV1(), getUV1());
}
And for some reason tint spir-v reader doesn't like this and throwns errors:
error: unhandled expression for ID 348
%348 = OpSpecConstantOp %37 LogicalAnd %346 %347
error: unhandled expression for ID 374
%374 = OpSpecConstantOp %40 LogicalAnd %372 %373
If i modify my code this way (without specializations):
uv = vec4(getUV0(), getUV0());
Then it parses fine, without errors.
What is wrong with my code? Why WGSL compiler doesn't like this ?
Regards,
Andrey