From 85028e146914290bf68a8243ee8dc7f696356d59 Mon Sep 17 00:00:00 2001 From: Cort Stratton Date: Thu, 30 Jun 2016 12:51:10 -0700 Subject: [PATCH] When parsing Vulkan GLSL, suggest gl_VertexIndex/gl_InstanceIndex instead of gl_VertexID/gl_InstanceID. --- glslang/MachineIndependent/ParseHelper.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index fe22ff80..b01d773f 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -1930,7 +1930,13 @@ void TParseContext::variableCheck(TIntermTyped*& nodePtr) return; 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 if (symbol->getName().size() > 0) {