diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp index 95f7844d28..895779c8a5 100644 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp @@ -1026,7 +1026,7 @@ IShaderViewer *PipelineStateViewer::EditOriginalShaderSource(ResourceId id, files.push_back(make_rdcpair(s.filename, s.contents)); } - return EditShader(id, shaderDetails->stage, shaderDetails->entryPoint, + return EditShader(id, shaderDetails->stage, shaderDetails->debugInfo.entrySourceName, shaderDetails->debugInfo.compileFlags, shaderDetails->debugInfo.compiler, shaderDetails->debugInfo.encoding, files); } diff --git a/renderdoc/api/replay/shader_types.h b/renderdoc/api/replay/shader_types.h index 4d05bc3c01..5a644d0200 100644 --- a/renderdoc/api/replay/shader_types.h +++ b/renderdoc/api/replay/shader_types.h @@ -1440,6 +1440,13 @@ The first entry in the list is always the file where the entry point is. )"); rdcarray files; + DOCUMENT(R"(The name of the entry point in the source code, not necessarily the same as the +entry point name exported to the API. + +:type: str +)"); + rdcstr entrySourceName; + DOCUMENT(R"(The source location of the first executable line or the entry point. .. note:: diff --git a/renderdoc/driver/gl/gl_shader_refl.cpp b/renderdoc/driver/gl/gl_shader_refl.cpp index f8f31c660a..2ef7cbf5ad 100644 --- a/renderdoc/driver/gl/gl_shader_refl.cpp +++ b/renderdoc/driver/gl/gl_shader_refl.cpp @@ -1228,7 +1228,7 @@ void MakeShaderReflection(GLenum shadType, GLuint sepProg, ShaderReflection &ref const FixedFunctionVertexOutputs &outputUsage) { refl.stage = MakeShaderStage(shadType); - refl.entryPoint = "main"; + refl.debugInfo.entrySourceName = refl.entryPoint = "main"; refl.encoding = ShaderEncoding::GLSL; refl.debugInfo.compiler = KnownShaderTool::Unknown; refl.debugInfo.encoding = ShaderEncoding::GLSL; diff --git a/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp b/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp index c572fbbf6d..f86afafd09 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp @@ -285,11 +285,11 @@ void MakeShaderReflection(DXBC::DXBCContainer *dxbc, ShaderReflection *refl, break; } - refl->entryPoint = "main"; + refl->debugInfo.entrySourceName = refl->entryPoint = "main"; if(dxbc->GetDebugInfo()) { - refl->entryPoint = dxbc->GetDebugInfo()->GetEntryFunction(); + refl->debugInfo.entrySourceName = refl->entryPoint = dxbc->GetDebugInfo()->GetEntryFunction(); refl->debugInfo.encoding = ShaderEncoding::HLSL; diff --git a/renderdoc/driver/shaders/spirv/spirv_reflect.cpp b/renderdoc/driver/shaders/spirv/spirv_reflect.cpp index cabbaea8df..19b2bda926 100644 --- a/renderdoc/driver/shaders/spirv/spirv_reflect.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_reflect.cpp @@ -684,6 +684,8 @@ void Reflector::RegisterOp(Iter it) { LineColumnInfo &info = debugFuncToLocation[dbg.result]; + debugFuncName[dbg.result] = strings[dbg.arg(0)]; + // check this source file exists - we won't have registered it if there was no source code auto srcit = debugSources.find(dbg.arg(2)); if(srcit != debugSources.end()) @@ -1029,10 +1031,15 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st reflection.debugInfo.compileFlags.flags.push_back( {"@spirver", StringFormat::Fmt("spirv%d.%d", m_MajorVersion, m_MinorVersion)}); + reflection.debugInfo.entrySourceName = entryPoint; + { auto it = funcToDebugFunc.find(entry->id); if(it != funcToDebugFunc.end()) { + rdcstr debugEntryName = debugFuncName[it->second]; + if(!debugEntryName.empty()) + reflection.debugInfo.entrySourceName = debugEntryName; reflection.debugInfo.entryLocation = debugFuncToLocation[it->second]; if(debugFuncToCmdLine.find(it->second) != debugFuncToCmdLine.end()) reflection.debugInfo.compileFlags.flags = {{"@cmdline", debugFuncToCmdLine[it->second]}}; diff --git a/renderdoc/driver/shaders/spirv/spirv_reflect.h b/renderdoc/driver/shaders/spirv/spirv_reflect.h index b1d2c8d4fb..55f1a8eb9b 100644 --- a/renderdoc/driver/shaders/spirv/spirv_reflect.h +++ b/renderdoc/driver/shaders/spirv/spirv_reflect.h @@ -140,6 +140,7 @@ class Reflector : public Processor SparseIdMap debugFuncToBaseFile; SparseIdMap debugFuncToCmdLine; SparseIdMap debugFuncToLocation; + SparseIdMap debugFuncName; SparseIdMap funcToDebugFunc; Id curBlock; diff --git a/renderdoc/replay/renderdoc_serialise.inl b/renderdoc/replay/renderdoc_serialise.inl index 1a3ca2459d..460a04aa5d 100644 --- a/renderdoc/replay/renderdoc_serialise.inl +++ b/renderdoc/replay/renderdoc_serialise.inl @@ -275,7 +275,7 @@ void DoSerialise(SerialiserType &ser, ShaderDebugInfo &el) SERIALISE_MEMBER(sourceDebugInformation); SERIALISE_MEMBER(debugStatus); - SIZE_CHECK(112); + SIZE_CHECK(136); } template @@ -310,7 +310,7 @@ void DoSerialise(SerialiserType &ser, ShaderReflection &el) SERIALISE_MEMBER(taskPayload); - SIZE_CHECK(456); + SIZE_CHECK(480); } template