From 109e524d5c6b53415223636666a46df82bfde42f Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 11 Feb 2026 16:52:20 +0000 Subject: [PATCH] Improve cross-module references in docstrings --- docs/verify-docstrings.py | 13 +++++++++++-- qrenderdoc/Code/Interface/PersistantConfig.h | 6 +++--- renderdoc/api/replay/replay_enums.h | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/verify-docstrings.py b/docs/verify-docstrings.py index 4aa356c86..7d907d8ad 100644 --- a/docs/verify-docstrings.py +++ b/docs/verify-docstrings.py @@ -234,7 +234,8 @@ def check_used_types(objname, module, used_types): print(" - Maybe missing namespace to refer to renderdoc.{}?".format(type_name)) break -for mod_name in ['renderdoc', 'qrenderdoc']: +check_mods = ['renderdoc', 'qrenderdoc'] +for mod_name in check_mods: mod = sys.modules[mod_name] if args.verbose: print("===== Checks for {} =====".format(mod_name)) @@ -350,7 +351,15 @@ for mod_name in ['renderdoc', 'qrenderdoc']: type_name = re.sub('StructuredObjectList', 'List[SDObject]', type_name) type_name = re.sub('StructuredChunkList', 'List[SDChunk]', type_name) type_name = re.sub('^builtins.', '', type_name) - type_name = re.sub('^importlib._bootstrap.', '', type_name) + + if 'importlib._bootstrap' in type_name: + type_name = re.sub('^importlib._bootstrap.', '', type_name) + real_module = [ + m for m in check_mods if type_name in sys.modules[m].__dict__ + ][0] + if real_module != mod_name: + type_name = f"{real_module}.{type_name}" + type_name = re.sub('datetime.datetime', 'datetime', type_name) if type_name == 'NoneType': diff --git a/qrenderdoc/Code/Interface/PersistantConfig.h b/qrenderdoc/Code/Interface/PersistantConfig.h index 9d9e8779c..3212c68c3 100644 --- a/qrenderdoc/Code/Interface/PersistantConfig.h +++ b/qrenderdoc/Code/Interface/PersistantConfig.h @@ -82,7 +82,7 @@ struct ShaderProcessingTool } DOCUMENT(R"(The :class:`KnownShaderTool` identifying which known tool this program is. -:type: KnownShaderTool +:type: renderdoc.KnownShaderTool )"); KnownShaderTool tool = KnownShaderTool::Unknown; DOCUMENT(R"(The human-readable name of the program. @@ -102,12 +102,12 @@ struct ShaderProcessingTool rdcstr args; DOCUMENT(R"(The input that this program expects. -:type: ShaderEncoding +:type: renderdoc.ShaderEncoding )"); ShaderEncoding input = ShaderEncoding::Unknown; DOCUMENT(R"(The output that this program provides. -:type: ShaderEncoding +:type: renderdoc.ShaderEncoding )"); ShaderEncoding output = ShaderEncoding::Unknown; diff --git a/renderdoc/api/replay/replay_enums.h b/renderdoc/api/replay/replay_enums.h index bf433329c..6c511bf22 100644 --- a/renderdoc/api/replay/replay_enums.h +++ b/renderdoc/api/replay/replay_enums.h @@ -2202,7 +2202,7 @@ tool. :param KnownShaderTool tool: The tool to get the input encoding for. :return: The encoding that this tool expects as an input by default. -:rtype: renderdoc.ShaderEncoding +:rtype: ShaderEncoding )"); constexpr inline ShaderEncoding ToolInput(KnownShaderTool tool) { @@ -2229,7 +2229,7 @@ tool. :param KnownShaderTool tool: The tool to get the output encoding for. :return: The encoding that this tool produces as an output by default. -:rtype: renderdoc.ShaderEncoding +:rtype: ShaderEncoding )"); constexpr inline ShaderEncoding ToolOutput(KnownShaderTool tool) {