diff options
author | quou <quou@disroot.org> | 2025-01-05 22:15:22 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2025-01-05 22:15:22 +1100 |
commit | bce070eba418c8a79f6affcd885564babbf8c9d3 (patch) | |
tree | 70fd5b4a57091cb5d6c4b47c1b29c98ba7b54062 /sc/sc.cpp | |
parent | 925a2707c1f2d0f5e256f6e70050b7b2242d99e8 (diff) |
source level shader debugging
Diffstat (limited to 'sc/sc.cpp')
-rw-r--r-- | sc/sc.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -508,6 +508,7 @@ struct Desc { std::vector<uint32_t> compile_shader( Desc& d, + const char* fname, const char* presrc, const char* src, const char* define, @@ -532,6 +533,9 @@ std::vector<uint32_t> compile_shader( #ifdef DEBUG options.disableOptimizer = true; options.generateDebugInfo = true; + options.emitNonSemanticShaderDebugInfo = true; + options.emitNonSemanticShaderDebugSource = true; + options.stripDebugInfo = false; #else options.disableOptimizer = false; options.stripDebugInfo = true; @@ -541,6 +545,14 @@ std::vector<uint32_t> compile_shader( shader.setEnvClient(glslang::EShClientVulkan, client_version); shader.setEnvTarget(glslang::EShTargetSpv, target_version); shader.setEntryPoint(d.entrypoints[stage].c_str()); +#ifdef DEBUG + shader.setDebugInfo(true); + shader.setSourceEntryPoint(d.entrypoints[stage].c_str()); + shader.setSourceFile(fname); + shader.addSourceText(src, strlen(src)); +#else + (void)fname; +#endif if (!shader.preprocess( GetDefaultResources(), glsl_version, @@ -599,6 +611,7 @@ void configure( } void compile_shaders( + const char* fname, std::vector<uint32_t>* spv, const char* src, Desc& d @@ -612,6 +625,7 @@ void compile_shaders( configure(d, i, define, lang, ps); spv[i] = compile_shader( d, + fname, ps.c_str(), src, define, @@ -718,7 +732,7 @@ int main(int argc, const char** argv) { desc_src = get_desc(src); cdesc = parse_desc(dp_mem, desc_src.c_str()); desc.build(cdesc); - compile_shaders(spv, src, desc); + compile_shaders(argv[2], spv, src, desc); write_csh(argv[2], desc, spv); return 0; } |