Commit 85028e14 by Cort Stratton

When parsing Vulkan GLSL, suggest gl_VertexIndex/gl_InstanceIndex instead of…

When parsing Vulkan GLSL, suggest gl_VertexIndex/gl_InstanceIndex instead of gl_VertexID/gl_InstanceID.
parent af151f96
...@@ -1930,7 +1930,13 @@ void TParseContext::variableCheck(TIntermTyped*& nodePtr) ...@@ -1930,7 +1930,13 @@ void TParseContext::variableCheck(TIntermTyped*& nodePtr)
return; return;
if (symbol->getType().getBasicType() == EbtVoid) { if (symbol->getType().getBasicType() == EbtVoid) {
error(symbol->getLoc(), "undeclared identifier", symbol->getName().c_str(), ""); const char *extraInfoFormat = "";
if (spvVersion.vulkan != 0 && symbol->getName() == "gl_VertexID") {
extraInfoFormat = "(Did you mean gl_VertexIndex?)";
} else if (spvVersion.vulkan != 0 && symbol->getName() == "gl_InstanceID") {
extraInfoFormat = "(Did you mean gl_InstanceIndex?)";
}
error(symbol->getLoc(), "undeclared identifier", symbol->getName().c_str(), extraInfoFormat);
// Add to symbol table to prevent future error messages on the same name // Add to symbol table to prevent future error messages on the same name
if (symbol->getName().size() > 0) { if (symbol->getName().size() > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment