SPV: Add OpSource shader source code and file name.
diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp
index 8a6b12d..ef47662 100644
--- a/StandAlone/StandAlone.cpp
+++ b/StandAlone/StandAlone.cpp
@@ -91,6 +91,7 @@
EOptionHlslOffsets = (1 << 23),
EOptionHlslIoMapping = (1 << 24),
EOptionAutoMapLocations = (1 << 25),
+ EOptionDebug = (1 << 26),
};
//
@@ -448,6 +449,9 @@
} else
Error("no <entry-point> provided for -e");
break;
+ case 'g':
+ Options |= EOptionDebug;
+ break;
case 'h':
usage();
break;
@@ -539,6 +543,8 @@
messages = (EShMessages)(messages | EShMsgKeepUncalled);
if (Options & EOptionHlslOffsets)
messages = (EShMessages)(messages | EShMsgHlslOffsets);
+ if (Options & EOptionDebug)
+ messages = (EShMessages)(messages | EShMsgDebugInfo);
}
//
@@ -722,7 +728,10 @@
std::vector<unsigned int> spirv;
std::string warningsErrors;
spv::SpvBuildLogger logger;
- glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv, &logger);
+ glslang::SpvOptions spvOptions;
+ if (Options & EOptionDebug)
+ spvOptions.generateDebugInfo = true;
+ glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv, &logger, &spvOptions);
// Dump the spv to a file or stdout, etc., but only if not doing
// memory/perf testing, as it's not internal to programmatic use.
@@ -1031,6 +1040,7 @@
" (default is ES version 100)\n"
" -D input is HLSL\n"
" -e specify entry-point name\n"
+ " -g generate debug information\n"
" -h print this usage message\n"
" -i intermediate tree (glslang AST) is printed out\n"
" -l link all input files together to form a single module\n"