From 165f7b09afa8f3d23bc08ef147d91bee99d7e782 Mon Sep 17 00:00:00 2001 From: triggered02 <153171514+triggered02@users.noreply.github.com> Date: Tue, 24 Nov 2026 17:39:41 +0530 Subject: [PATCH 1/4] =?UTF-8?q?=EF=BB=BFstartup-d3d12:=20load=20validated?= =?UTF-8?q?=20compute=20modules=20by=20key=20from=20the=20shader=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step (b) of the #1412 rework. Device slot 62 no longer inspects bytes: it hashes the container the same way the graphics path does (fnv_bytes over the CS bytecode) and looks for `.cs.cso` in X2W_SHADER_CACHE, which is where the offline retarget/sign/gate step publishes validated desktop modules. A hit builds a real CreateComputePipelineState from those bytes with the unwrapped root signature; a miss keeps the placeholder and logs "no validated module". Nothing else changes: the dispatch path is still inert (slot 14 not installed), so no behaviour moves until the two-arm readback proves it. Offline publication of `.cs.cso`, the compute root bindings and the readback fixture are the remaining steps. Builds clean; startup_stubs passes. --- src/startup_stubs/d3d12_xs_device.cpp | 52 ++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/src/startup_stubs/d3d12_xs_device.cpp b/src/startup_stubs/d3d12_xs_device.cpp index 37ac888e7c..b4b0f56343 100644 --- a/src/startup_stubs/d3d12_xs_device.cpp +++ b/src/startup_stubs/d3d12_xs_device.cpp @@ -6012,10 +6012,11 @@ void dump_containers(const char* what, const void* desc, std::size_t bytes) HRESULT __stdcall placeholder_ok(Wrapper*, u64, u64, u64) { return S_OK; } // Device slot 62 (Xbox order): (D3D12_COMPUTE_PIPELINE_STATE_DESC*, 0, 0, riid, ppv); first seen from -// XboxBvhBuilder.dll, followed by SetName on the result. The bytecode is console GPU code, not DXIL, -// so no desktop pipeline is built: the result is a placeholder PipelineState until shader translation -// exists. Logs the root signature, bytecode address, length and first 32 bytes. -HRESULT __stdcall device_create_compute_pipeline_x(Wrapper*, const D3D12_COMPUTE_PIPELINE_STATE_DESC* desc, u64 extra0, +// XboxBvhBuilder.dll, followed by SetName on the result. With render mode a validated module published +// under the container's hash in the shader cache is loaded, so the result is a real desktop pipeline; +// without one it stays a placeholder PipelineState. Logs the root signature, bytecode address, length +// and first 32 bytes. +HRESULT __stdcall device_create_compute_pipeline_x(Wrapper* self, const D3D12_COMPUTE_PIPELINE_STATE_DESC* desc, u64 extra0, u64 extra1, const GUID* iid, void** out) { char text[48]; @@ -6026,15 +6027,50 @@ HRESULT __stdcall device_create_compute_pipeline_x(Wrapper*, const D3D12_COMPUTE dump_containers("compute", desc, sizeof(*desc)); char bytes[3 * 32 + 1]; hex_text(desc->CS.pShaderBytecode, desc->CS.BytecodeLength < 32 ? desc->CS.BytecodeLength : 32, bytes, sizeof(bytes)); + // A validated compute module is loaded by key from the shader cache, exactly as graphics + // translations are: the offline retarget/sign/gate step decides usability, so there is no + // runtime byte inspection here, and the placeholder is kept when no validated module exists. + ID3D12PipelineState* real_pipeline = nullptr; + char why[128] = ""; + if (render_mode()) { + wchar_t path[MAX_PATH]; + const u64 compute_key = desc->CS.pShaderBytecode && desc->CS.BytecodeLength + ? fnv_bytes(desc->CS.pShaderBytecode, desc->CS.BytecodeLength) : 0; + ID3DBlob* blob = nullptr; + if (!compute_key || !cache_path(path, L"", compute_key, L".cs.cso") || + FAILED(D3DReadFileToBlob(path, &blob)) || !blob) { + std::snprintf(why, sizeof(why), "no validated module"); + } else { + D3D12_COMPUTE_PIPELINE_STATE_DESC compute{}; + compute.pRootSignature = + reinterpret_cast(unwrap(reinterpret_cast(desc->pRootSignature))); + compute.CS.pShaderBytecode = blob->GetBufferPointer(); + compute.CS.BytecodeLength = blob->GetBufferSize(); + compute.NodeMask = desc->NodeMask; + compute.CachedPSO = desc->CachedPSO; + compute.Flags = D3D12_PIPELINE_STATE_FLAG_NONE; + const HRESULT built = device_of(self)->CreateComputePipelineState(&compute, IID_PPV_ARGS(&real_pipeline)); + blob->Release(); + if (FAILED(built)) { + real_pipeline = nullptr; + std::snprintf(why, sizeof(why), "CreateComputePipelineState 0x%08lx", static_cast(built)); + } + } + } static LONG calls; if (first_calls(calls, 24)) log("x2w-d3d12 Device::slot62(CreateComputePipelineState?) root=%p cs=%p len=0x%llx node=0x%x flags=0x%x extra=0x%llx,0x%llx " - "riid=%s -> placeholder [%s]", static_cast(desc->pRootSignature), desc->CS.pShaderBytecode, - static_cast(desc->CS.BytecodeLength), desc->NodeMask, desc->Flags, extra0, extra1, text, bytes); + "riid=%s -> %s%s [%s]", static_cast(desc->pRootSignature), desc->CS.pShaderBytecode, + static_cast(desc->CS.BytecodeLength), desc->NodeMask, desc->Flags, extra0, extra1, text, + real_pipeline ? "REAL desktop pipeline" : "placeholder: ", real_pipeline ? "" : why, bytes); if (kind_for(*iid) != pipeline_kind) return E_NOINTERFACE; - *out = wrap(nullptr, pipeline_kind); - if (!*out) return E_OUTOFMEMORY; + *out = wrap(real_pipeline, pipeline_kind); + if (!*out) { + if (real_pipeline) real_pipeline->Release(); + return E_OUTOFMEMORY; + } auto* pipeline = static_cast(*out); + pipeline->own().compute_pipeline = real_pipeline != nullptr; note_pipeline(pipeline, 62, nullptr, desc, sizeof(*desc)); note_compute_binding_pipeline(pipeline, *desc); return S_OK; From 481f7f4b39892e0a38996804f7ffabcc65c92b77 Mon Sep 17 00:00:00 2001 From: triggered02 <153171514+triggered02@users.noreply.github.com> Date: Tue, 24 Nov 2026 17:43:43 +0530 Subject: [PATCH 2/4] =?UTF-8?q?=EF=BB=BFstartup-d3d12:=20publish=20compute?= =?UTF-8?q?=20modules=20under=20the=20key=20the=20runtime=20looks=20them?= =?UTF-8?q?=20up=20by?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step (a) of the #1412 rework: tools/startup/compute_cache.py turns the containers the stand-in dumps into the `.cs.cso` files that device slot 62 loads, and records `.fail` with the reason when the existing validated path refuses a module. The retarget/gate/validate/sign decision stays in tools/dxil_retarget.py - this tool only supplies the naming and the refusal record, so validation does not get re-implemented at the runtime. The key is FNV-1a 64 over the shader bytes rendered as 16 hex digits, matching the stand-in's fnv_bytes/cache_path (d3d12_draw.inl), and tests/startup_compute_cache_check.py (ctest startup_compute_cache) pins it in both directions plus the refusal behaviour. Note recorded in the test and worth a maintainer's look: the seed in fnv_bytes is 1469598103934665603, which is a digit short of the canonical FNV-1a 64 offset basis (14695981039346656037). The cache is keyed by whatever the runtime computes, so the publisher matches the runtime rather than the spec; if that constant was a typo it should be corrected deliberately, not as a side effect of this work. --- CMakeLists.txt | 4 ++ tests/startup_compute_cache_check.py | 75 ++++++++++++++++++++ tools/startup/compute_cache.py | 101 +++++++++++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 tests/startup_compute_cache_check.py create mode 100644 tools/startup/compute_cache.py diff --git a/CMakeLists.txt b/CMakeLists.txt index a2c7fd6526..929e3bb2dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3259,6 +3259,10 @@ if(EXISTS "${INTAKE_PYTHON}") add_test(NAME runtime_startup_live_view_cli_check COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_live_view_cli_check.py") set_tests_properties(runtime_startup_live_view_cli_check PROPERTIES TIMEOUT 60) + # The compute shader cache publisher (tools/startup/compute_cache.py) must derive the same key + # the stand-in computes for .cs.cso, or every compute lookup silently misses (#1412). + add_test(NAME startup_compute_cache COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_compute_cache_check.py") add_test(NAME startup_uniform_lane COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_uniform_lane_check.py") # NGG primitive-shader cases (#1723): identity triangle against single-change contrasts, reference model. diff --git a/tests/startup_compute_cache_check.py b/tests/startup_compute_cache_check.py new file mode 100644 index 0000000000..ea48c3920f --- /dev/null +++ b/tests/startup_compute_cache_check.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +"""Control for the compute-cache publisher (tools/startup/compute_cache.py). + +Device slot 62 loads ``.cs.cso`` from ``X2W_SHADER_CACHE`` where the key is FNV-1a 64 over the +shader bytes, formatted as 16 lowercase hex digits (the graphics translation path in +``src/startup_stubs/d3d12_draw.inl`` uses the same helper and format). If this tool computed the key +differently, every lookup would miss and the pipeline would silently stay a placeholder, so the key is +pinned here against the published FNV-1a 64 vectors and against the C++ constant. + +The publisher must also record a refusal rather than publish an unusable module: a file that is not a +DXBC container gets ``.fail`` and no ``.cs.cso``. + +The runtime seed is deliberately pinned as it is written in ``d3d12_draw.inl``: 1469598103934665603. +That is *not* the canonical FNV-1a 64 offset basis (14695981039346656037) - it is a digit short. The +values below are therefore computed from the runtime's seed, because the cache is looked up by +whatever the runtime computes; changing the seed would silently invalidate every cached translation. +""" +import subprocess +import sys +from pathlib import Path +from tempfile import TemporaryDirectory + +sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tools" / "startup")) +import compute_cache + +failures = [] + + +def check(label, condition): + print("%s: %s" % (label, "ok" if condition else "MISMATCH")) + if not condition: + failures.append(label) + + +def main(): + # Pinned to the runtime's seed as written, not to the FNV specification: the runtime computes these + # digits (d3d12_draw.inl fnv_bytes) and uses them as the cache file name. + check("runtime seed is the one the stand-in uses", compute_cache.BASIS == 1469598103934665603) + check("empty input hashes to the runtime seed", compute_cache.key_of(b"") == 0x14650FB0739D0383) + check("'a' hashes as the runtime would", compute_cache.key_text(b"a") == "44bd8ad473cd9906") + check("'abc' hashes as the runtime would", compute_cache.key_text(b"abc") == "e16801510db89efd") + check("key text is 16 lowercase hex digits", len(compute_cache.key_text(b"abc")) == 16) + + with TemporaryDirectory() as directory: + root = Path(directory) + pending, cache = root / "pending", root / "cache" + pending.mkdir() + cache.mkdir() + (pending / "deadbeef.dxbc").write_bytes(b"not a container at all") + + original = compute_cache.publish_one + # The refusal path must not need the retarget tool at all. + line = compute_cache.publish_one(pending / "deadbeef.dxbc", cache, None, Path("unused.py")) + check("a non-container is refused", "refused" in line and "not a DXBC container" in line) + key = compute_cache.key_text((pending / "deadbeef.dxbc").read_bytes()) + check("a refusal is recorded under the same key", (cache / (key + ".fail")).is_file()) + check("a refusal publishes no module", not (cache / (key + ".cs.cso")).exists()) + + # With no containers at all the tool reports that rather than failing. + empty = subprocess.run([sys.executable, "-B", str(Path(compute_cache.__file__)), + "--pending", str(pending), "--cache", str(cache), + "--retarget", str(Path(compute_cache.__file__))], + capture_output=True, text=True) + check("the tool runs and reports what it did", empty.returncode == 0 or "refused" in empty.stdout) + compute_cache.publish_one = original + + if failures: + print("FAIL: %d case(s)" % len(failures)) + return 1 + print("PASS") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) \ No newline at end of file diff --git a/tools/startup/compute_cache.py b/tools/startup/compute_cache.py new file mode 100644 index 0000000000..2f4c72d6dd --- /dev/null +++ b/tools/startup/compute_cache.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 +"""Publish validated desktop compute modules under the key the runtime looks them up by. + +Device slot 62 in the D3D12 stand-in does not inspect bytecode: it hashes the container the way the +graphics translation path does (FNV-1a 64 over the shader bytes, formatted ``%016llx``) and loads +``.cs.cso`` from ``X2W_SHADER_CACHE``. This tool produces those files. + +The decision about whether a module may run on the desktop is *not* made here: it is made by the +existing validated path in ``tools/dxil_retarget.py`` (retarget the target triple, gate ``xbox.*`` +symbols, validate container and module, re-sign). This tool only supplies the naming and the +refusal record, so the runtime never has to re-implement validation. + +usage: compute_cache.py --pending --cache --probe + [--retarget ] + +``--pending`` is the directory the stand-in dumps containers into (``X2W_SHADER_DUMP_DIR``); each +``*.dxbc`` file is content-addressed by the container checksum and is exactly the byte string the +runtime hashes, so the key can be recomputed here. +""" +import argparse +import subprocess +import sys +from pathlib import Path + +BASIS = 1469598103934665603 +PRIME = 1099511628211 + + +def key_of(data: bytes) -> int: + """The runtime's FNV-1a 64: instantiate with BASIS, multiply by PRIME after every xor.""" + value = BASIS + for byte in data: + value = ((value ^ byte) * PRIME) & 0xFFFFFFFFFFFFFFFF + return value + + +def key_text(data: bytes) -> str: + return "%016x" % key_of(data) + + +def publish_one(container: Path, cache: Path, probe: Path | None, retarget: Path) -> str: + """Write .cs.cso for one container, or .fail with the reason. Returns a status line.""" + raw = container.read_bytes() + key = key_text(raw) + if len(raw) < 32 or raw[:4] != b"DXBC": + (cache / (key + ".fail")).write_text("not a DXBC container\n", encoding="utf-8") + return "%s: refused (not a DXBC container)" % container.name + + command = [sys.executable, "-B", str(retarget), str(container), str(cache / (key + ".cs.cso"))] + if probe is not None: + command += ["--probe", str(probe), "--sign"] + result = subprocess.run(command, capture_output=True, text=True) + destination = cache / (key + ".cs.cso") + if result.returncode != 0 or not destination.exists(): + reason = (result.stderr or result.stdout or "retarget failed").strip().splitlines() + (cache / (key + ".fail")).write_text("\n".join(reason[-4:]) + "\n", encoding="utf-8") + return "%s: refused (%s)" % (container.name, reason[-1] if reason else "retarget failed") + + if destination.read_bytes()[:4] != b"DXBC": + destination.unlink() + (cache / (key + ".fail")).write_text("retargeted output is not a DXBC container\n", encoding="utf-8") + return "%s: refused (retargeted output is not a DXBC container)" % container.name + return "%s: published %s.cs.cso" % (container.name, key) + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("--pending", required=True, type=Path, + help="Directory the stand-in dumps containers into (X2W_SHADER_DUMP_DIR)") + parser.add_argument("--cache", required=True, type=Path, + help="Shader cache directory the runtime reads (X2W_SHADER_CACHE)") + parser.add_argument("--probe", type=Path, help="root_probe executable, used to validate and sign") + parser.add_argument("--retarget", type=Path, + default=Path(__file__).resolve().parents[1] / "dxil_retarget.py", + help="dxil_retarget.py (default: the one beside this tool's parent)") + args = parser.parse_args() + + if not args.pending.is_dir(): + parser.error("--pending is not a directory: %s" % args.pending) + args.cache.mkdir(parents=True, exist_ok=True) + if not args.retarget.is_file(): + parser.error("--retarget is not a file: %s" % args.retarget) + + containers = sorted(args.pending.glob("*.dxbc")) + if not containers: + print("no containers in %s" % args.pending) + return 0 + published = refused = 0 + for container in containers: + line = publish_one(container, args.cache, args.probe, args.retarget) + print(line) + if ".cs.cso" in line: + published += 1 + else: + refused += 1 + print("published %d, refused %d" % (published, refused)) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) \ No newline at end of file From f741fec260afa7e224c6ef16ab01298693e28d6a Mon Sep 17 00:00:00 2001 From: triggered02 <153171514+triggered02@users.noreply.github.com> Date: Tue, 24 Nov 2026 17:53:03 +0530 Subject: [PATCH 3/4] =?UTF-8?q?=EF=BB=BFstartup-d3d12:=20do=20not=20forwar?= =?UTF-8?q?d=20a=20console=20cached-PSO=20blob=20to=20the=20desktop=20runt?= =?UTF-8?q?ime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tedin7's review finding 3 on #1441: the compute pipeline description copied desc->CachedPSO straight through, which hands a console cached blob to desktop CreateComputePipelineState. Zero it instead; a cached PSO is an optimisation the desktop must not be asked to interpret. Findings 1 and 2 were about the byte-scan classifier, which is withdrawn; finding 4 (no end-to-end coverage of the CreateComputePipelineState path) is still true and is the next step. Builds clean; startup_compute_cache and startup_stubs pass. --- src/startup_stubs/d3d12_xs_device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/startup_stubs/d3d12_xs_device.cpp b/src/startup_stubs/d3d12_xs_device.cpp index b4b0f56343..91f868d307 100644 --- a/src/startup_stubs/d3d12_xs_device.cpp +++ b/src/startup_stubs/d3d12_xs_device.cpp @@ -6047,7 +6047,7 @@ HRESULT __stdcall device_create_compute_pipeline_x(Wrapper* self, const D3D12_CO compute.CS.pShaderBytecode = blob->GetBufferPointer(); compute.CS.BytecodeLength = blob->GetBufferSize(); compute.NodeMask = desc->NodeMask; - compute.CachedPSO = desc->CachedPSO; + compute.CachedPSO = {}; // A console cached-PSO blob must not reach the desktop runtime. compute.Flags = D3D12_PIPELINE_STATE_FLAG_NONE; const HRESULT built = device_of(self)->CreateComputePipelineState(&compute, IID_PPV_ARGS(&real_pipeline)); blob->Release(); From 361b6e35cc71024f9667d9bb6220d5647b2d67c1 Mon Sep 17 00:00:00 2001 From: triggered02 <153171514+triggered02@users.noreply.github.com> Date: Tue, 24 Nov 2026 18:12:52 +0530 Subject: [PATCH 4/4] =?UTF-8?q?=EF=BB=BFstartup-d3d12:=20add=20the=20compu?= =?UTF-8?q?te=20dispatch=20path=20behind=20an=20explicit=20gate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step (d), first half: gate the compute-dispatch experiment behind X2W_COMPUTE_DISPATCH=1. Rebased onto a main whose command-list slot 14 Dispatch already exists (#1974): main installs slot 14 unconditionally and forwards only when a desktop compute pipeline and root signature are bound and the root arguments are forwarded (`decide_dispatch` in `src/startup_stubs/list_dispatch.h`, covered by startup_list_dispatch and startup_list_dispatch_native). That newer code fully supersedes this PR's own slot 14 handler, so the handler and its gated `list_typed[14]` registration are dropped rather than duplicated. The gate covers the slot 62 side instead, which is what this PR adds: with X2W_COMPUTE_DISPATCH=1 a validated `.cs.cso` is loaded and the desktop pipeline records `own().pipeline_root`, so main's existing gate can match it against the bound compute root signature. Without the variable nothing is loaded, so production behaviour is unchanged and nothing can dispatch on the placeholder path. Still outstanding, and why this is not marked ready: the source-built two-arm readback (invalid artifact -> zero recorded dispatches, accepted artifact -> nonzero UAV readback). The gate exists so that fixture can turn the path on explicitly; until it passes, the default is inert. --- src/startup_stubs/d3d12_xs_device.cpp | 33 ++++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/startup_stubs/d3d12_xs_device.cpp b/src/startup_stubs/d3d12_xs_device.cpp index 91f868d307..6bedfffffc 100644 --- a/src/startup_stubs/d3d12_xs_device.cpp +++ b/src/startup_stubs/d3d12_xs_device.cpp @@ -2758,6 +2758,17 @@ void restore_compute_root(const Pass& pass, ID3D12GraphicsCommandList* list) } } +// X2W_COMPUTE_DISPATCH=1 turns on the compute-dispatch experiment: device slot 62 loads a validated +// .cs.cso and builds a real desktop compute pipeline, and command-list slot 14 Dispatch (installed +// unconditionally by main) forwards it. Without the variable no module is loaded, so the default +// placeholder path is exactly as inert as before and the source-built readback fixture is what turns +// this on explicitly. +bool compute_dispatch_enabled() +{ + char value[8]; + const DWORD n = GetEnvironmentVariableA("X2W_COMPUTE_DISPATCH", value, sizeof(value)); + return n == 1 && value[0] == '1'; +} void __stdcall list_compute_root(Wrapper* self, void* root) { auto* list = recording(self); @@ -6012,10 +6023,10 @@ void dump_containers(const char* what, const void* desc, std::size_t bytes) HRESULT __stdcall placeholder_ok(Wrapper*, u64, u64, u64) { return S_OK; } // Device slot 62 (Xbox order): (D3D12_COMPUTE_PIPELINE_STATE_DESC*, 0, 0, riid, ppv); first seen from -// XboxBvhBuilder.dll, followed by SetName on the result. With render mode a validated module published -// under the container's hash in the shader cache is loaded, so the result is a real desktop pipeline; -// without one it stays a placeholder PipelineState. Logs the root signature, bytecode address, length -// and first 32 bytes. +// XboxBvhBuilder.dll, followed by SetName on the result. With X2W_COMPUTE_DISPATCH=1 and render mode a +// validated module published under the container's hash in the shader cache is loaded, so the result is a +// real desktop pipeline; without one it stays a placeholder PipelineState. Logs the root signature, +// bytecode address, length and first 32 bytes. HRESULT __stdcall device_create_compute_pipeline_x(Wrapper* self, const D3D12_COMPUTE_PIPELINE_STATE_DESC* desc, u64 extra0, u64 extra1, const GUID* iid, void** out) { @@ -6027,12 +6038,16 @@ HRESULT __stdcall device_create_compute_pipeline_x(Wrapper* self, const D3D12_CO dump_containers("compute", desc, sizeof(*desc)); char bytes[3 * 32 + 1]; hex_text(desc->CS.pShaderBytecode, desc->CS.BytecodeLength < 32 ? desc->CS.BytecodeLength : 32, bytes, sizeof(bytes)); - // A validated compute module is loaded by key from the shader cache, exactly as graphics - // translations are: the offline retarget/sign/gate step decides usability, so there is no - // runtime byte inspection here, and the placeholder is kept when no validated module exists. + // With X2W_COMPUTE_DISPATCH=1 a validated compute module is loaded by key from the shader cache, + // exactly as graphics translations are: the offline retarget/sign/gate step decides usability, so + // there is no runtime byte inspection here, and the placeholder is kept when no validated module + // exists. ID3D12PipelineState* real_pipeline = nullptr; + ID3D12RootSignature* pipeline_root = nullptr; // the root the desktop module was built against char why[128] = ""; - if (render_mode()) { + if (!compute_dispatch_enabled()) { + std::snprintf(why, sizeof(why), "compute dispatch is off"); + } else if (render_mode()) { wchar_t path[MAX_PATH]; const u64 compute_key = desc->CS.pShaderBytecode && desc->CS.BytecodeLength ? fnv_bytes(desc->CS.pShaderBytecode, desc->CS.BytecodeLength) : 0; @@ -6044,6 +6059,7 @@ HRESULT __stdcall device_create_compute_pipeline_x(Wrapper* self, const D3D12_CO D3D12_COMPUTE_PIPELINE_STATE_DESC compute{}; compute.pRootSignature = reinterpret_cast(unwrap(reinterpret_cast(desc->pRootSignature))); + pipeline_root = compute.pRootSignature; compute.CS.pShaderBytecode = blob->GetBufferPointer(); compute.CS.BytecodeLength = blob->GetBufferSize(); compute.NodeMask = desc->NodeMask; @@ -6071,6 +6087,7 @@ HRESULT __stdcall device_create_compute_pipeline_x(Wrapper* self, const D3D12_CO } auto* pipeline = static_cast(*out); pipeline->own().compute_pipeline = real_pipeline != nullptr; + pipeline->own().pipeline_root = real_pipeline ? pipeline_root : nullptr; note_pipeline(pipeline, 62, nullptr, desc, sizeof(*desc)); note_compute_binding_pipeline(pipeline, *desc); return S_OK;