Skip to content

Commit

Permalink
Enable debug information for Metal shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcnor authored Nov 6, 2023
1 parent 257de75 commit 8786426
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Options:
--varyingdef <file path> A varying.def.sc's file path.
--verbose Be verbose.

(Vulkan and DirectX):
(Vulkan, DirectX and Metal):

--debug Debug information.

Expand Down
2 changes: 1 addition & 1 deletion tools/shaderc/shaderc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ namespace bgfx
" --verbose Be verbose.\n"

"\n"
"(Vulkan and DirectX):\n"
"(Vulkan, DirectX and Metal):\n"

"\n"
" --debug Debug information.\n"
Expand Down
6 changes: 5 additions & 1 deletion tools/shaderc/shaderc_metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ namespace bgfx { namespace metal
| EShMsgReadHlsl
| EShMsgVulkanRules
| EShMsgSpvRules
| EShMsgDebugInfo
);

shader->setEntryPoint("main");
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 8786426

Please sign in to comment.