diff options
| author | ettehn <141814824+ettehn@users.noreply.github.com> | 2026-11-24 11:02:23 +0800 |
|---|---|---|
| committer | ettehn <141814824+ettehn@users.noreply.github.com> | 2026-11-24 11:28:30 +0800 |
| commit | f8a88299e1dfd09195e129a1d14970e2b532ef2b (patch) | |
| tree | 5938ae2bf4a64083bebccae8da44c44724448bf8 /tools/spirv_asm.py | |
| parent | d478a92d4d7eae1d7b512cb4553ddc4fbc300e85 (diff) | |
Support named SPIR-V shader debug instructions
Carry forward old Leonida PR #4744 for BUILD-SPIRV-DEBUGINFO.
Diffstat (limited to 'tools/spirv_asm.py')
| -rw-r--r-- | tools/spirv_asm.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/spirv_asm.py b/tools/spirv_asm.py index 49d0809e1..e32dd83af 100644 --- a/tools/spirv_asm.py +++ b/tools/spirv_asm.py | |||
| @@ -30,7 +30,8 @@ if _HERE not in sys.path: | |||
| 30 | sys.path.insert(0, _HERE) | 30 | sys.path.insert(0, _HERE) |
| 31 | 31 | ||
| 32 | from spirv_asm_tables import ( # noqa: E402 | 32 | from spirv_asm_tables import ( # noqa: E402 |
| 33 | BIT_ENUMS, GLSL_STD_450, INSTRUCTIONS, NONSEMANTIC_DEBUGPRINTF, VALUE_ENUMS, | 33 | BIT_ENUMS, GLSL_STD_450, INSTRUCTIONS, NONSEMANTIC_DEBUGPRINTF, |
| 34 | NONSEMANTIC_SHADER_DEBUGINFO_100, VALUE_ENUMS, | ||
| 34 | ) | 35 | ) |
| 35 | 36 | ||
| 36 | SPIRV_MAGIC = 0x07230203 | 37 | SPIRV_MAGIC = 0x07230203 |
| @@ -54,6 +55,7 @@ TARGET_ENV_VERSION = { | |||
| 54 | _ID_KINDS = frozenset(("IdRef", "IdResult", "IdResultType", "IdScope", "IdMemorySemantics")) | 55 | _ID_KINDS = frozenset(("IdRef", "IdResult", "IdResultType", "IdScope", "IdMemorySemantics")) |
| 55 | _ID_RE = re.compile(r"%[A-Za-z0-9_]+") | 56 | _ID_RE = re.compile(r"%[A-Za-z0-9_]+") |
| 56 | _EXT_SETS = { | 57 | _EXT_SETS = { |
| 58 | "NonSemantic.Shader.DebugInfo.100": NONSEMANTIC_SHADER_DEBUGINFO_100, | ||
| 57 | "GLSL.std.450": GLSL_STD_450, | 59 | "GLSL.std.450": GLSL_STD_450, |
| 58 | "NonSemantic.DebugPrintf": NONSEMANTIC_DEBUGPRINTF, # spirv-dis writes its instruction by name | 60 | "NonSemantic.DebugPrintf": NONSEMANTIC_DEBUGPRINTF, # spirv-dis writes its instruction by name |
| 59 | } | 61 | } |
| @@ -638,7 +640,7 @@ def _assemble(instructions, version: int, track_switch_types: bool) -> bytes: | |||
| 638 | 640 | ||
| 639 | cur_ext_table = None | 641 | cur_ext_table = None |
| 640 | switch_type = None # (width, signed) of the OpSwitch selector's integer type | 642 | switch_type = None # (width, signed) of the OpSwitch selector's integer type |
| 641 | if opname == "OpExtInst" and arg_idx < len(toks): | 643 | if opname in ("OpExtInst", "OpExtInstWithForwardRefsKHR") and arg_idx < len(toks): |
| 642 | cur_ext_table = ext_imports.get(get_id(toks[arg_idx], lineno)) | 644 | cur_ext_table = ext_imports.get(get_id(toks[arg_idx], lineno)) |
| 643 | elif opname == "OpSwitch" and arg_idx < len(toks): | 645 | elif opname == "OpSwitch" and arg_idx < len(toks): |
| 644 | sel_id = get_id(toks[arg_idx], lineno) | 646 | sel_id = get_id(toks[arg_idx], lineno) |