Enable debug information for Vulkan shaders (#3193)

* Enable debug information for Vulkan shaders

* Enable debug information for Metal shaders
This commit is contained in:
Edu Garcia 2023-11-06 19:14:29 +00:00 committed by GitHub
parent a23b128ae2
commit b01c5d597a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 4 deletions

View File

@ -199,9 +199,12 @@ Options:
--varyingdef <file path> A varying.def.sc's file path.
--verbose Be verbose.
(DX9 and DX11 only):
(Vulkan, DirectX and Metal):
--debug Debug information.
(DirectX only):
--disasm Disassemble a compiled shader.
-O <level> Set optimization level.
Can be 03.

View File

@ -1054,10 +1054,15 @@ namespace bgfx
" --verbose Be verbose.\n"
"\n"
"(DX9 and DX11 only):\n"
"(Vulkan, DirectX and Metal):\n"
"\n"
" --debug Debug information.\n"
"\n"
"(DirectX only):\n"
"\n"
" --disasm Disassemble compiled shader.\n"
" -O <level> Set optimization level. Can be 0 to 3.\n"
" --Werror Treat warnings as errors.\n"

View File

@ -286,6 +286,7 @@ namespace bgfx { namespace metal
| EShMsgReadHlsl
| EShMsgVulkanRules
| EShMsgSpvRules
| EShMsgDebugInfo
);
shader->setEntryPoint("main");
@ -494,7 +495,10 @@ namespace bgfx { namespace metal
std::vector<uint32_t> spirv;
glslang::SpvOptions options;
options.disableOptimizer = false;
options.disableOptimizer = _options.debugInformation;
options.generateDebugInfo = _options.debugInformation;
options.emitNonSemanticShaderDebugInfo = _options.debugInformation;
options.emitNonSemanticShaderDebugSource = _options.debugInformation;
glslang::GlslangToSpv(*intermediate, spirv, &options);

View File

@ -461,6 +461,7 @@ namespace bgfx { namespace spirv
| EShMsgReadHlsl
| EShMsgVulkanRules
| EShMsgSpvRules
| EShMsgDebugInfo
);
shader->setEntryPoint("main");
@ -704,7 +705,10 @@ namespace bgfx { namespace spirv
std::vector<uint32_t> spirv;
glslang::SpvOptions options;
options.disableOptimizer = false;
options.disableOptimizer = _options.debugInformation;
options.generateDebugInfo = _options.debugInformation;
options.emitNonSemanticShaderDebugInfo = _options.debugInformation;
options.emitNonSemanticShaderDebugSource = _options.debugInformation;
glslang::GlslangToSpv(*intermediate, spirv, &options);