diff --git a/.github/workflows/graphics-progress.yml b/.github/workflows/graphics-progress.yml new file mode 100644 index 0000000000..82fa2174ff --- /dev/null +++ b/.github/workflows/graphics-progress.yml @@ -0,0 +1,123 @@ +# Counts the graphics path (the D3D12 -> Vulkan layer and the RDNA2 -> SPIR-V translator) from the committed code and +# publishes the page. The outputs are regenerated, never committed. See docs/graphics_progress.md. +name: Graphics progress + +on: + push: + branches: [main] + paths: + - "runtime/**" + - "tools/rdna2spirv.py" + - "tools/isa_coverage.py" + - "tools/gen_d3d12_stubs.py" + - "tools/gfx10_formats.json" + - "tools/graphics_progress.py" + - "tools/graphics_progress_data.json" + - "docs/d3d12_vulkan.md" + - "docs/isa_coverage.md" + - ".github/workflows/graphics-progress.yml" + pull_request: + paths: + - "tools/graphics_progress.py" + - "tools/graphics_progress_data.json" + - "tests/test_graphics_progress.py" + - ".github/workflows/graphics-progress.yml" + schedule: + - cron: "17 4 * * *" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: graphics-progress-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + build: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: read + pages: read + outputs: + pages: ${{ steps.pages.outputs.enabled }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: "3.12" + - name: Test the counters + run: python -I tests/test_graphics_progress.py + # The history file is the only state: one point per date, carried between runs through the cache. + - name: Restore the history + if: github.event_name != 'pull_request' + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: site/graphics-history.json + key: graphics-history-restore-only + restore-keys: graphics-history- + - name: Count the graphics path + env: + EVENT_NAME: ${{ github.event_name }} + run: | + mkdir -p site + if [ "$EVENT_NAME" = "pull_request" ]; then + python -I tools/graphics_progress.py --tree HEAD --out-dir site --print + else + python -I tools/graphics_progress.py --tree HEAD --out-dir site --date "$(date -u +%F)" --print + fi + cp site/graphics.html site/index.html + - name: Save the history + if: github.event_name != 'pull_request' + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: site/graphics-history.json + key: graphics-history-${{ github.run_id }} + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: graphics-progress + path: site/ + if-no-files-found: error + # Pages may not be enabled (forks, this repository today). Asking is allowed to fail; the answer is the guard. + - name: Is GitHub Pages enabled? + id: pages + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + env: + GH_TOKEN: ${{ github.token }} + run: | + if gh api "repos/$GITHUB_REPOSITORY/pages" --silent 2>/dev/null; then + echo "enabled=true" >> "$GITHUB_OUTPUT" + else + echo "enabled=false" >> "$GITHUB_OUTPUT" + echo "GitHub Pages is not enabled for this repository; the page is only in the artifact." + fi + + deploy: + needs: build + if: needs.build.outputs.pages == 'true' + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + concurrency: + group: graphics-progress-pages + cancel-in-progress: false + steps: + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: graphics-progress + path: site + - uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 + - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: site + - id: deployment + uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 diff --git a/.gitignore b/.gitignore index d7488dc16c..86d66a7a50 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,9 @@ __pycache__/ *.exp *.log .vs/ + +# generated by tools/graphics_progress.py (CI publishes them; docs/graphics_progress.md) +docs/progress/graphics.json +docs/progress/graphics.html +docs/progress/graphics.md +docs/progress/graphics-history.json diff --git a/README.md b/README.md index e6fa1145ed..40c5273c0a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ work on booting can start as soon as one is available to a developer. | Audio banks (AWC: Opus, XMA2) | ✅ Exported whole. Opus repackaged **losslessly** as Ogg Opus; PCM (codec 0/2) as WAV; XMA2 decoded with ffmpeg. `--wav` adds 16-bit PCM WAV ([notes](docs/audio.md)) | | Music/radio config | ? Measured. **1,589** audio-config records with exact durations and AWC stream ids; station grouping and content-id lists; no per-track start offsets ([notes](docs/audio_config.md)) | | PE loader and import shims | ⚠️ Runs a stand-in executable end to end (`gta6rt --run`: CRT startup, statics, heap, files, threads, GDK imports through the shims, exit code back). Controllers through a GameInput shim on SDL3 (any controller SDL supports, rumble, DualSense trigger effects and lightbar; built when SDL3 is installed or with `-DLEONIDA_SDL3_FETCH=ON`, [notes](docs/gameinput.md)). `--trace-d3d12` logs every D3D12 call and its outcome for the first boot. Untested against the real executable | -| Xbox D3D12 → Vulkan | ⚠️ In progress. A Vulkan-backed device behind the Xbox-ABI proxy creates queues, command lists, fences, descriptor heaps, committed and reserved resources, render-target and depth views (3D targets included), texture views and samplers (2D, cube and 3D views, the depth and stencil planes of depth-stencil textures, packed formats such as B5G6R5, B4G4R4A4 and R9G9B9E5; they go into the bindless set), and query heaps. Barriers, clears, uploads, copies (BC included), colour resolves, predication, CPU-side texture reads and writes, and occlusion, timestamp and pipeline-statistics queries run on Vulkan, checked on one GPU. No buffer views, root signatures, pipelines, draws, placed resources, 1D textures or swapchain yet ([plan](docs/d3d12_vulkan.md)) | +| Xbox D3D12 → Vulkan | ⚠️ In progress. A Vulkan-backed device behind the Xbox-ABI proxy creates queues, command lists, fences, descriptor heaps, committed and reserved resources, render-target and depth views (3D targets included), texture views and samplers (2D, cube and 3D views, the depth and stencil planes of depth-stencil textures, packed formats such as B5G6R5, B4G4R4A4 and R9G9B9E5; they go into the bindless set), and query heaps. Barriers, clears, uploads, copies (BC included), colour resolves, predication, CPU-side texture reads and writes, and occlusion, timestamp and pipeline-statistics queries run on Vulkan, checked on one GPU. Root signatures, pipelines, draws, placed resources, 1D textures and presentation have an implementation and a registered synthetic test. Still open: render passes, mesh and ray-tracing dispatch, variable-rate shading, pipeline streams, and the game has not rendered a frame ([plan](docs/d3d12_vulkan.md); counts from the code in [graphics progress](docs/graphics_progress.md)) | | Ray tracing (BVH) | ⚠️ In progress. `BuildRaytracingAccelerationStructure` builds BLASes and TLASes on the GPU in the console's XDXR BVH4 layout, which the translated shaders walk themselves (`image_bvh_intersect_ray`, TRI0/TRI1 leaves); `LEONIDA_RT_AS=khr` uses Vulkan's own acceleration structures instead. The build descriptions are recovered from the package's `XboxBvhBuilder.dll` ([notes](docs/xdxr.md)). The game's `*_bvh4.rpf` packs are measured: offline-built, dehydrated BLASes that rehydrate through that DLL with their geometry from the drawables in `levels.rpf` (measured on 8 of the 10 sampled BLAS; [notes](docs/bvh.md)). Not done in the builder: TRI1 pairing, BOX16 nodes, serialization. Open: whether the game rehydrates the packs or rebuilds them, and the XDXR-vs-KHR default ([#313](https://github.com/ItsNotRexed/Leonida/issues/313)) | diff --git a/docs/README.md b/docs/README.md index 5eff8e3c1f..4ed43ab24f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -68,6 +68,7 @@ method, scope and caveats. No game data is included. | [pipeline_check.md](pipeline_check.md) | Driver-level corpus check: 10/12 shards, 22,092 modules, 2,217 compute pipelines, 0 failures. | | [shader_validation.md](shader_validation.md) | Differential CPU/GPU validation design and the current CPU interpreter prototype. | | [isa_coverage.md](isa_coverage.md) | RDNA2 ISA coverage of the translator against AMD's machine-readable XML: which of its 1,153 instructions have a rule, and which matched names are not RDNA2. | +| [graphics_progress.md](graphics_progress.md) | Graphics-path progress counted from the committed code: D3D12 to Vulkan milestones and interface coverage, RDNA2 ISA, formats, tests, unsupported sites. Says nothing about whether the game runs. | | [buffer_bounds.md](buffer_bounds.md) | V# `OOB_SELECT` bounds measured natively: RDNA2 (gfx1036) follows Mesa's GFX11 column (729/732 cases), not GFX10; raw mode also counts `soffset`. | | [fssm_crosscheck.md](fssm_crosscheck.md) | FSSM/RDNA2 facts cross-checked against SCARAB; code starts at `code_off + 0x28`. | | [fspx.md](fspx.md) | `FSPX`, the FidelityFX DLL's native compute programs (its shaders' `ACCC` part): directory as the DLL reads it, kind-0 dispatch state, the hash prologue, `gfx1030` for its `v_dot4` code; 13 of 29 translate with `tools/fspx_unpack.py`. | diff --git a/docs/graphics_progress.md b/docs/graphics_progress.md new file mode 100644 index 0000000000..15ab52b9bd --- /dev/null +++ b/docs/graphics_progress.md @@ -0,0 +1,40 @@ +# Graphics path progress + +`tools/graphics_progress.py` counts how far the graphics path has come: the Xbox D3D12 to Vulkan layer under +`runtime/` and the RDNA2 to SPIR-V translator `tools/rdna2spirv.py`. Every number is a count over committed text. +**It says nothing about whether the game runs.** Nothing is built, run or imported to get a number, and it needs no +game data, GPU or network. + +```sh +python -I tools/graphics_progress.py # working tree -> docs/progress/graphics.{json,html,md} +python -I tools/graphics_progress.py --tree origin/main # a git ref, read with git ls-tree / git show +python -I tools/graphics_progress.py --date 2026-11-22 # also append that day to graphics-history.json +python -I tools/graphics_progress.py --isa amdgpu_isa_rdna2.xml # a fresh RDNA2 instruction total +``` + +The output is deterministic: sorted keys, LF line endings, no clock. A date appears only with `--date`. + +## What is counted + +| Section | Counted how | Limits | +|---|---|---| +| Milestones | Rows of the table in [d3d12_vulkan.md](d3d12_vulkan.md) section 6, each id once. A row's status is read from its own words: "Met by" or "**Met" is met, "Synthetic part met" and "Partly met" are what they say, anything else is open. | Open pull requests are not known offline. The words are the authors', not a verdict. | +| D3D12 interfaces | The interfaces handed to `tools/gen_d3d12_stubs.py` in `runtime/CMakeLists.txt`. Per interface: the methods of its chain against the overrides in the class that derives from its generated stub class. Real body, body that only returns `E_NOTIMPL`, or no override (a generated stub). | Matching is by method name, as in `gen_d3d12_stubs.py --report`. A real body can still be partial. The method names come from `tools/graphics_progress_data.json` (Windows SDK `d3d12.h`, names only; a method is counted once per vtable slot). | +| RDNA2 ISA | `tools/isa_coverage.py` used as a library on the translator text. | The instruction total is AMD's XML, which is not in the repository, so the share is the one [isa_coverage.md](isa_coverage.md) states unless `--isa` is given. "Has a rule" is not "correct". | +| Formats | Buffer: keys of `Gen.FORMATS` in the translator (read with `ast`) out of the codes a buffer V# can carry. Its FORMAT field is 7 bits (the translator reads `word3 >> 12 & 0x7F`), so that is codes 1 to 127 of `tools/gfx10_formats.json`, which in the table are 1 to 77 (78 to 127 are reserved). Codes from 128 (sRGB, BC, FMASK and others) are image-only: they are listed apart, counted as the codes `runtime/src/gfx10_descriptors.h` maps to a Vulkan format. DXGI: `DXGI_FORMAT` names in `vulkan_format()` and `vertex_format()` of the layer out of the DXGI enum names in the data file. | Mapped is not "every usage works". The DXGI total is the SDK enum's size, not a list this project chose. | +| GPU tests | Distinct `add_test(NAME ...)` names in `runtime/CMakeLists.txt`, sorted into areas by name. | Registered is not passing. | +| Unsupported sites | `raise Unsupported(...)` in the translator, and `E_NOTIMPL` tokens and "unsupported" / "not implemented" strings in the graphics-path files of `runtime/`. | A site is a line of code, not one missing feature. | + +`tools/graphics_progress_data.json` is the only input that is not in the code under measurement. It holds interface and method names from the Windows SDK `d3d12.h` and the `DXGI_FORMAT` enum names from `dxgiformat.h` (its `source` field names the SDK version), and nothing else from those headers. Regenerate it with +`--refresh-data --d3d12-header --dxgi-header ` when the layer starts to use a newer interface. + +## Where the page lives + +The outputs are not committed. `.github/workflows/graphics-progress.yml` regenerates them on pushes that touch the +graphics path, daily and on request, uploads them as the `graphics-progress` artifact and, when GitHub Pages is +enabled for the repository, publishes them there. The history file is carried between runs in the Actions cache. + +## How it relates to other trackers + +A tracker that counts the whole project answers a different question. This page counts only the graphics path and says how each number is made. It is meant to be read next to the plan in +[d3d12_vulkan.md](d3d12_vulkan.md) and issue [#313](https://github.com/ItsNotRexed/Leonida/issues/313). diff --git a/tests/test_graphics_progress.py b/tests/test_graphics_progress.py new file mode 100644 index 0000000000..0721538ccc --- /dev/null +++ b/tests/test_graphics_progress.py @@ -0,0 +1,619 @@ +"""Unit tests for tools/graphics_progress.py (the graphics-path progress page). + +Every counter is run on a small synthetic tree written by the test: a few lines of made-up milestone table, CMake, +C++ and translator-shaped Python. No game data, GPU, network or SDK header is needed. Standard library only. + + python -I tests/test_graphics_progress.py +""" +from __future__ import annotations + +import ast +import contextlib +import io +import json +import os +import re +import shutil +import socket +import subprocess +import sys +import tempfile +import unittest + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +TOOLS = os.path.join(ROOT, "tools") +TOOL = os.path.join(TOOLS, "graphics_progress.py") +if TOOLS not in sys.path: + sys.path.insert(0, TOOLS) + +import graphics_progress as gp # noqa: E402 + +MILESTONES = """# Plan + +## 5. Something else + +| **M9** | not a milestone | x | Met by `nothing_test` | + +## 6. Boot milestones + +| # | Scope | What it proves | Done when | +|---|---|---|---| +| **M0** | Device and `queue` | COM | A clear. **Synthetic part met** by `d3d12_a_test`; the rest is open | +| **M1** | Triangle | PSO | **Met.** Passes. `d3d12_b_test` and `d3d12_missing_test` | +| **M1.5** | Real code | shaders | Met by `d3d12_b_test` | +| **M2** | Textures | descriptors | **Synthetic part met** by `d3d12_a_test` | +| **M2** | Textures | descriptors | **Synthetic part met** by `d3d12_a_test` | +| **M3** | Streams | compute | Nothing yet | +| **M4** | Polish | present | **Partly met:** one piece, a | pipe | inside | + +## 7. After + +| **M8** | not counted | x | Met by `x_test` | +""" + +CMAKE = """ +add_test(NAME alpha COMMAND alpha_test) +# add_test(NAME commented_out COMMAND x) + add_test(NAME d3d12_one COMMAND d3d12_one_test) + add_test(NAME d3d12_m2_textured COMMAND d3d12_m2_textured_test) + add_test(NAME vk_thing COMMAND vk_thing_test) + add_test(NAME vk_thing COMMAND vk_thing_test) + add_test(NAME xdxr_build COMMAND y) + add_test(NAME run_tiny_game COMMAND z) + add_test(NAME gta6rt_rejects_${name} COMMAND z) +add_custom_command( + OUTPUT ${STUBS} + COMMAND "${Python3_EXECUTABLE}" -I ${CMAKE_CURRENT_SOURCE_DIR}/../tools/gen_d3d12_stubs.py --out ${STUBS} + ${_stubs_header} + ID3D12Alpha ID3D12Beta # ID3D12InAComment + ID3D12Missing + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../tools/gen_d3d12_stubs.py) +""" + +COM_OBJECT = """ +template +class Object : public Stubs { +public: + ULONG STDMETHODCALLTYPE AddRef() override { return 1; } + HRESULT STDMETHODCALLTYPE SetName(LPCWSTR name) override { return S_OK; } +}; +""" + +COM_CPP = r""" +// class Fake : public ID3D12AlphaStubs { HRESULT STDMETHODCALLTYPE Hidden() override { return S_OK; } }; +class Alpha final : public Object { +public: + HRESULT STDMETHODCALLTYPE Real(UINT a, void* (*cb)(int)) override { return call("{ not a brace"); } + HRESULT STDMETHODCALLTYPE Refuses() override { return E_NOTIMPL; } + void STDMETHODCALLTYPE Empty() override {} + HRESULT STDMETHODCALLTYPE Conditional() override { if (x) return E_NOTIMPL; return S_OK; } +}; +class Beta final : public ID3D12BetaStubs { + HRESULT STDMETHODCALLTYPE Only() override { return S_OK; } +}; +class BetaSmaller final : public ID3D12BetaStubs { +}; +""" + +INTERFACES = { + "ID3D12Object": {"base": "IUnknown", "methods": ["SetName"]}, + "ID3D12Alpha": {"base": "ID3D12Object", "methods": ["Real", "Refuses", "Empty", "Conditional", "Gen"]}, + "ID3D12Beta": {"base": "IUnknown", "methods": ["Only", "Other"]}, +} + +TRANSLATOR_SRC = ''' +class Unsupported(Exception): + pass + +class Gen: + FORMATS = {22: (4, "f32", (32,)), 1: (1, "unorm", (8,)), + 5: (1, "uint", (8,)), 5: (1, "uint", (8,)), 99: (4, "f32", (32,))} + + def fmt_field(self, lit3): + return lit3 >> 12 & 0x7F + + def _insn(self, op): + if op == "v_add_f32": + return 1 + if op in ("s_mov_b32", "s_nop"): + return 2 + if op.startswith("ds_"): + raise Unsupported("ds form") + if op == "s_denorm_mode": + raise Unsupported(op) + raise Unsupported(op) + + def image_op(self, op): + raise Unsupported("image thing") + + def lds_op(self, op): + raise Unsupported("lds thing") + raise Unsupported("lds thing 2") + +def helper(): + raise Unsupported("elsewhere") + raise ValueError("not counted") +''' + +GFX10 = {"0": "GFX10_FORMAT_INVALID", "1": "GFX10_FORMAT_8_UNORM", "5": "GFX10_FORMAT_8_UINT", + "22": "GFX10_FORMAT_32_FLOAT", "23": "GFX10_FORMAT_16_16_UNORM", + "128": "GFX10_FORMAT_8_SRGB", "129": "GFX10_FORMAT_8_8_SRGB"} + +DESCRIPTORS_H = """ + {22, VK_FORMAT_R32_SFLOAT, channels_r}, // below 128: not an image-only code + {128, VK_FORMAT_R8_SRGB, channels_r}, // GFX10_FORMAT_8_SRGB + {128, VK_FORMAT_R8_SRGB, channels_bgr}, // the same code twice counts once + // {129, VK_FORMAT_R8G8_SRGB, channels_rg}, commented out +""" + +DEVICE_CPP = """ +Format vulkan_format(DXGI_FORMAT format, bool depth) { + switch (format) { + case DXGI_FORMAT_R8_UNORM: return {VK_FORMAT_R8_UNORM}; + case DXGI_FORMAT_R32_FLOAT: return {VK_FORMAT_R32_SFLOAT}; + // case DXGI_FORMAT_COMMENTED: return {}; + } +} +bool vertex_format(DXGI_FORMAT format, VkFormat& out) { + static const struct { DXGI_FORMAT f; VkFormat v; } table[] = { + {DXGI_FORMAT_R16G16_UNORM, VK_FORMAT_R16G16_UNORM}, + {DXGI_FORMAT_R8_UNORM, VK_FORMAT_R8_UNORM}, + }; +} +bool unrelated() { return format == DXGI_FORMAT_R8G8_UNORM; } +""" + +DXGI_LIST = ["R8_UNORM", "R8G8_UNORM", "R32_FLOAT", "R16G16_UNORM", "R16_UNORM"] + +ISA_DOC = """# RDNA2 ISA coverage + +## Result (translator at `abc12345`, AMD XML of 2026-08-06) + +Every new rule moves these. + +1,153 RDNA2 instructions: 436 handled-exact, 408 handled-family, 2 refused (`s_denorm_mode`, `s_round_mode`), 307 +unknown. More text. +""" + +RUNTIME_FILES = { + "runtime/shims/d3d12_vulkan_device.cpp": DEVICE_CPP + """ +HRESULT a() { return E_NOTIMPL; } +void b() { log("unsupported volume SRV format"); log("Not Implemented here"); } +// E_NOTIMPL in a comment, "unsupported" in a comment +const char* s = "plain"; /* E_NOTIMPL */ +""", + "runtime/shims/d3d12_trace.h": "x = E_NOTIMPL ? \"unsupported\" : 0;\n", + "runtime/shims/registry.cpp": "return E_NOTIMPL; // not a graphics file\n", + "runtime/src/vulkan_replay.h": 'void f() { fail("unsupported thing"); fail("fine"); auto r = R"(E_NOTIMPL)"; }\n', + "runtime/shims/d3d12_com.cpp": COM_CPP, + "runtime/shims/d3d12_com_object.h": COM_OBJECT, + "runtime/shims/dxgi_com.cpp": "", + "runtime/test/shaders/a.asm": "s_endpgm\n", + "runtime/test/shaders/b.asm": "s_endpgm\n", + "runtime/test/shaders/readme.md": "x\n", + "runtime/test/d3d12_a_test.cpp": "", + "runtime/test/d3d12_b_test.cpp": "", + "runtime/CMakeLists.txt": CMAKE, + "tests/semantic/test_a.py": "", + "tests/semantic/test_b.py": "", + "tests/semantic/fixtures/f1.asm": "", + "tools/rdna2spirv.py": TRANSLATOR_SRC, + "tools/gfx10_formats.json": json.dumps(GFX10), + "runtime/src/gfx10_descriptors.h": DESCRIPTORS_H, + "docs/d3d12_vulkan.md": MILESTONES, + "docs/isa_coverage.md": ISA_DOC, +} + + +def write_tree(root, files=RUNTIME_FILES): + for rel, text in files.items(): + path = os.path.join(root, *rel.split("/")) + os.makedirs(os.path.dirname(path), exist_ok=True) + with open(path, "w", encoding="utf-8", newline="\n") as f: + f.write(text) + + +class Fixture(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.root = os.path.join(self.tmp.name, "repo") + write_tree(self.root) + self.tree = gp.WorkTree(self.root) + self.data = {"d3d12": INTERFACES, "dxgi_formats": DXGI_LIST} + + +class Milestones(Fixture): + def test_rows_of_section_six_only_each_id_once(self): + result = gp.parse_milestones(MILESTONES, self.tree) + ids = [m["id"] for m in result["items"]] + self.assertEqual(ids, ["M0", "M1", "M1.5", "M2", "M3", "M4"]) + self.assertEqual(result["duplicate_rows"], 1) + + def test_status_is_read_from_the_done_when_words(self): + status = {m["id"]: m["status"] for m in gp.parse_milestones(MILESTONES)["items"]} + self.assertEqual(status, {"M0": "synthetic", "M1": "met", "M1.5": "met", "M2": "synthetic", + "M3": "open", "M4": "partial"}) + + def test_named_tests_are_checked_against_runtime_test(self): + item = {m["id"]: m for m in gp.parse_milestones(MILESTONES, self.tree)["items"]}["M1"] + self.assertEqual(item["named_tests"], ["d3d12_b_test", "d3d12_missing_test"]) + self.assertEqual(item["named_tests_found"], 1) + + def test_a_pipe_inside_the_last_cell_does_not_lose_the_row(self): + row = [m for m in gp.parse_milestones(MILESTONES)["items"] if m["id"] == "M4"][0] + self.assertEqual(row["scope"], "Polish") + + def test_missing_section_is_reported(self): + self.assertEqual(gp.parse_milestones("# nothing\n"), {"found": False, "items": [], "duplicate_rows": 0}) + + +class Interfaces(Fixture): + def test_cmake_lists_the_generated_stub_interfaces_without_comments(self): + self.assertEqual(gp.cmake_stub_interfaces(CMAKE), ["ID3D12Alpha", "ID3D12Beta", "ID3D12Missing"]) + + def test_class_methods_ignore_comments_and_classify_bodies(self): + classes = {c[0]: c for c in gp.class_methods(COM_CPP)} + self.assertNotIn("Fake", classes) + self.assertEqual(classes["Alpha"][1], "ID3D12Alpha") + self.assertEqual(classes["Alpha"][2], {"Real": "real", "Refuses": "notimpl", "Empty": "empty", + "Conditional": "real"}) + + def test_counts_real_refusing_and_stub_methods_per_interface(self): + classes = gp.class_methods(COM_CPP) + common = {} + for _, _, methods in gp.class_methods(COM_OBJECT): + common.update(methods) + report = {r["interface"]: r for r in + gp.count_interfaces(["ID3D12Alpha", "ID3D12Beta", "ID3D12Missing"], INTERFACES, classes, common)} + alpha = report["ID3D12Alpha"] + # SetName comes from the shared template; Real, Empty and Conditional are real; Refuses refuses; Gen is a stub + self.assertEqual((alpha["methods"], alpha["real"], alpha["refuses"], alpha["stub"]), (6, 4, 1, 1)) + self.assertEqual(alpha["open"], ["ID3D12Alpha::Refuses", "ID3D12Alpha::Gen"]) + self.assertEqual(alpha["cells"], ["y", "y", "r", "y", "y", "n"]) + # two classes for Beta: the one with more overrides is the implementation + beta = report["ID3D12Beta"] + self.assertEqual((beta["methods"], beta["real"], beta["stub"], beta["implementation"]), (2, 1, 1, "Beta")) + self.assertIsNone(report["ID3D12Missing"]["methods"]) + + def test_an_interface_without_a_class_is_all_stub(self): + report = gp.count_interfaces(["ID3D12Beta"], INTERFACES, [], {}) + self.assertEqual((report[0]["real"], report[0]["stub"], report[0]["implementation"]), (0, 2, None)) + + +class Isa(Fixture): + def test_snapshot_of_the_doc_is_parsed_across_a_line_break(self): + snap = gp.isa_snapshot(ISA_DOC) + self.assertEqual((snap["total"], snap["handled_exact"], snap["handled_family"], snap["refused"], + snap["unknown"]), (1153, 436, 408, 2, 307)) + self.assertEqual(snap["translator_commit"], "abc12345") + self.assertIsNone(gp.isa_snapshot("no numbers here")) + + def test_live_counts_come_from_isa_coverage_on_the_translator_text(self): + result = gp.count_isa(self.tree) + live = result["live"] + self.assertEqual(live["rule_names"], 3) # v_add_f32, s_mov_b32, s_nop + self.assertEqual(live["refused_names"], 1) # s_denorm_mode + self.assertEqual(live["prefix_families"], 1) # ds_ + self.assertIsNone(result["fresh"]) + self.assertEqual(result["snapshot"]["total"], 1153) + + def test_translator_is_not_imported_or_run(self): + before = "rdna2spirv" in sys.modules # another test file may have imported it already under pytest + gp.count_isa(self.tree) + self.assertEqual("rdna2spirv" in sys.modules, before) + + +class Formats(Fixture): + def test_gen_formats_reads_the_dict_keys_with_ast(self): + self.assertEqual(gp.gen_formats(TRANSLATOR_SRC), {22, 1, 5, 99}) + + def test_buffer_format_codes_against_the_json_table(self): + g = gp.count_formats(self.tree, DXGI_LIST)["gfx10_buffer"] + # INVALID (0) and the image-only codes 128 and 129 are not buffer codes; 99 is not in the table + self.assertEqual((g["handled"], g["total"]), (3, 4)) + self.assertEqual(g["codes_outside_table"], [99]) + self.assertEqual([c["code"] for c in g["cells"]], [1, 5, 22, 23]) + self.assertEqual([c["name"] for c in g["cells"] if not c["handled"]], ["16_16_UNORM"]) + self.assertEqual(g["field_bits"], 7) + self.assertTrue(g["field_bits_seen_in_translator"]) + self.assertEqual(g["codes_in_table_total"], 7) + + def test_image_only_codes_are_listed_apart_and_counted_from_the_runtime_table(self): + im = gp.count_formats(self.tree, DXGI_LIST)["gfx10_buffer"]["image_only"] + self.assertEqual((im["mapped"], im["total"]), (1, 2)) + self.assertEqual([(c["code"], c["mapped"]) for c in im["cells"]], [(128, True), (129, False)]) + + def test_a_translator_covering_every_buffer_code_reports_all_of_them(self): + table = {str(c): f"GFX10_FORMAT_X{c}" for c in range(1, 78)} + table.update({"0": "GFX10_FORMAT_INVALID", "128": "GFX10_FORMAT_8_SRGB"}) + keys = ", ".join(f"{c}: (4, 'f32', (32,))" for c in range(1, 78)) + files = {"tools/gfx10_formats.json": json.dumps(table), + "tools/rdna2spirv.py": "class Gen:\n FORMATS = {" + keys + "}\n" + " def f(self, w):\n return w >> 12 & 0x7F\n"} + with tempfile.TemporaryDirectory() as tmp: + write_tree(tmp, files) + g = gp.count_formats(gp.WorkTree(tmp), [])["gfx10_buffer"] + self.assertEqual((g["handled"], g["total"]), (77, 77)) + self.assertEqual(g["handled_outside_buffer_range"], []) + + def test_dxgi_formats_are_those_in_the_two_functions_only(self): + d = gp.count_formats(self.tree, DXGI_LIST)["dxgi"] + self.assertEqual((d["mapped"], d["total"]), (3, 5)) + self.assertEqual([c["name"] for c in d["cells"] if c["mapped"]], ["R8_UNORM", "R32_FLOAT", "R16G16_UNORM"]) + self.assertEqual(d["mapped_not_in_list"], []) + + +class Tests(Fixture): + def test_names_are_distinct_uncommented_and_sorted_into_areas(self): + t = gp.count_tests(CMAKE, ["a/x.asm", "a/y.asm", "a/z.md"], ["t/test_a.py", "t/fixtures/f.asm", "t/x.py"]) + self.assertEqual(t["registered"], 7) + areas = {k: v["tests"] for k, v in t["areas"].items()} + self.assertEqual(areas["Milestone tests (M1 to M4)"], ["d3d12_m2_textured"]) + self.assertEqual(areas["D3D12 layer on Vulkan"], ["d3d12_one"]) + self.assertEqual(areas["Vulkan backend and replay"], ["vk_thing"]) + self.assertEqual(areas["Ray tracing (XDXR, BVH)"], ["xdxr_build"]) + self.assertEqual(areas["Loader, shims and media (not graphics)"], ["alpha", "gta6rt_rejects_${name}", "run_tiny_game"]) + self.assertEqual(t["graphics_path"], 4) + self.assertEqual((t["gpu_programs"], t["semantic_tests"], t["semantic_fixtures"]), (2, 1, 1)) + + +class Unsupported(Fixture): + def test_cpp_sites_skip_comments_and_raw_strings(self): + notimpl, messages = gp.count_cpp_sites(RUNTIME_FILES["runtime/shims/d3d12_vulkan_device.cpp"]) + self.assertEqual((notimpl, messages), (1, 2)) + self.assertEqual(gp.count_cpp_sites(RUNTIME_FILES["runtime/src/vulkan_replay.h"]), (0, 1)) + + def test_translator_sites_by_enclosing_function(self): + result = gp.count_translator_sites(TRANSLATOR_SRC) + self.assertEqual(result["total"], 7) + self.assertEqual(result["areas"], {"Images and sampling": 1, "Instruction dispatch (_insn)": 3, + "LDS and GS": 2, "Program structure and checks": 1}) + + def test_runtime_areas_and_files_outside_the_graphics_path(self): + u = gp.count_unsupported(self.tree) + self.assertEqual(u["runtime_areas"]["D3D12 device on Vulkan"]["e_notimpl"], 1) + self.assertEqual(u["runtime_areas"]["Vulkan backend and replay"]["messages"], 1) + # registry.cpp is not a graphics file; d3d12_trace.h is a helper and counted nowhere + self.assertNotIn("registry", json.dumps(u["runtime_areas"])) + self.assertEqual(u["runtime_total"], 1 + 2 + 1 + 2) # device, replay, and two E_NOTIMPL tokens in com + + +class History(unittest.TestCase): + def test_one_point_per_date_and_sorted(self): + points = gp.merge_history([], {"date": "2026-02-01", "x": 1}) + points = gp.merge_history(points, {"date": "2026-01-01", "x": 2}) + points = gp.merge_history(points, {"date": "2026-02-01", "x": 3}) + self.assertEqual(points, [{"date": "2026-01-01", "x": 2}, {"date": "2026-02-01", "x": 3}]) + + def test_unreadable_history_is_empty(self): + self.assertEqual(gp.read_history(os.path.join(tempfile.gettempdir(), "no-such-history.json")), []) + + +class EndToEnd(Fixture): + def run_main(self, *extra): + out = os.path.join(self.tmp.name, "out") + code = gp.main(["--root", self.root, "--out-dir", out, *extra]) + self.assertEqual(code, 0) + return out + + def read(self, out, name): + with open(os.path.join(out, name), "rb") as f: + return f.read() + + def setUp(self): + super().setUp() + # the interface table of the shipped data file does not know the fixture interfaces + self._load = gp.load_data + gp.load_data = lambda path=gp.DATA_FILE: self.data + self.addCleanup(setattr, gp, "load_data", self._load) + + def test_three_outputs_with_the_disclaimer_first(self): + out = self.run_main() + for name in ("graphics.json", "graphics.html", "graphics.md"): + self.assertTrue(os.path.isfile(os.path.join(out, name)), name) + md = self.read(out, "graphics.md").decode("utf-8") + page = self.read(out, "graphics.html").decode("utf-8") + self.assertIn(gp.DISCLAIMER, md) + self.assertLess(page.index(gp.DISCLAIMER), page.index('class="tiles"')) + self.assertLess(md.index(gp.DISCLAIMER), md.index("| Area |")) + + def test_html_is_self_contained(self): + page = self.read(self.run_main(), "graphics.html").decode("utf-8") + self.assertNotRegex(page, r"(?i) Vulkan layer under runtime/ and the RDNA2 -> SPIR-V translator +tools/rdna2spirv.py. This tool reads their source text and writes a page (HTML and Markdown) and a JSON file with +the raw numbers. It says nothing about whether the game runs: it never builds, runs or imports the code it measures. + + python -I tools/graphics_progress.py # the working tree -> docs/progress/graphics.* + python -I tools/graphics_progress.py --tree origin/main # a git ref, read with git show / git ls-tree + python -I tools/graphics_progress.py --date 2026-11-22 # also append that day to the history file + +What is counted (every number on the page says how, next to it): + milestones the table in docs/d3d12_vulkan.md section 6, one status per row, read from the row's own words; + interfaces per D3D12 interface of the layer, the methods of its chain (names from tools/graphics_progress_data.json, + taken from the Windows SDK d3d12.h) against the overrides found in the class that implements it: + a real body, a body that only returns E_NOTIMPL, or no override (a generated stub); + RDNA2 ISA tools/isa_coverage.py used as a library on the translator text; the instruction total comes from AMD's + XML, which is not in the repository, so the share is the one docs/isa_coverage.md states (or a fresh + one with --isa); + formats GFX10 buffer format codes the translator decodes (Gen.FORMATS) out of the codes a 7-bit buffer V# FORMAT + field can carry (1 to 127 in tools/gfx10_formats.json; the image-only codes from 128 are listed apart), and + DXGI formats the layer maps to Vulkan out of the DXGI list in tools/graphics_progress_data.json; + tests add_test() names in runtime/CMakeLists.txt, per area (registered, not passing); + unsupported places that refuse work: raise Unsupported in the translator, E_NOTIMPL and "unsupported" / "not + implemented" log strings in the runtime. + +Standard library only. The output is deterministic: sorted keys, LF line endings, no clock. A date is written only +when --date is given. Needs no game data, no GPU and no network. +""" +import argparse +import ast +import html +import json +import os +import re +import subprocess +import sys +import tempfile + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(HERE) +DATA_FILE = os.path.join(HERE, "graphics_progress_data.json") +SCHEMA = 1 + +DISCLAIMER = "Counted from the code; says nothing about whether the game runs." + +MILESTONE_DOC = "docs/d3d12_vulkan.md" +ISA_DOC = "docs/isa_coverage.md" +TRANSLATOR = "tools/rdna2spirv.py" +CMAKE = "runtime/CMakeLists.txt" +GFX10_JSON = "tools/gfx10_formats.json" +GFX10_DESCRIPTORS = "runtime/src/gfx10_descriptors.h" +# Width of the FORMAT field of a buffer V# (word3[18:12]); the translator masks it with 0x7F. +BUFFER_FORMAT_BITS = 7 +VK_DEVICE = "runtime/shims/d3d12_vulkan_device.cpp" +# Sources that implement the D3D12 COM objects; the common one carries ID3D12Object and GetDevice for every object. +COM_SOURCES = ["runtime/shims/d3d12_com.cpp", "runtime/shims/d3d12_vulkan_device.cpp", "runtime/shims/dxgi_com.cpp"] +COM_COMMON = ["runtime/shims/d3d12_com_object.h"] + +# -------------------------------------------------------------------------------------------------------------- +# Reading a tree: the working directory, or a git ref through git show / git ls-tree. +# -------------------------------------------------------------------------------------------------------------- + + +def _decode(data): + return data.decode("utf-8", "replace").replace("\r\n", "\n") + + +class WorkTree: + label = "working tree" + commit = None + + def __init__(self, root): + self.root = root + + def text(self, path): + try: + with open(os.path.join(self.root, *path.split("/")), "rb") as f: + return _decode(f.read()) + except OSError: + return None + + def list(self, prefix): + base = os.path.join(self.root, *prefix.split("/")) + out = [] + for folder, dirs, files in os.walk(base): + dirs[:] = sorted(d for d in dirs if d not in (".git", "build", "__pycache__")) + rel = os.path.relpath(folder, self.root).replace(os.sep, "/") + out.extend(f"{rel}/{name}" for name in sorted(files)) + return sorted(out) + + +class GitTree: + def __init__(self, root, ref): + self.root, self.ref = root, ref + self.label = ref + self.commit = self._git("rev-parse", "--verify", ref + "^{commit}").decode("ascii").strip() + + def _git(self, *args): + result = subprocess.run(["git", "-C", self.root, *args], capture_output=True) + if result.returncode != 0: + raise SystemExit(f"git {' '.join(args)}: {result.stderr.decode('utf-8', 'replace').strip()}") + return result.stdout + + def text(self, path): + result = subprocess.run(["git", "-C", self.root, "show", f"{self.commit}:{path}"], capture_output=True) + return _decode(result.stdout) if result.returncode == 0 else None + + def list(self, prefix): + out = self._git("ls-tree", "-r", "--name-only", "-z", self.commit, "--", prefix) + return sorted(p for p in out.decode("utf-8", "replace").split("\0") if p) + + +# -------------------------------------------------------------------------------------------------------------- +# C++ text helpers: mask comments and literals, match braces. Nothing here compiles or runs anything. +# -------------------------------------------------------------------------------------------------------------- + +_LITERALS = re.compile( + r'//[^\n]*|/\*.*?\*/|R"([^\s()\\]{0,16})\(.*?\)\1"|"(?:\\.|[^"\\\n])*"' + r"|(?Stubs` (the generated + stub class of tools/gen_d3d12_stubs.py). A method is `notimpl` when its body only returns E_NOTIMPL and `empty` + when the body is `{}`; a declaration without a body here is taken as defined elsewhere (`real`).""" + masked = mask_cpp(text) + classes = [] + for m in _CLASS.finditer(masked): + end = match_close(masked, m.end() - 1, "{", "}") + if end < 0: + continue + body = masked[m.end():end] + leaf = _LEAF.search(m.group(2)) + classes.append((m.group(1), leaf.group(1) if leaf else None, _methods_in(body))) + return classes + + +def _methods_in(body): + methods = {} + for m in _METHOD.finditer(body): + close = match_close(body, m.end() - 1, "(", ")") + if close < 0: + continue + rest = re.match(r"(?:\s|const|noexcept|override|final)*", body[close + 1:]).end() + close + 1 + kind = "real" + if body[rest:rest + 1] == "{": + stop = match_close(body, rest, "{", "}") + inner = body[rest + 1:stop].strip() if stop > 0 else "x" + if inner == "": + kind = "empty" + elif _TRIVIAL_NOTIMPL.fullmatch(inner): + kind = "notimpl" + elif re.match(r"=\s*delete", body[rest:]): + kind = "notimpl" + # a method seen twice (overloads, #if branches): the real one wins + if methods.get(m.group(1)) in (None, "notimpl", "empty") or kind == "real": + methods[m.group(1)] = kind + return methods + + +def find_function(masked, name): + """The body text of the first function called `name` in masked source, or None.""" + for m in re.finditer(r"\b" + re.escape(name) + r"\s*\(", masked): + close = match_close(masked, m.end() - 1, "(", ")") + tail = re.match(r"\s*(?:const\s*)?(?:noexcept\s*)?\{", masked[close + 1:]) if close > 0 else None + if tail: + start = close + 1 + tail.end() - 1 + stop = match_close(masked, start, "{", "}") + if stop > 0: + return masked[start:stop] + return None + + +# -------------------------------------------------------------------------------------------------------------- +# The counters. Each takes text (or a tree) and returns plain data. +# -------------------------------------------------------------------------------------------------------------- + +MET_RULES = [ # first match wins; the words are the ones the milestone rows use + ("partial", re.compile(r"\bPartly met\b", re.I)), + ("synthetic", re.compile(r"\bSynthetic part met\b", re.I)), + ("met", re.compile(r"\*\*Met\b|\bMet by\b")), +] +STATUS_LABEL = {"met": "met", "synthetic": "synthetic part met", "partial": "partly met", "open": "open"} + + +def parse_milestones(markdown, tree=None): + """Milestone rows of the section titled 'Boot milestones' (a `| **M0** | scope | proves | done when |` table).""" + rows, seen, duplicates = [], set(), 0 + lines = markdown.split("\n") + start = next((i for i, line in enumerate(lines) if re.match(r"##\s+(?:\d+\.\s*)?Boot milestones", line)), None) + if start is None: + return {"found": False, "items": [], "duplicate_rows": 0} + for line in lines[start + 1:]: + if re.match(r"##\s", line): + break + m = re.match(r"\|\s*\*\*(M[\d.]+)\*\*\s*\|(.*)\|\s*$", line) + if not m: + continue + cells = [c.strip() for c in m.group(2).split("|")] + if len(cells) < 3: + continue + mid, scope, proves, done = m.group(1), cells[0], cells[1], "|".join(cells[2:]) + if mid in seen: + duplicates += 1 + continue + seen.add(mid) + status = next((s for s, rx in MET_RULES if rx.search(done)), "open") + named = sorted(set(re.findall(r"`([a-z][a-z0-9_]*_test)`", done))) + entry = {"id": mid, "status": status, "scope": _plain(scope), "named_tests": named} + if tree is not None: + entry["named_tests_found"] = sum(1 for t in named if tree.text(f"runtime/test/{t}.cpp") is not None) + rows.append(entry) + return {"found": True, "items": rows, "duplicate_rows": duplicates} + + +def _plain(text, limit=170): + text = re.sub(r"`([^`]*)`", r"\1", text) + text = re.sub(r"\*\*([^*]*)\*\*", r"\1", text) + text = re.sub(r"\s+", " ", text).strip() + return text if len(text) <= limit else text[:limit - 1].rstrip() + "…" + + +def cmake_stub_interfaces(cmake): + """The interface names handed to tools/gen_d3d12_stubs.py in the CMake file (the interfaces the layer builds).""" + cmake = re.sub(r"#[^\n]*", "", cmake) + m = re.search(r"gen_d3d12_stubs\.py\s+--out(.*?)DEPENDS", cmake, re.S) + return sorted(set(re.findall(r"\bID3D12\w+\b", m.group(1)))) if m else [] + + +def chain_methods(interfaces, leaf): + """Ordered [(owner, method)] along the base chain of leaf, base first, IUnknown left out.""" + names, name = [], leaf + while name in interfaces and name not in names: + names.append(name) + name = interfaces[name].get("base") + out = [] + for owner in reversed(names): + out.extend((owner, method) for method in interfaces[owner]["methods"]) + return out + + +def count_interfaces(leaves, interfaces, class_list, common): + """Per leaf: methods, real, refuses (E_NOTIMPL body), stub (no override), and the open names.""" + report = [] + for leaf in leaves: + if leaf not in interfaces: + report.append({"interface": leaf, "methods": None, "real": None, "refuses": None, "stub": None, + "implementation": None, "open": []}) + continue + candidates = [c for c in class_list if c[1] == leaf] + best = max(candidates, key=lambda c: (len(c[2]), c[0]), default=None) + own = best[2] if best else {} + real = refuses = stub = 0 + open_names = [] + for owner, method in chain_methods(interfaces, leaf): + state = common.get(method) or own.get(method) + if own.get(method) == "real" or common.get(method) == "real": + state = "real" + if state in ("real", "empty"): + real += 1 + elif state == "notimpl": + refuses += 1 + open_names.append(f"{owner}::{method}") + else: + stub += 1 + open_names.append(f"{owner}::{method}") + total = real + refuses + stub + report.append({"interface": leaf, "methods": total, "real": real, "refuses": refuses, "stub": stub, + "implementation": best[0] if best else None, "open": open_names, + "cells": [_cell_state(common, own, m) for _, m in chain_methods(interfaces, leaf)]}) + return report + + +def _cell_state(common, own, method): + if own.get(method) == "real" or common.get(method) == "real": + return "y" + state = common.get(method) or own.get(method) + return {"real": "y", "empty": "y", "notimpl": "r"}.get(state, "n") + + +def isa_snapshot(markdown): + """The counts docs/isa_coverage.md states for its translator commit, or None.""" + flat = re.sub(r"\s+", " ", markdown or "") + head = re.search(r"## Result \(translator at `([0-9a-f]+)`, AMD XML of ([\d-]+)\)", flat) + m = re.search(r"([\d,]+) RDNA2 instructions: ([\d,]+) handled-exact, ([\d,]+) handled-family, ([\d,]+) refused" + r"(?: \([^)]*\))?, ([\d,]+) unknown", flat) + if not m: + return None + n = [int(g.replace(",", "")) for g in m.groups()] + return {"total": n[0], "handled_exact": n[1], "handled_family": n[2], "refused": n[3], "unknown": n[4], + "translator_commit": head.group(1) if head else None, "xml_date": head.group(2) if head else None} + + +def load_isa_coverage(): + """tools/isa_coverage.py of this checkout, used as a library (never the translator itself).""" + if HERE not in sys.path: + sys.path.insert(0, HERE) + import isa_coverage + return isa_coverage + + +def count_isa(tree, isa_xml=None): + ic = load_isa_coverage() + source = tree.text(TRANSLATOR) + if source is None: + return {"found": False} + with tempfile.TemporaryDirectory() as tmp: + path = os.path.join(tmp, "rdna2spirv.py") + with open(path, "w", encoding="utf-8", newline="\n") as f: + f.write(source) + scan = ic.scan_translator(path) + accepted = ic.accepted_names(path) # names compared or tabled outside a test that only raises Unsupported + live = {"rule_names": len(accepted), "refused_names": len(set(scan["refused"]) - accepted), + "branches_that_raise": len(scan["partial"]), "prefix_families": len(scan["prefixes"])} + full = None + if isa_xml: + report = ic.build_report(ic.read_isa(isa_xml), scan, accepted) + t = report["totals"] + full = {"total": report["instructions"], "handled_exact": t["handled-exact"], + "handled_family": t["handled-family"], "refused": t["refused"], "unknown": t["unknown"], + "architecture": report["architecture"]} + snapshot = isa_snapshot(tree.text(ISA_DOC)) + return {"found": True, "live": live, "snapshot": snapshot, "fresh": full} + + +def gen_formats(source): + """Format codes (ints) of the dict assigned to FORMATS in the translator's Gen class, read with ast.""" + codes = set() + for node in ast.walk(ast.parse(source)): + if isinstance(node, ast.ClassDef) and node.name == "Gen": + for item in node.body: + if (isinstance(item, ast.Assign) and any(isinstance(t, ast.Name) and t.id == "FORMATS" + for t in item.targets) and isinstance(item.value, ast.Dict)): + codes.update(k.value for k in item.value.keys if isinstance(k, ast.Constant) + and isinstance(k.value, int)) + return codes + + +def count_formats(tree, dxgi_list): + names = tree.text(GFX10_JSON) + translator = tree.text(TRANSLATOR) + gfx = None + if names is not None and translator is not None: + table = {int(k): v for k, v in json.loads(names).items()} + handled = gen_formats(translator) + # A buffer V# carries FORMAT[6:0] (the translator reads `word3 >> 12 & 0x7F`), so only codes below 2^7 can be + # a buffer format; the table's higher codes (sRGB, BC, FMASK, ...) exist for images only. + limit = 1 << BUFFER_FORMAT_BITS + codes = sorted(c for c, n in table.items() if 0 < c < limit and not n.endswith("_INVALID")) + cells = [{"code": c, "name": table[c].replace("GFX10_FORMAT_", ""), "handled": c in handled} for c in codes] + image_codes = sorted(c for c in table if c >= limit) + mapped_by_runtime = set() + for m in re.finditer(r"^\s*\{(\d+),\s*VK_FORMAT_", mask_cpp(tree.text(GFX10_DESCRIPTORS) or ""), re.M): + mapped_by_runtime.add(int(m.group(1))) + gfx = {"total": len(codes), "handled": sum(1 for c in cells if c["handled"]), + "field_bits": BUFFER_FORMAT_BITS, + "field_bits_seen_in_translator": bool(re.search(r">>\s*12\s*&\s*0x7[Ff]\b", translator)), + "codes_in_table_total": len(table), + "handled_outside_buffer_range": sorted(c for c in handled if not 0 < c < limit), + "codes_outside_table": sorted(handled - set(table)), "cells": cells, + "image_only": {"total": len(image_codes), + "mapped": sum(1 for c in image_codes if c in mapped_by_runtime), + "cells": [{"code": c, "name": table[c].replace("GFX10_FORMAT_", ""), + "mapped": c in mapped_by_runtime} for c in image_codes]}} + dxgi = None + device = tree.text(VK_DEVICE) + if device is not None and dxgi_list: + masked = mask_cpp(device) + mapped = set() + for fn in ("vulkan_format", "vertex_format"): + body = find_function(masked, fn) + if body: + mapped.update(re.findall(r"\bDXGI_FORMAT_(\w+)", body)) + known = set(dxgi_list) + cells = [{"name": n, "mapped": n in mapped} for n in dxgi_list] + dxgi = {"total": len(dxgi_list), "mapped": sum(1 for c in cells if c["mapped"]), + "mapped_not_in_list": sorted(mapped - known), "cells": cells} + return {"gfx10_buffer": gfx, "dxgi": dxgi} + + +TEST_AREAS = [ # first match wins; (area, graphics path?, name pattern) + ("Milestone tests (M1 to M4)", True, r"d3d12_(m\d.*|first_light|translated_draw)$"), + ("Ray tracing (XDXR, BVH)", True, r"(d3d12_)?(xdxr.*|bvh_builder|d3d12_indirect_rt)$"), + ("Presentation", True, r"(xbox_present|d3d12_present|dxgi_swapchain|vk_presenter_sync|frame_pacer)$"), + ("Xbox proxies and root signatures", True, + r"(xs_proxy.*|device_proxy|queue_proxy|allocator_proxy|root_sig.*|root_signature.*|d3d12_xs_root_signature)$"), + ("D3D12 layer on Vulkan", True, r"d3d12_.*"), + ("Vulkan backend and replay", True, + r"(vk_.*|replay_.*|pipeline_cache.*|retire_tickets|bindless_sizing|depth24_convert|predicated_copy|typeless_rtv" + r"|clear_color|subgroup_size|vulkan_device_filter|gfx10_descriptors)$"), + ("Command lists, descriptors, shaders (CPU)", True, + r"(command_list|resource_tiling|descriptor_table|shader_library.*|fsr_dispatch|runtime_types)$"), + ("Loader, shims and media (not graphics)", False, r".*"), +] + + +def count_tests(cmake, shader_files, semantic_files): + code = re.sub(r"#[^\n]*", "", cmake or "") + names = sorted(set(re.findall(r"add_test\s*\(\s*NAME\s+([^\s)]+)", code))) + areas = {} + for name in names: + for area, graphics, pattern in TEST_AREAS: + if re.fullmatch(pattern, name): + entry = areas.setdefault(area, {"graphics": graphics, "tests": []}) + entry["tests"].append(name) + break + graphics_total = sum(len(a["tests"]) for a in areas.values() if a["graphics"]) + return {"registered": len(names), "graphics_path": graphics_total, + "areas": {k: {"graphics": v["graphics"], "count": len(v["tests"]), "tests": v["tests"]} + for k, v in sorted(areas.items())}, + "gpu_programs": sum(1 for p in shader_files if p.endswith(".asm")), + "semantic_tests": sum(1 for p in semantic_files if re.search(r"/test_[^/]*\.py$", p)), + "semantic_fixtures": sum(1 for p in semantic_files if "/fixtures/" in p)} + + +RUNTIME_AREAS = [ # first match wins; None = not a graphics-path file + ("D3D12 device on Vulkan", r"runtime/shims/d3d12_vulkan_device\.cpp$"), + (None, r"runtime/shims/d3d12_trace\.h$"), + ("Command lists, queues, fences", r"runtime/(shims/d3d12_com.*|shims/d3d12_fence_waiter\.h|src/command_list\.h)$"), + ("Xbox device and queue proxies", r"runtime/shims/d3d12_xs.*"), + ("Presentation (DXGI, PresentX)", r"runtime/(shims/(dxgi_.*|xbox_present.*)|src/vulkan_present\.h)$"), + ("Vulkan backend and replay", r"runtime/src/(vulkan_.*|retire_tickets\.h|cached_pso\.h|depth24.*|uav_clear\.h)$"), + ("Root signatures and descriptors", + r"runtime/src/(root_signature.*|descriptor_table\.h|gfx10_descriptors\.h|shader_library\.h|resource_tiling\.h)$"), +] +_SITE = re.compile(r'//[^\n]*|/\*.*?\*/|R"([^\s()\\]{0,16})\(.*?\)\1"|("(?:\\.|[^"\\\n])*")|\bE_NOTIMPL\b', re.S) +_REFUSAL_WORDS = re.compile(r"unsupported|not implemented|unimplemented", re.I) + + +def count_cpp_sites(text): + """(E_NOTIMPL tokens, log/message strings that say unsupported or not implemented) outside comments.""" + notimpl = messages = 0 + for m in _SITE.finditer(text): + if m.group(2): + if _REFUSAL_WORDS.search(m.group(2)): + messages += 1 + elif m.group(0) == "E_NOTIMPL": + notimpl += 1 + return notimpl, messages + + +TRANSLATOR_AREAS = [ # first match on the enclosing function's name + ("Images and sampling", r"image.*|gather.*|.*_lod$|.*bvh.*"), + ("Buffers and formats", r"buffer.*|mtbuf.*|.*format.*"), + ("Global memory and atomics", r"global.*|flat.*|scratch.*|.*atomic.*|addr.*"), + ("LDS and GS", r"lds.*|gs_.*|ds_.*"), + ("DPP and cross-lane", r"dpp.*|swizzle|selectors|mask_.*"), + ("Interpolation and exports", r"interp.*|attribute|export|ms_export|target|x_spill"), + ("Scalar loads and descriptors", r"scalar.*|desc_.*|sgpr.*"), + ("64-bit, f16 and modes", r".*64.*|mode_.*|f64|pair.*|f16.*|.*half.*|src_[hu]|dst|number|compare|write_.*"), + ("Instruction dispatch (_insn)", r"_insn"), +] + + +def count_translator_sites(source): + """Sites that `raise Unsupported(...)`, by the area of the function they sit in (ast; the file is not run).""" + areas, total = {}, 0 + + def area_of(fn): + for name, pattern in TRANSLATOR_AREAS: + if re.fullmatch(pattern, fn or ""): + return name + return "Program structure and checks" + + def walk(node, fn): + nonlocal total + for child in ast.iter_child_nodes(node): + inner = child.name if isinstance(child, (ast.FunctionDef, ast.AsyncFunctionDef)) else fn + if (isinstance(child, ast.Raise) and isinstance(child.exc, ast.Call) + and getattr(child.exc.func, "id", None) == "Unsupported"): + total += 1 + areas[area_of(fn)] = areas.get(area_of(fn), 0) + 1 + walk(child, inner) + + walk(ast.parse(source), None) + return {"total": total, "areas": dict(sorted(areas.items()))} + + +def count_unsupported(tree): + areas, outside = {}, 0 + for prefix in ("runtime/src", "runtime/shims"): + for path in tree.list(prefix): + if not re.search(r"\.(cpp|h|inc)$", path): + continue + area = next((a for a, rx in RUNTIME_AREAS if re.match(rx, path)), "") + if area == "" or area is None: + outside += 1 + continue + notimpl, messages = count_cpp_sites(tree.text(path) or "") + entry = areas.setdefault(area, {"e_notimpl": 0, "messages": 0, "files": 0}) + entry["e_notimpl"] += notimpl + entry["messages"] += messages + entry["files"] += 1 + source = tree.text(TRANSLATOR) + translator = count_translator_sites(source) if source else {"total": 0, "areas": {}} + runtime_total = sum(a["e_notimpl"] + a["messages"] for a in areas.values()) + return {"runtime_total": runtime_total, "runtime_areas": dict(sorted(areas.items())), + "runtime_files_outside_graphics_path": outside, "translator": translator} + + +def load_data(path=DATA_FILE): + with open(path, encoding="utf-8") as f: + return json.load(f) + + +def collect(tree, data, isa_xml=None, d3d12_override=None): + """All counts for one tree, as plain JSON-serialisable data.""" + interfaces = d3d12_override or data["d3d12"] + cmake = tree.text(CMAKE) or "" + leaves = cmake_stub_interfaces(cmake) + class_list = [] + for path in COM_SOURCES: + class_list.extend(class_methods(tree.text(path) or "")) + common = {} + for path in COM_COMMON: + for _, _, methods in class_methods(tree.text(path) or ""): + common.update(methods) + milestones_text = tree.text(MILESTONE_DOC) + shaders = tree.list("runtime/test/shaders") + semantic = tree.list("tests/semantic") + return { + "milestones": parse_milestones(milestones_text, tree) if milestones_text else + {"found": False, "items": [], "duplicate_rows": 0}, + "interfaces": count_interfaces(leaves, interfaces, class_list, common), + "isa": count_isa(tree, isa_xml), + "formats": count_formats(tree, data.get("dxgi_formats", [])), + "tests": count_tests(cmake, shaders, semantic), + "unsupported": count_unsupported(tree), + } + + +def pct(part, whole): + return round(100.0 * part / whole, 1) if whole else 0.0 + + +def headline(counts): + """The overview tiles: id, label, value, total (or None), unit, note.""" + tiles = [] + ms = counts["milestones"]["items"] + met = sum(1 for m in ms if m["status"] == "met") + some = sum(1 for m in ms if m["status"] in ("synthetic", "partial")) + tiles.append({"id": "milestones", "label": "Milestones", "value": met, "total": len(ms), "unit": "met", + "note": f"{some} more met in part"}) + ifaces = [i for i in counts["interfaces"] if i["methods"]] + real, total = sum(i["real"] for i in ifaces), sum(i["methods"] for i in ifaces) + tiles.append({"id": "interfaces", "label": "D3D12 methods", "value": real, "total": total, "unit": "real", + "note": f"{len(ifaces)} interfaces"}) + isa = counts["isa"] + if isa.get("found"): + ref = isa.get("fresh") or isa.get("snapshot") + if ref: + has_rule = ref["handled_exact"] + ref["handled_family"] + source = "this run" if isa.get("fresh") else "docs/isa_coverage.md" + tiles.append({"id": "isa", "label": "RDNA2 instructions", "value": has_rule, "total": ref["total"], + "unit": "with a rule", "note": f"share from {source}"}) + else: + tiles.append({"id": "isa", "label": "RDNA2 rule names", "value": isa["live"]["rule_names"], "total": None, + "unit": "names", "note": "no total available"}) + fm = counts["formats"] + if fm["gfx10_buffer"]: + tiles.append({"id": "formats", "label": "Buffer formats", "value": fm["gfx10_buffer"]["handled"], + "total": fm["gfx10_buffer"]["total"], "unit": "decoded", + "note": "GFX10 codes 1 to 77 in the translator"}) + t = counts["tests"] + tiles.append({"id": "tests", "label": "Graphics tests", "value": t["graphics_path"], "total": None, + "unit": "registered", "note": f"{t['registered']} in all"}) + u = counts["unsupported"] + tiles.append({"id": "unsupported", "label": "Refusal sites", "value": u["runtime_total"] + u["translator"]["total"], + "total": None, "unit": "in code", "note": f"{u['translator']['total']} translator, " + f"{u['runtime_total']} runtime"}) + for tile in tiles: + tile["pct"] = pct(tile["value"], tile["total"]) if tile["total"] else None + return tiles + + +def history_point(date, counts): + """The numbers one history row keeps.""" + ifaces = [i for i in counts["interfaces"] if i["methods"]] + fm = counts["formats"] + isa = counts["isa"].get("live", {}) + return {"date": date, + "milestones_met": sum(1 for m in counts["milestones"]["items"] if m["status"] == "met"), + "milestones_total": len(counts["milestones"]["items"]), + "methods_real": sum(i["real"] for i in ifaces), "methods_total": sum(i["methods"] for i in ifaces), + "isa_rule_names": isa.get("rule_names"), + "buffer_formats": fm["gfx10_buffer"]["handled"] if fm["gfx10_buffer"] else None, + "dxgi_formats": fm["dxgi"]["mapped"] if fm["dxgi"] else None, + "graphics_tests": counts["tests"]["graphics_path"], + "refusal_sites": counts["unsupported"]["runtime_total"] + counts["unsupported"]["translator"]["total"]} + + +def read_history(path): + try: + with open(path, encoding="utf-8") as f: + data = json.load(f) + return [p for p in data.get("points", []) if isinstance(p, dict) and "date" in p] + except (OSError, ValueError, AttributeError): + return [] + + +def merge_history(points, point): + """One point per date: a second run on the same date replaces the first.""" + kept = [p for p in points if p["date"] != point["date"]] + return sorted(kept + [point], key=lambda p: p["date"]) + + +def dumps(data): + return json.dumps(data, indent=2, sort_keys=True, ensure_ascii=True) + "\n" + + +# -------------------------------------------------------------------------------------------------------------- +# The page: sections of blocks, rendered once as Markdown and once as HTML. +# -------------------------------------------------------------------------------------------------------------- + +def fmt(n): + return "-" if n is None else f"{n:,}" + + +def sections(counts, history, data_source=""): + """[{id, title, how, blocks}], blocks being ('table', ...), ('raster', ...), ('details', ...) or ('note', text).""" + out = [] + + ms = counts["milestones"] + rows = [[m["id"], STATUS_LABEL[m["status"]], m["scope"], + (f"{m['named_tests_found']} of {len(m['named_tests'])}" if m["named_tests"] else "-")] + for m in ms["items"]] + blocks = [("table", ["Id", "Status", "Scope", "Named tests found"], rows, {"num": [3], "status": 1})] + if ms["duplicate_rows"]: + blocks.append(("note", f"The table lists {ms['duplicate_rows']} row(s) twice; each id is counted once.")) + if not ms["found"]: + blocks = [("note", f"No milestone table found in {MILESTONE_DOC}.")] + out.append({"id": "milestones", "title": "Milestones", + "how": f"Rows of the boot milestone table in {MILESTONE_DOC}, section 6, each id once. A row is " + "\"met\" when its Done-when cell says \"Met by\" or \"**Met\", \"synthetic part met\" when it " + "says \"Synthetic part met\", \"partly met\" when it says \"Partly met\", otherwise open. " + "The words are the authors'; this page does not judge them. Open pull requests are not " + "known here. Named tests are the names ending in _test in the row that have a source file in " + "runtime/test.", "blocks": blocks}) + + ifaces = counts["interfaces"] + rows = [] + rasters = [] + details = [] + for i in ifaces: + if i["methods"] is None: + rows.append([i["interface"], "-", "-", "-", "-", "-"]) + continue + rows.append([i["interface"], fmt(i["real"]), fmt(i["refuses"]), fmt(i["stub"]), fmt(i["methods"]), + {"bar": i["real"] / i["methods"] if i["methods"] else 0, "t": f"{pct(i['real'], i['methods'])}%"}]) + rasters.append(("raster", i["interface"], [{"state": s, "title": n.split("::")[-1]} + for s, n in zip(i["cells"], _method_names(i, counts))], + f"{i['interface']}: {i['real']} of {i['methods']} methods have a real body")) + if i["open"]: + details.append(("details", f"{i['interface']}: {len(i['open'])} open", i["open"])) + out.append({"id": "interfaces", "title": "D3D12 interface coverage", + "how": "Interfaces are the ones handed to tools/gen_d3d12_stubs.py in runtime/CMakeLists.txt. Methods " + "are the names of each interface and its bases (IUnknown left out) in " + "tools/graphics_progress_data.json (names only, taken from the " + (data_source or "Windows SDK headers") + "); a method is counted once per vtable slot, so the two spellings of GetDesc in the SDK header are one. Real: an override with a body " + "in the class that derives from the interface's generated stub class, or in the shared object " + "template. Refuses: an override whose body only returns E_NOTIMPL. Stub: no override, so the " + "generated stub answers (E_NOTIMPL, or nothing) and logs once. Matching is by method name, " + "like gen_d3d12_stubs.py --report; a real body can still be partial.", + "blocks": [("table", ["Interface", "Real", "Refuses", "Stub", "Methods", "Share"], rows, + {"num": [1, 2, 3, 4, 5]})] + rasters + [("legend", "interface")] + details}) + + isa = counts["isa"] + rows, notes = [], [] + if isa.get("found"): + live = isa["live"] + rows += [["Instruction names the translator accepts", fmt(live["rule_names"]), "counted from this tree"], + ["Names it refuses everywhere", fmt(live["refused_names"]), "counted from this tree"], + ["Branches that accept a name but can raise", fmt(live["branches_that_raise"]), + "counted from this tree"], + ["Prefix families (ds_, v_cmp_, ...)", fmt(live["prefix_families"]), "counted from this tree"]] + ref = isa.get("fresh") + label = "this run, AMD XML" + if ref is None and isa.get("snapshot"): + ref = isa["snapshot"] + label = f"stated in {ISA_DOC}" + if ref: + rows += [["RDNA2 instructions in AMD's XML", fmt(ref["total"]), label], + ["with an exact rule", fmt(ref["handled_exact"]), label], + ["with a prefix rule", fmt(ref["handled_family"]), label], + ["refused", fmt(ref["refused"]), label], ["unknown", fmt(ref["unknown"]), label]] + if isa.get("snapshot") and not isa.get("fresh"): + s = isa["snapshot"] + notes.append(f"The instruction total comes from AMD's XML, which is not in the repository. The share " + f"above is what {ISA_DOC} states for the translator at {s['translator_commit']}; this " + f"tool did not recount it. Run tools/isa_coverage.py or pass --isa for a fresh one.") + else: + notes.append(f"No translator found at {TRANSLATOR}.") + out.append({"id": "isa", "title": "RDNA2 instruction coverage", + "how": "tools/isa_coverage.py is used as a library on the translator text (an ast scan; the " + "translator is not run). \"Has a rule\" means the opcode name is compared or tabled, or starts " + "with a tested prefix; it does not mean the rule is right. Prefix rules are an upper bound.", + "blocks": ([("table", ["Measure", "Count", "Source"], rows, {"num": [1]})] if rows else []) + + [("note", n) for n in notes]}) + + fm = counts["formats"] + blocks = [] + g = fm["gfx10_buffer"] + if g: + blocks += [("table", ["Kind", "Handled", "Total", "Share"], + [["GFX10 buffer format codes (translator)", fmt(g["handled"]), fmt(g["total"]), + {"bar": g["handled"] / g["total"], "t": f"{pct(g['handled'], g['total'])}%"}]], {"num": [1, 2, 3]}), + ("raster", "GFX10 buffer format codes", + [{"state": "y" if c["handled"] else "n", "title": f"{c['code']} {c['name']}"} for c in g["cells"]], + f"GFX10 buffer format codes: {g['handled']} of {g['total']} decoded"), + ("legend", "format")] + have = [f"{c['code']} {c['name']}" for c in g["cells"] if c["handled"]] + missing = [f"{c['code']} {c['name']}" for c in g["cells"] if not c["handled"]] + blocks += [("details", f"Decoded ({len(have)})", have), ("details", f"Not decoded ({len(missing)})", missing)] + im = g["image_only"] + if im["total"]: + blocks += [("table", ["Kind", "Mapped", "Total", "Share"], + [["Image-only codes the runtime maps to Vulkan (gfx10_descriptors.h)", fmt(im["mapped"]), + fmt(im["total"]), {"bar": im["mapped"] / im["total"], + "t": f"{pct(im['mapped'], im['total'])}%"}]], {"num": [1, 2, 3]}), + ("raster", "Image-only format codes", + [{"state": "y" if c["mapped"] else "n", "title": f"{c['code']} {c['name']}"} + for c in im["cells"]], + f"Image-only format codes: {im['mapped']} of {im['total']} mapped"), + ("legend", "format")] + unmapped = [f"{c['code']} {c['name']}" for c in im["cells"] if not c["mapped"]] + blocks.append(("details", f"Image-only codes not mapped ({len(unmapped)})", unmapped)) + d = fm["dxgi"] + if d: + blocks += [("table", ["Kind", "Mapped", "Total", "Share"], + [["DXGI formats the layer maps to Vulkan", fmt(d["mapped"]), fmt(d["total"]), + {"bar": d["mapped"] / d["total"], "t": f"{pct(d['mapped'], d['total'])}%"}]], {"num": [1, 2, 3]}), + ("raster", "DXGI formats", + [{"state": "y" if c["mapped"] else "n", "title": c["name"]} for c in d["cells"]], + f"DXGI formats: {d['mapped']} of {d['total']} mapped"), + ("legend", "format")] + unmapped = [c["name"] for c in d["cells"] if not c["mapped"]] + blocks.append(("details", f"Not mapped ({len(unmapped)})", unmapped)) + out.append({"id": "formats", "title": "Formats", + "how": "Buffer: a buffer V# holds its format in a 7-bit field (word3[18:12]; the translator reads it " + "with `& 0x7F`), so only codes 1 to 127 of tools/gfx10_formats.json can be a buffer format, " + "INVALID (0) left out; in the table those are the contiguous codes 1 to 77, and 78 to 127 are " + "reserved. Handled is the integer keys of the FORMATS dict in class Gen of the translator " + "(read with ast). Codes from 128 (sRGB, BC, FMASK and others) exist for images only and are " + "not in the buffer count; they are listed apart as image-only codes, counted as the codes " + "the runtime table in runtime/src/gfx10_descriptors.h maps to a Vulkan format. DXGI: names in " + f"a case label or table row of vulkan_format() and vertex_format() in {VK_DEVICE}, out of the " + "DXGI_FORMAT enum names (UNKNOWN left out) in tools/graphics_progress_data.json" + + (f", which holds names only and comes from the {data_source}" if data_source else "") + + ". The DXGI total is that enum's size, not a list this project chose. Mapped means a " + "Vulkan format is chosen, not that every usage of it works.", "blocks": blocks}) + + t = counts["tests"] + rows = [[name, fmt(a["count"]), "yes" if a["graphics"] else "no"] for name, a in t["areas"].items()] + blocks = [("table", ["Area", "Registered", "Graphics path"], rows, {"num": [1]}), + ("table", ["Also in the tree", "Count"], + [["Hand-written RDNA2 programs in runtime/test/shaders (.asm)", fmt(t["gpu_programs"])], + ["Translator regression tests in tests/semantic (test_*.py)", fmt(t["semantic_tests"])], + ["Fixture files in tests/semantic/fixtures", fmt(t["semantic_fixtures"])]], {"num": [1]})] + blocks += [("details", f"{n} ({a['count']})", a["tests"]) for n, a in t["areas"].items()] + out.append({"id": "tests", "title": "GPU test inventory", + "how": "Distinct names in add_test(NAME ...) calls of runtime/CMakeLists.txt, sorted into areas by " + "name. Registered under a condition (a GPU, a header, a tool) still counts once, and a name " + "with ${...} counts as one. Registered is not passing, and many need a GPU to do anything.", + "blocks": blocks}) + + u = counts["unsupported"] + rows = [[a, fmt(v["e_notimpl"]), fmt(v["messages"]), fmt(v["e_notimpl"] + v["messages"])] + for a, v in u["runtime_areas"].items()] + blocks = [("table", ["Runtime area", "E_NOTIMPL", "Messages", "Sites"], rows, {"num": [1, 2, 3]}), + ("table", ["Translator area", "raise Unsupported"], + [[a, fmt(n)] for a, n in u["translator"]["areas"].items()], {"num": [1]})] + out.append({"id": "unsupported", "title": "Unsupported sites", + "how": "The places that refuse work, so the list of what is still needed. Runtime: each E_NOTIMPL " + "token and each string that says \"unsupported\", \"not implemented\" or \"unimplemented\", " + f"outside comments, in the graphics-path files of runtime/src and runtime/shims " + f"({u['runtime_files_outside_graphics_path']} other files are not counted). Translator: each " + "`raise Unsupported(...)` in tools/rdna2spirv.py, by the function it sits in. A site is a line " + "of code, not one missing feature: one site can guard many cases, and a site that fires " + "rarely counts the same as one that fires always.", "blocks": blocks}) + + if history: + last = history[-14:] + rows = [[p["date"], f"{p['milestones_met']}/{p['milestones_total']}", + f"{fmt(p['methods_real'])}/{fmt(p['methods_total'])}", fmt(p.get("isa_rule_names")), + fmt(p.get("buffer_formats")), fmt(p.get("dxgi_formats")), fmt(p["graphics_tests"]), + fmt(p["refusal_sites"])] for p in reversed(last)] + out.append({"id": "history", "title": "History", + "how": "One row per date this tool ran with --date, newest first, the last 14. The numbers are " + "the counts above for that day's tree.", + "blocks": [("table", ["Date", "Milestones", "Methods", "ISA names", "Buffer formats", + "DXGI formats", "Tests", "Refusals"], rows, {"num": [1, 2, 3, 4, 5, 6, 7]})]}) + return out + + +def _method_names(iface, counts): + # names in chain order are not stored per cell; the open list holds only the open ones, so rebuild from data + return iface.get("method_names") or [""] * len(iface["cells"]) + + +# ---- Markdown ------------------------------------------------------------------------------------------------ + +def md_cell(c): + if isinstance(c, dict): + return c["t"] + return str(c).replace("|", "\\|") + + +def render_md(report, secs): + meta = report["meta"] + lines = ["# Graphics path progress", "", f"**{DISCLAIMER}**", "", + "The Xbox D3D12 to Vulkan layer under `runtime/` and the RDNA2 to SPIR-V translator " + "`tools/rdna2spirv.py`. Each number is a count over source text; nothing was built or run.", "", + f"Source: {meta['source']}" + (f", {meta['date']}" if meta.get("date") else "") + ".", "", + "| Area | Count | Of | Share |", "|---|---:|---:|---:|"] + for t in report["headline"]: + lines.append(f"| [{t['label']}](#{t['id']}) | {fmt(t['value'])} {t['unit']} | {fmt(t['total'])} | " + f"{'' if t['pct'] is None else str(t['pct']) + '%'} |") + lines.append("") + for s in secs: + lines += [f"", "", f"## {s['title']}", "", f"*How this is counted.* {s['how']}", ""] + for block in s["blocks"]: + kind = block[0] + if kind == "table": + _, head, rows, opts = block + lines.append("| " + " | ".join(head) + " |") + lines.append("|" + "|".join("---:" if i in opts.get("num", []) else "---" for i in range(len(head))) + "|") + lines += ["| " + " | ".join(md_cell(c) for c in row) + " |" for row in rows] + lines.append("") + elif kind == "note": + lines += [block[1], ""] + elif kind == "details": + _, summary, items = block + if items: + lines += ["
" + html.escape(summary) + "", "", + ", ".join(f"`{i}`" for i in items), "", "
", ""] + # rasters and legends are page-only; the tables carry the same numbers + lines += ["---", "", "Generated by `tools/graphics_progress.py`. Raw numbers: `graphics.json`. " + "Counts are over committed text, so they move only when the code does.", ""] + return "\n".join(lines) + + +# ---- HTML ---------------------------------------------------------------------------------------------------- + +CSS = """ +:root{color-scheme:light dark;--paper:#f5f2ea;--panel:#fbf9f4;--ink:#1c1e23;--ink-2:#4f535c;--rule:#d8d3c5; +--track:#e2ddcf;--warn:#a63d27;--font:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; +--serif:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif; +--mono:ui-monospace,"Cascadia Mono","SF Mono",Consolas,Menlo,monospace} +@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--paper:#131519;--panel:#1a1d22;--ink:#ebe7dd; +--ink-2:#a3a7af;--rule:#2d3138;--track:#2a2e35;--warn:#ef8d72}} +:root[data-theme="dark"]{--paper:#131519;--panel:#1a1d22;--ink:#ebe7dd;--ink-2:#a3a7af;--rule:#2d3138; +--track:#2a2e35;--warn:#ef8d72} +*{box-sizing:border-box} +html{-webkit-text-size-adjust:100%;text-size-adjust:100%} +body{margin:0;background:var(--paper);color:var(--ink);font:16px/1.55 var(--font); +-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} +a{color:inherit;text-decoration-thickness:from-font;text-underline-offset:.18em} +a:focus-visible,summary:focus-visible,.scroll:focus-visible{outline:2px solid var(--ink);outline-offset:2px} +.skip{position:absolute;inset-inline-start:16px;top:-48px;background:var(--ink);color:var(--paper);padding:8px 12px} +.skip:focus{top:8px} +main{max-width:64rem;margin:0 auto;padding:32px 16px 64px} +.eyebrow{font:600 12px/1.2 var(--mono);letter-spacing:.12em;text-transform:uppercase;color:var(--ink-2);margin:0 0 12px} +h1{font:600 clamp(1.75rem,5vw,2.75rem)/1.1 var(--serif);letter-spacing:-.015em;margin:0 0 16px;text-wrap:balance} +h2{font:600 1.375rem/1.2 var(--serif);letter-spacing:-.01em;margin:0 0 8px;text-wrap:balance} +p{margin:0 0 12px;max-inline-size:68ch;text-wrap:pretty} +.disclaimer{border-inline-start:4px solid var(--ink);padding:4px 0 4px 16px;margin:0 0 16px;font-weight:600; +font-size:1.125rem;line-height:1.4} +.lede,.meta{color:var(--ink-2)} +.meta{font:13px/1.4 var(--mono);margin-bottom:32px} +.tiles{display:grid;grid-template-columns:1fr;gap:12px;margin:0 0 48px;padding:0;list-style:none} +@media (min-width:480px){.tiles{grid-template-columns:repeat(2,1fr)}} +@media (min-width:760px){.tiles{grid-template-columns:repeat(3,1fr)}} +.tile{display:block;height:100%;padding:16px;background:var(--panel);border:1px solid var(--rule);border-radius:6px; +text-decoration:none;transition:transform 140ms cubic-bezier(.23,1,.32,1)} +@media (hover:hover) and (pointer:fine){.tile:hover .tile-label{text-decoration:underline}} +.tile:active{transform:scale(.98)} +.tile-label{display:block;font:600 12px/1.3 var(--mono);letter-spacing:.08em;text-transform:uppercase; +color:var(--ink-2);margin-bottom:8px} +.tile-num{display:block;font:600 2rem/1.1 var(--mono);font-variant-numeric:tabular-nums;letter-spacing:-.02em} +.tile-of{font-size:.9rem;color:var(--ink-2);font-weight:400;letter-spacing:0} +.tile-note{display:block;font-size:13px;line-height:1.4;color:var(--ink-2);margin-top:4px;min-height:1.4em} +.bar{display:block;height:4px;background:var(--track);border-radius:2px;margin-top:12px;overflow:hidden} +.bar>i{display:block;height:100%;background:var(--ink);border-radius:2px} +section{margin:0 0 48px;scroll-margin-top:16px} +.how{color:var(--ink-2);font-size:.9375rem} +.how b{font-weight:600;color:var(--ink)} +.scroll{overflow-x:auto;margin:16px 0} +table{border-collapse:collapse;width:100%;font-size:.9375rem;font-variant-numeric:tabular-nums} +caption{text-align:start;font-size:13px;color:var(--ink-2);padding-bottom:4px} +th,td{padding:8px 12px 8px 0;border-bottom:1px solid var(--rule);text-align:start;vertical-align:top; +overflow-wrap:break-word} +th.rowh{font:inherit;text-transform:none;letter-spacing:0;color:inherit;white-space:normal; +border-bottom:1px solid var(--rule);overflow-wrap:anywhere} +th.rowh.short{white-space:nowrap} +th{font:600 12px/1.3 var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-2); +border-bottom:1px solid var(--ink);white-space:nowrap} +td.n,th.n{text-align:end;font-family:var(--mono);padding-inline:12px 0} +td.n+td,th.n+th{padding-inline-start:16px} +td .bar{margin:0;min-width:56px} +td.share{white-space:nowrap} +td.share span{display:block;font:13px/1.3 var(--mono);color:var(--ink-2);margin-bottom:4px;text-align:end} +td.warn{color:var(--warn)} +.raster{display:flex;flex-wrap:wrap;gap:2px;margin:8px 0 4px} +.raster-wrap{margin:16px 0} +.raster-label{font:600 12px/1.3 var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-2)} +.c{display:block;width:10px;height:10px;border:1px solid var(--ink-2);border-radius:1px;background:transparent} +.c.y{background:var(--ink);border-color:var(--ink)} +.c.r{background:repeating-linear-gradient(135deg,var(--warn) 0 2px,transparent 2px 4px);border-color:var(--warn)} +.legend{display:flex;flex-wrap:wrap;gap:4px 16px;font-size:13px;color:var(--ink-2);margin:4px 0 16px} +.legend span{display:inline-flex;align-items:center;gap:6px} +.legend .c{display:inline-block} +details{margin:8px 0} +summary{cursor:pointer;font-size:.9375rem;padding:4px 0} +details p{font:13px/1.6 var(--mono);color:var(--ink-2);overflow-wrap:anywhere;max-inline-size:none} +footer{border-top:1px solid var(--rule);padding-top:16px;color:var(--ink-2);font-size:.875rem} +@media (prefers-reduced-motion:reduce){.tile{transition:none}.tile:active{transform:none}} +@media print{.skip{display:none}} +""" + + +def _h(text): + return html.escape(str(text), quote=True) + + +def html_cell(c, numeric, share_col): + if isinstance(c, dict): + return (f'{_h(c["t"])}' + f'') + return f'{_h(c)}' + + +LEGENDS = {"interface": [("y", "real body"), ("r", "returns E_NOTIMPL"), ("n", "generated stub")], + "format": [("y", "handled"), ("n", "not handled")]} + + +def render_html(report, secs): + meta = report["meta"] + out = ['', '', "", '', + '', + "Graphics path progress", + '', + f"", "", "", '', + '
', '

Leonida / graphics path

', "

Graphics path progress

", + f'

{_h(DISCLAIMER)}

', + '

The Xbox D3D12 to Vulkan layer under runtime/ and the RDNA2 to SPIR-V ' + "translator tools/rdna2spirv.py. Every number is a count over source text. Nothing was " + "built, run or imported to get it.

", + f'

Source: {_h(meta["source"])}' + (f" · {_h(meta['date'])}" if meta.get("date") else "") + + "

", '
    '] + for t in report["headline"]: + total = f' of {fmt(t["total"])}' if t["total"] else "" + unit = f' {_h(t["unit"])}' if not t["total"] else "" + bar = "" + label = f'{t["label"]}: {fmt(t["value"])}' + (f' of {fmt(t["total"])}, {t["pct"]}%' if t["total"] else "") + if t["total"]: + bar = f'' + pct_text = f" · {t['pct']}%" if t["pct"] is not None else "" + out.append(f'
  • ' + f'{_h(t["label"])}{fmt(t["value"])}{total}{unit}' + f'{_h(t["note"])}{pct_text}{bar}
  • ') + out.append("
") + for s in secs: + out += [f'
', f'

{_h(s["title"])}

', + f'

How this is counted. {_h(s["how"])}

'] + for block in s["blocks"]: + kind = block[0] + if kind == "table": + _, head, rows, opts = block + num = set(opts.get("num", [])) + out.append(f'
' + "" + + "".join(f'' + for i, h in enumerate(head)) + "") + for row in rows: + cells = [] + for i, c in enumerate(row): + if i == 0: + nowrap = ' class="rowh short"' if len(str(c)) <= 8 else ' class="rowh"' + cells.append(f'') + else: + cells.append(html_cell(c, i in num, False)) + out.append("" + "".join(cells) + "") + out.append("
{_h(h)}
{_h(c)}
") + elif kind == "raster": + _, label, cells, aria = block + out.append(f'
{_h(label)}
' + f'
") + elif kind == "legend": + out.append('") + elif kind == "note": + out.append(f"

{_h(block[1])}

") + elif kind == "details": + _, summary, items = block + if items: + out.append(f"
{_h(summary)}

{_h(', '.join(items))}

") + out.append("
") + out += ["

Generated by tools/graphics_progress.py. Raw numbers are in " + "graphics.json; the same page as Markdown is graphics.md. The counts move only " + "when the committed code does.

", "
", "", "", ""] + return "\n".join(out) + + +# -------------------------------------------------------------------------------------------------------------- +# Refreshing the data file from the SDK headers (a maintainer step; the CI run never needs the headers). +# -------------------------------------------------------------------------------------------------------------- + +def refresh_data(d3d12_header, dxgi_header, out_path=DATA_FILE): + if HERE not in sys.path: + sys.path.insert(0, HERE) + import gen_d3d12_stubs as gen + with open(d3d12_header, encoding="utf-8", errors="replace") as f: + parsed = gen.parse_interfaces(f.read()) + d3d12 = {name: {"base": base, "methods": list(dict.fromkeys(it[2] for it in items if it[0] == "m"))} + for name, (base, items) in sorted(parsed.items())} + with open(dxgi_header, encoding="utf-8", errors="replace") as f: + enum = re.findall(r"\bDXGI_FORMAT_(\w+)\s*=\s*(\d+)", gen.COMMENTS_OR_LITERALS.sub(" ", f.read())) + formats = [n for n, v in sorted(set(enum), key=lambda x: int(x[1])) if n not in ("UNKNOWN", "FORCE_UINT")] + version = re.search(r"[/\\](\d+\.\d+\.\d+\.\d+)[/\\]", d3d12_header.replace("\\", "/") + "/") + source = (f"Windows SDK {version.group(1)} (d3d12.h, dxgiformat.h)" if version + else "Windows SDK headers (d3d12.h, dxgiformat.h)") + data = {"about": "Method names of the ID3D12 interfaces (Windows SDK d3d12.h) and the DXGI_FORMAT names " + "(dxgiformat.h). Names only, no declarations or other SDK text. Regenerate with " + "tools/graphics_progress.py --refresh-data --d3d12-header --dxgi-header .", + "source": source, "d3d12": d3d12, "dxgi_formats": formats} + with open(out_path, "w", encoding="utf-8", newline="\n") as f: + f.write(json.dumps(data, indent=1, sort_keys=True, ensure_ascii=True) + "\n") + return len(d3d12), len(formats) + + +# -------------------------------------------------------------------------------------------------------------- + +def build_report(tree, data, isa_xml=None, date=None): + counts = collect(tree, data, isa_xml) + names = {} + for i in counts["interfaces"]: + if i["methods"]: + names[i["interface"]] = [m for _, m in chain_methods(data["d3d12"], i["interface"])] + for i in counts["interfaces"]: + if i["methods"]: + i["method_names"] = names[i["interface"]] + meta = {"source": tree.label + (f" ({tree.commit[:12]})" if tree.commit else ""), "schema": SCHEMA, + "disclaimer": DISCLAIMER} + if tree.commit: + meta["commit"] = tree.commit + if date: + meta["date"] = date + if data.get("source"): + meta["data_source"] = data["source"] + report = {"meta": meta, "counts": counts} + report["headline"] = headline(counts) + return report + + +def put_text(path, text): + os.makedirs(os.path.dirname(os.path.abspath(path)), exist_ok=True) + with open(path, "w", encoding="utf-8", newline="\n") as f: + f.write(text) + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0]) + parser.add_argument("--tree", metavar="REF", help="read this git ref instead of the working tree") + parser.add_argument("--root", default=ROOT, help="repository root (default: this checkout)") + parser.add_argument("--out-dir", default=None, help="folder for graphics.json/.html/.md (default docs/progress)") + parser.add_argument("--date", metavar="YYYY-MM-DD", help="stamp the output and add this day to the history") + parser.add_argument("--history", metavar="FILE", help="history file (default /graphics-history.json)") + parser.add_argument("--isa", metavar="XML", help="AMD's amdgpu_isa_rdna2.xml, for a fresh instruction total") + parser.add_argument("--d3d12-header", metavar="H", help="count methods from this d3d12.h instead of the data file") + parser.add_argument("--refresh-data", action="store_true", + help="rewrite tools/graphics_progress_data.json from --d3d12-header and --dxgi-header") + parser.add_argument("--dxgi-header", metavar="H") + parser.add_argument("--print", action="store_true", help="print the headline numbers") + args = parser.parse_args(argv) + + if args.refresh_data: + if not (args.d3d12_header and args.dxgi_header): + parser.error("--refresh-data needs --d3d12-header and --dxgi-header") + n, f = refresh_data(args.d3d12_header, args.dxgi_header) + print(f"wrote {DATA_FILE}: {n} interfaces, {f} DXGI formats") + return 0 + if args.date and not re.fullmatch(r"\d{4}-\d{2}-\d{2}", args.date): + parser.error("--date must look like 2026-11-22") + root = os.path.abspath(args.root) + tree = GitTree(root, args.tree) if args.tree else WorkTree(root) + data = load_data() + override = None + if args.d3d12_header: + if HERE not in sys.path: + sys.path.insert(0, HERE) + import gen_d3d12_stubs as gen + with open(args.d3d12_header, encoding="utf-8", errors="replace") as f: + parsed = gen.parse_interfaces(f.read()) + override = {n: {"base": b, "methods": list(dict.fromkeys(i[2] for i in items if i[0] == "m"))} for n, (b, items) in parsed.items()} + data = dict(data, d3d12=override) + report = build_report(tree, data, args.isa, args.date) + + out_dir = args.out_dir or os.path.join(root, "docs", "progress") + history_path = args.history or os.path.join(out_dir, "graphics-history.json") + history = read_history(history_path) + if args.date: + history = merge_history(history, history_point(args.date, report["counts"])) + put_text(history_path, dumps({"points": history, "schema": SCHEMA})) + secs = sections(report["counts"], history, report["meta"].get("data_source", "")) + # the JSON keeps the raw counts; the per-interface cell strings are page-only + json_report = json.loads(json.dumps(report)) + for i in json_report["counts"]["interfaces"]: + i.pop("cells", None) + i.pop("method_names", None) + for key in ("gfx10_buffer", "dxgi"): + block = json_report["counts"]["formats"].get(key) + if block: + block["cells"] = [c for c in block["cells"]] + json_report["history_points"] = len(history) + put_text(os.path.join(out_dir, "graphics.json"), dumps(json_report)) + put_text(os.path.join(out_dir, "graphics.md"), render_md(report, secs)) + put_text(os.path.join(out_dir, "graphics.html"), render_html(report, secs)) + if args.print: + for t in report["headline"]: + of = f" of {t['total']}" if t["total"] else "" + print(f"{t['label']}: {t['value']}{of} {t['unit']}") + return 0 + + +if __name__ == "__main__": + try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode + sys.stdout.reconfigure(errors="replace") + except (AttributeError, ValueError, OSError): + pass + sys.exit(main()) diff --git a/tools/graphics_progress_data.json b/tools/graphics_progress_data.json new file mode 100644 index 0000000000..3a1ccf3a02 --- /dev/null +++ b/tools/graphics_progress_data.json @@ -0,0 +1,800 @@ +{ + "about": "Method names of the ID3D12 interfaces (Windows SDK d3d12.h) and the DXGI_FORMAT names (dxgiformat.h). Names only, no declarations or other SDK text. Regenerate with tools/graphics_progress.py --refresh-data --d3d12-header --dxgi-header .", + "d3d12": { + "ID3D12CommandAllocator": { + "base": "ID3D12Pageable", + "methods": [ + "Reset" + ] + }, + "ID3D12CommandList": { + "base": "ID3D12DeviceChild", + "methods": [ + "GetType" + ] + }, + "ID3D12CommandQueue": { + "base": "ID3D12Pageable", + "methods": [ + "UpdateTileMappings", + "CopyTileMappings", + "ExecuteCommandLists", + "SetMarker", + "BeginEvent", + "EndEvent", + "Signal", + "Wait", + "GetTimestampFrequency", + "GetClockCalibration", + "GetDesc" + ] + }, + "ID3D12CommandSignature": { + "base": "ID3D12Pageable", + "methods": [] + }, + "ID3D12DSRDeviceFactory": { + "base": "IUnknown", + "methods": [ + "CreateDSRDevice" + ] + }, + "ID3D12DescriptorHeap": { + "base": "ID3D12Pageable", + "methods": [ + "GetDesc", + "GetCPUDescriptorHandleForHeapStart", + "GetGPUDescriptorHandleForHeapStart" + ] + }, + "ID3D12Device": { + "base": "ID3D12Object", + "methods": [ + "GetNodeCount", + "CreateCommandQueue", + "CreateCommandAllocator", + "CreateGraphicsPipelineState", + "CreateComputePipelineState", + "CreateCommandList", + "CheckFeatureSupport", + "CreateDescriptorHeap", + "GetDescriptorHandleIncrementSize", + "CreateRootSignature", + "CreateConstantBufferView", + "CreateShaderResourceView", + "CreateUnorderedAccessView", + "CreateRenderTargetView", + "CreateDepthStencilView", + "CreateSampler", + "CopyDescriptors", + "CopyDescriptorsSimple", + "GetResourceAllocationInfo", + "GetCustomHeapProperties", + "CreateCommittedResource", + "CreateHeap", + "CreatePlacedResource", + "CreateReservedResource", + "CreateSharedHandle", + "OpenSharedHandle", + "OpenSharedHandleByName", + "MakeResident", + "Evict", + "CreateFence", + "GetDeviceRemovedReason", + "GetCopyableFootprints", + "CreateQueryHeap", + "SetStablePowerState", + "CreateCommandSignature", + "GetResourceTiling", + "GetAdapterLuid" + ] + }, + "ID3D12Device1": { + "base": "ID3D12Device", + "methods": [ + "CreatePipelineLibrary", + "SetEventOnMultipleFenceCompletion", + "SetResidencyPriority" + ] + }, + "ID3D12Device10": { + "base": "ID3D12Device9", + "methods": [ + "CreateCommittedResource3", + "CreatePlacedResource2", + "CreateReservedResource2" + ] + }, + "ID3D12Device11": { + "base": "ID3D12Device10", + "methods": [ + "CreateSampler2" + ] + }, + "ID3D12Device12": { + "base": "ID3D12Device11", + "methods": [ + "GetResourceAllocationInfo3" + ] + }, + "ID3D12Device13": { + "base": "ID3D12Device12", + "methods": [ + "OpenExistingHeapFromAddress1" + ] + }, + "ID3D12Device14": { + "base": "ID3D12Device13", + "methods": [ + "CreateRootSignatureFromSubobjectInLibrary" + ] + }, + "ID3D12Device2": { + "base": "ID3D12Device1", + "methods": [ + "CreatePipelineState" + ] + }, + "ID3D12Device3": { + "base": "ID3D12Device2", + "methods": [ + "OpenExistingHeapFromAddress", + "OpenExistingHeapFromFileMapping", + "EnqueueMakeResident" + ] + }, + "ID3D12Device4": { + "base": "ID3D12Device3", + "methods": [ + "CreateCommandList1", + "CreateProtectedResourceSession", + "CreateCommittedResource1", + "CreateHeap1", + "CreateReservedResource1", + "GetResourceAllocationInfo1" + ] + }, + "ID3D12Device5": { + "base": "ID3D12Device4", + "methods": [ + "CreateLifetimeTracker", + "RemoveDevice", + "EnumerateMetaCommands", + "EnumerateMetaCommandParameters", + "CreateMetaCommand", + "CreateStateObject", + "GetRaytracingAccelerationStructurePrebuildInfo", + "CheckDriverMatchingIdentifier" + ] + }, + "ID3D12Device6": { + "base": "ID3D12Device5", + "methods": [ + "SetBackgroundProcessingMode" + ] + }, + "ID3D12Device7": { + "base": "ID3D12Device6", + "methods": [ + "AddToStateObject", + "CreateProtectedResourceSession1" + ] + }, + "ID3D12Device8": { + "base": "ID3D12Device7", + "methods": [ + "GetResourceAllocationInfo2", + "CreateCommittedResource2", + "CreatePlacedResource1", + "CreateSamplerFeedbackUnorderedAccessView", + "GetCopyableFootprints1" + ] + }, + "ID3D12Device9": { + "base": "ID3D12Device8", + "methods": [ + "CreateShaderCacheSession", + "ShaderCacheControl", + "CreateCommandQueue1" + ] + }, + "ID3D12DeviceChild": { + "base": "ID3D12Object", + "methods": [ + "GetDevice" + ] + }, + "ID3D12DeviceConfiguration": { + "base": "IUnknown", + "methods": [ + "GetDesc", + "GetEnabledExperimentalFeatures", + "SerializeVersionedRootSignature", + "CreateVersionedRootSignatureDeserializer" + ] + }, + "ID3D12DeviceConfiguration1": { + "base": "ID3D12DeviceConfiguration", + "methods": [ + "CreateVersionedRootSignatureDeserializerFromSubobjectInLibrary" + ] + }, + "ID3D12DeviceFactory": { + "base": "IUnknown", + "methods": [ + "InitializeFromGlobalState", + "ApplyToGlobalState", + "SetFlags", + "GetFlags", + "GetConfigurationInterface", + "EnableExperimentalFeatures", + "CreateDevice" + ] + }, + "ID3D12DeviceRemovedExtendedData": { + "base": "IUnknown", + "methods": [ + "GetAutoBreadcrumbsOutput", + "GetPageFaultAllocationOutput" + ] + }, + "ID3D12DeviceRemovedExtendedData1": { + "base": "ID3D12DeviceRemovedExtendedData", + "methods": [ + "GetAutoBreadcrumbsOutput1", + "GetPageFaultAllocationOutput1" + ] + }, + "ID3D12DeviceRemovedExtendedData2": { + "base": "ID3D12DeviceRemovedExtendedData1", + "methods": [ + "GetPageFaultAllocationOutput2", + "GetDeviceState" + ] + }, + "ID3D12DeviceRemovedExtendedDataSettings": { + "base": "IUnknown", + "methods": [ + "SetAutoBreadcrumbsEnablement", + "SetPageFaultEnablement", + "SetWatsonDumpEnablement" + ] + }, + "ID3D12DeviceRemovedExtendedDataSettings1": { + "base": "ID3D12DeviceRemovedExtendedDataSettings", + "methods": [ + "SetBreadcrumbContextEnablement" + ] + }, + "ID3D12DeviceRemovedExtendedDataSettings2": { + "base": "ID3D12DeviceRemovedExtendedDataSettings1", + "methods": [ + "UseMarkersOnlyAutoBreadcrumbs" + ] + }, + "ID3D12DeviceTools": { + "base": "IUnknown", + "methods": [ + "SetNextAllocationAddress" + ] + }, + "ID3D12DeviceTools1": { + "base": "ID3D12DeviceTools", + "methods": [ + "GetApplicationSpecificDriverState", + "GetApplicationSpecificDriverBlobStatus" + ] + }, + "ID3D12Fence": { + "base": "ID3D12Pageable", + "methods": [ + "GetCompletedValue", + "SetEventOnCompletion", + "Signal" + ] + }, + "ID3D12Fence1": { + "base": "ID3D12Fence", + "methods": [ + "GetCreationFlags" + ] + }, + "ID3D12GBVDiagnostics": { + "base": "IUnknown", + "methods": [ + "GetGBVEntireSubresourceStatesData", + "GetGBVSubresourceState", + "GetGBVResourceUniformState", + "GetGBVResourceInfo", + "GBVReserved0", + "GBVReserved1" + ] + }, + "ID3D12GraphicsCommandList": { + "base": "ID3D12CommandList", + "methods": [ + "Close", + "Reset", + "ClearState", + "DrawInstanced", + "DrawIndexedInstanced", + "Dispatch", + "CopyBufferRegion", + "CopyTextureRegion", + "CopyResource", + "CopyTiles", + "ResolveSubresource", + "IASetPrimitiveTopology", + "RSSetViewports", + "RSSetScissorRects", + "OMSetBlendFactor", + "OMSetStencilRef", + "SetPipelineState", + "ResourceBarrier", + "ExecuteBundle", + "SetDescriptorHeaps", + "SetComputeRootSignature", + "SetGraphicsRootSignature", + "SetComputeRootDescriptorTable", + "SetGraphicsRootDescriptorTable", + "SetComputeRoot32BitConstant", + "SetGraphicsRoot32BitConstant", + "SetComputeRoot32BitConstants", + "SetGraphicsRoot32BitConstants", + "SetComputeRootConstantBufferView", + "SetGraphicsRootConstantBufferView", + "SetComputeRootShaderResourceView", + "SetGraphicsRootShaderResourceView", + "SetComputeRootUnorderedAccessView", + "SetGraphicsRootUnorderedAccessView", + "IASetIndexBuffer", + "IASetVertexBuffers", + "SOSetTargets", + "OMSetRenderTargets", + "ClearDepthStencilView", + "ClearRenderTargetView", + "ClearUnorderedAccessViewUint", + "ClearUnorderedAccessViewFloat", + "DiscardResource", + "BeginQuery", + "EndQuery", + "ResolveQueryData", + "SetPredication", + "SetMarker", + "BeginEvent", + "EndEvent", + "ExecuteIndirect" + ] + }, + "ID3D12GraphicsCommandList1": { + "base": "ID3D12GraphicsCommandList", + "methods": [ + "AtomicCopyBufferUINT", + "AtomicCopyBufferUINT64", + "OMSetDepthBounds", + "SetSamplePositions", + "ResolveSubresourceRegion", + "SetViewInstanceMask" + ] + }, + "ID3D12GraphicsCommandList10": { + "base": "ID3D12GraphicsCommandList9", + "methods": [ + "SetProgram", + "DispatchGraph" + ] + }, + "ID3D12GraphicsCommandList2": { + "base": "ID3D12GraphicsCommandList1", + "methods": [ + "WriteBufferImmediate" + ] + }, + "ID3D12GraphicsCommandList3": { + "base": "ID3D12GraphicsCommandList2", + "methods": [ + "SetProtectedResourceSession" + ] + }, + "ID3D12GraphicsCommandList4": { + "base": "ID3D12GraphicsCommandList3", + "methods": [ + "BeginRenderPass", + "EndRenderPass", + "InitializeMetaCommand", + "ExecuteMetaCommand", + "BuildRaytracingAccelerationStructure", + "EmitRaytracingAccelerationStructurePostbuildInfo", + "CopyRaytracingAccelerationStructure", + "SetPipelineState1", + "DispatchRays" + ] + }, + "ID3D12GraphicsCommandList5": { + "base": "ID3D12GraphicsCommandList4", + "methods": [ + "RSSetShadingRate", + "RSSetShadingRateImage" + ] + }, + "ID3D12GraphicsCommandList6": { + "base": "ID3D12GraphicsCommandList5", + "methods": [ + "DispatchMesh" + ] + }, + "ID3D12GraphicsCommandList7": { + "base": "ID3D12GraphicsCommandList6", + "methods": [ + "Barrier" + ] + }, + "ID3D12GraphicsCommandList8": { + "base": "ID3D12GraphicsCommandList7", + "methods": [ + "OMSetFrontAndBackStencilRef" + ] + }, + "ID3D12GraphicsCommandList9": { + "base": "ID3D12GraphicsCommandList8", + "methods": [ + "RSSetDepthBias", + "IASetIndexBufferStripCutValue" + ] + }, + "ID3D12Heap": { + "base": "ID3D12Pageable", + "methods": [ + "GetDesc" + ] + }, + "ID3D12Heap1": { + "base": "ID3D12Heap", + "methods": [ + "GetProtectedResourceSession" + ] + }, + "ID3D12LifetimeOwner": { + "base": "IUnknown", + "methods": [ + "LifetimeStateUpdated" + ] + }, + "ID3D12LifetimeTracker": { + "base": "ID3D12DeviceChild", + "methods": [ + "DestroyOwnedObject" + ] + }, + "ID3D12MetaCommand": { + "base": "ID3D12Pageable", + "methods": [ + "GetRequiredParameterResourceSize" + ] + }, + "ID3D12Object": { + "base": "IUnknown", + "methods": [ + "GetPrivateData", + "SetPrivateData", + "SetPrivateDataInterface", + "SetName" + ] + }, + "ID3D12Pageable": { + "base": "ID3D12DeviceChild", + "methods": [] + }, + "ID3D12PageableTools": { + "base": "IUnknown", + "methods": [ + "GetAllocation" + ] + }, + "ID3D12PipelineLibrary": { + "base": "ID3D12DeviceChild", + "methods": [ + "StorePipeline", + "LoadGraphicsPipeline", + "LoadComputePipeline", + "GetSerializedSize", + "Serialize" + ] + }, + "ID3D12PipelineLibrary1": { + "base": "ID3D12PipelineLibrary", + "methods": [ + "LoadPipeline" + ] + }, + "ID3D12PipelineState": { + "base": "ID3D12Pageable", + "methods": [ + "GetCachedBlob" + ] + }, + "ID3D12ProtectedResourceSession": { + "base": "ID3D12ProtectedSession", + "methods": [ + "GetDesc" + ] + }, + "ID3D12ProtectedResourceSession1": { + "base": "ID3D12ProtectedResourceSession", + "methods": [ + "GetDesc1" + ] + }, + "ID3D12ProtectedSession": { + "base": "ID3D12DeviceChild", + "methods": [ + "GetStatusFence", + "GetSessionStatus" + ] + }, + "ID3D12QueryHeap": { + "base": "ID3D12Pageable", + "methods": [] + }, + "ID3D12Resource": { + "base": "ID3D12Pageable", + "methods": [ + "Map", + "Unmap", + "GetDesc", + "GetGPUVirtualAddress", + "WriteToSubresource", + "ReadFromSubresource", + "GetHeapProperties" + ] + }, + "ID3D12Resource1": { + "base": "ID3D12Resource", + "methods": [ + "GetProtectedResourceSession" + ] + }, + "ID3D12Resource2": { + "base": "ID3D12Resource1", + "methods": [ + "GetDesc1" + ] + }, + "ID3D12RootSignature": { + "base": "ID3D12DeviceChild", + "methods": [] + }, + "ID3D12RootSignatureDeserializer": { + "base": "IUnknown", + "methods": [ + "GetRootSignatureDesc" + ] + }, + "ID3D12SDKConfiguration": { + "base": "IUnknown", + "methods": [ + "SetSDKVersion" + ] + }, + "ID3D12SDKConfiguration1": { + "base": "ID3D12SDKConfiguration", + "methods": [ + "CreateDeviceFactory", + "FreeUnusedSDKs" + ] + }, + "ID3D12ShaderCacheSession": { + "base": "ID3D12DeviceChild", + "methods": [ + "FindValue", + "StoreValue", + "SetDeleteOnDestroy", + "GetDesc" + ] + }, + "ID3D12StateObject": { + "base": "ID3D12Pageable", + "methods": [] + }, + "ID3D12StateObjectProperties": { + "base": "IUnknown", + "methods": [ + "GetShaderIdentifier", + "GetShaderStackSize", + "GetPipelineStackSize", + "SetPipelineStackSize" + ] + }, + "ID3D12StateObjectProperties1": { + "base": "ID3D12StateObjectProperties", + "methods": [ + "GetProgramIdentifier" + ] + }, + "ID3D12SwapChainAssistant": { + "base": "IUnknown", + "methods": [ + "GetLUID", + "GetSwapChainObject", + "GetCurrentResourceAndCommandQueue", + "InsertImplicitSync" + ] + }, + "ID3D12Tools": { + "base": "IUnknown", + "methods": [ + "EnableShaderInstrumentation", + "ShaderInstrumentationEnabled" + ] + }, + "ID3D12Tools1": { + "base": "ID3D12Tools", + "methods": [ + "ReserveGPUVARangesAtCreate", + "ClearReservedGPUVARangesList" + ] + }, + "ID3D12Tools2": { + "base": "ID3D12Tools1", + "methods": [ + "SetApplicationSpecificDriverState" + ] + }, + "ID3D12VersionedRootSignatureDeserializer": { + "base": "IUnknown", + "methods": [ + "GetRootSignatureDescAtVersion", + "GetUnconvertedRootSignatureDesc" + ] + }, + "ID3D12VirtualizationGuestDevice": { + "base": "IUnknown", + "methods": [ + "ShareWithHost", + "CreateFenceFd" + ] + }, + "ID3D12WorkGraphProperties": { + "base": "IUnknown", + "methods": [ + "GetNumWorkGraphs", + "GetProgramName", + "GetWorkGraphIndex", + "GetNumNodes", + "GetNodeID", + "GetNodeIndex", + "GetNodeLocalRootArgumentsTableIndex", + "GetNumEntrypoints", + "GetEntrypointID", + "GetEntrypointIndex", + "GetEntrypointRecordSizeInBytes", + "GetWorkGraphMemoryRequirements", + "GetEntrypointRecordAlignmentInBytes" + ] + } + }, + "dxgi_formats": [ + "R32G32B32A32_TYPELESS", + "R32G32B32A32_FLOAT", + "R32G32B32A32_UINT", + "R32G32B32A32_SINT", + "R32G32B32_TYPELESS", + "R32G32B32_FLOAT", + "R32G32B32_UINT", + "R32G32B32_SINT", + "R16G16B16A16_TYPELESS", + "R16G16B16A16_FLOAT", + "R16G16B16A16_UNORM", + "R16G16B16A16_UINT", + "R16G16B16A16_SNORM", + "R16G16B16A16_SINT", + "R32G32_TYPELESS", + "R32G32_FLOAT", + "R32G32_UINT", + "R32G32_SINT", + "R32G8X24_TYPELESS", + "D32_FLOAT_S8X24_UINT", + "R32_FLOAT_X8X24_TYPELESS", + "X32_TYPELESS_G8X24_UINT", + "R10G10B10A2_TYPELESS", + "R10G10B10A2_UNORM", + "R10G10B10A2_UINT", + "R11G11B10_FLOAT", + "R8G8B8A8_TYPELESS", + "R8G8B8A8_UNORM", + "R8G8B8A8_UNORM_SRGB", + "R8G8B8A8_UINT", + "R8G8B8A8_SNORM", + "R8G8B8A8_SINT", + "R16G16_TYPELESS", + "R16G16_FLOAT", + "R16G16_UNORM", + "R16G16_UINT", + "R16G16_SNORM", + "R16G16_SINT", + "R32_TYPELESS", + "D32_FLOAT", + "R32_FLOAT", + "R32_UINT", + "R32_SINT", + "R24G8_TYPELESS", + "D24_UNORM_S8_UINT", + "R24_UNORM_X8_TYPELESS", + "X24_TYPELESS_G8_UINT", + "R8G8_TYPELESS", + "R8G8_UNORM", + "R8G8_UINT", + "R8G8_SNORM", + "R8G8_SINT", + "R16_TYPELESS", + "R16_FLOAT", + "D16_UNORM", + "R16_UNORM", + "R16_UINT", + "R16_SNORM", + "R16_SINT", + "R8_TYPELESS", + "R8_UNORM", + "R8_UINT", + "R8_SNORM", + "R8_SINT", + "A8_UNORM", + "R1_UNORM", + "R9G9B9E5_SHAREDEXP", + "R8G8_B8G8_UNORM", + "G8R8_G8B8_UNORM", + "BC1_TYPELESS", + "BC1_UNORM", + "BC1_UNORM_SRGB", + "BC2_TYPELESS", + "BC2_UNORM", + "BC2_UNORM_SRGB", + "BC3_TYPELESS", + "BC3_UNORM", + "BC3_UNORM_SRGB", + "BC4_TYPELESS", + "BC4_UNORM", + "BC4_SNORM", + "BC5_TYPELESS", + "BC5_UNORM", + "BC5_SNORM", + "B5G6R5_UNORM", + "B5G5R5A1_UNORM", + "B8G8R8A8_UNORM", + "B8G8R8X8_UNORM", + "R10G10B10_XR_BIAS_A2_UNORM", + "B8G8R8A8_TYPELESS", + "B8G8R8A8_UNORM_SRGB", + "B8G8R8X8_TYPELESS", + "B8G8R8X8_UNORM_SRGB", + "BC6H_TYPELESS", + "BC6H_UF16", + "BC6H_SF16", + "BC7_TYPELESS", + "BC7_UNORM", + "BC7_UNORM_SRGB", + "AYUV", + "Y410", + "Y416", + "NV12", + "P010", + "P016", + "420_OPAQUE", + "YUY2", + "Y210", + "Y216", + "NV11", + "AI44", + "IA44", + "P8", + "A8P8", + "B4G4R4A4_UNORM", + "P208", + "V208", + "V408", + "SAMPLER_FEEDBACK_MIN_MIP_OPAQUE", + "SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE", + "A4B4G4R4_UNORM" + ], + "source": "Windows SDK 10.0.26100.0 (d3d12.h, dxgiformat.h)" +}