{"id":13728405,"url":"https://github.com/HansKristian-Work/vkd3d-proton","last_synced_at":"2025-05-08T00:31:43.279Z","repository":{"id":36952340,"uuid":"209527239","full_name":"HansKristian-Work/vkd3d-proton","owner":"HansKristian-Work","description":"Fork of VKD3D. Development branches for Proton's Direct3D 12 implementation.","archived":false,"fork":false,"pushed_at":"2024-10-28T15:49:12.000Z","size":42719,"stargazers_count":1892,"open_issues_count":176,"forks_count":198,"subscribers_count":67,"default_branch":"master","last_synced_at":"2024-10-29T15:35:08.711Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HansKristian-Work.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-19T10:37:39.000Z","updated_at":"2024-10-29T13:26:09.000Z","dependencies_parsed_at":"2023-10-30T13:24:47.263Z","dependency_job_id":"7caf0559-fecd-4c91-bd26-013a66b3613b","html_url":"https://github.com/HansKristian-Work/vkd3d-proton","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HansKristian-Work%2Fvkd3d-proton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HansKristian-Work%2Fvkd3d-proton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HansKristian-Work%2Fvkd3d-proton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HansKristian-Work%2Fvkd3d-proton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HansKristian-Work","download_url":"https://codeload.github.com/HansKristian-Work/vkd3d-proton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224148749,"owners_count":17264071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T02:00:41.979Z","updated_at":"2024-11-14T19:31:08.703Z","avatar_url":"https://github.com/HansKristian-Work.png","language":"C","funding_links":[],"categories":["DirectX Tools, Libraries, and Frameworks","WINE","C","Vulkan Tools, Libraries, and Frameworks"],"sub_categories":["VS Code Extensions for Developer Productivity","WINE implementations","Enable Proton in Steam"],"readme":"# vkd3d-proton\n\nvkd3d-proton is a fork of VKD3D, which aims to implement the full Direct3D 12 API on top of Vulkan.\nThe project serves as the development effort for Direct3D 12 support in [Proton](https://github.com/ValveSoftware/Proton).\n\n## Upstream\n\nThe original project is available at [WineHQ](https://gitlab.winehq.org/wine/vkd3d).\n\n## Priorities\n\nPerformance and game compatibility are important targets, at the expense of compatibility with older drivers and systems.\nModern Vulkan extensions and features are aggressively made use of to improve game performance and compatibility.\nIt is recommended to use the very latest drivers you can get your hands on for the best experience.\nBackwards compatibility with the vkd3d standalone API is not a goal of this project.\n\n## Drivers\n\nThere are some hard requirements on drivers to be able to implement D3D12 in a reasonably performant way.\n\n- Vulkan 1.3\n- Descriptor indexing with at least 1000000 UpdateAfterBind descriptors for all types except UniformBuffer.\n  Essentially all features in `VkPhysicalDeviceDescriptorIndexingFeatures` must be supported.\n- Further, the following device features are required:\n  - `samplerMirrorClampToEdge`\n  - `shaderDrawParameters`\n- `VK_EXT_robustness2`\n- `VK_KHR_push_descriptor`\n\nSome notable extensions that **should** be supported for optimal or correct behavior.\nThese extensions will likely become mandatory later.\n\n- `VK_EXT_image_view_min_lod`\n\n`VK_EXT_mutable_descriptor_type` (or the vendor `VALVE` alias) and `VK_EXT_descriptor_buffer` are also highly recommended, but not mandatory.\n\n### AMD (RADV)\n\nFor AMD, RADV is the recommended driver and the one that sees most testing on AMD GPUs.\nThe minimum requirement at the moment is Mesa 22.0.\n\nNOTE: For older Mesa versions, use the v2.6 release.\n\n### NVIDIA\n\nThe [Vulkan beta drivers](https://developer.nvidia.com/vulkan-driver) generally contain the latest\ndriver fixes that we identify while getting games to work.\nThe latest drivers (stable, beta or Vulkan beta tracks) are always preferred.\nIf you're having problems, always try the latest drivers.\nAt minimum, 535 series drivers are needed, which fixes a bunch of bugs.\n\n### Intel\n\nWe have not done any testing against Intel GPUs yet.\n\n------\n\n## Cloning the repo\n\nTo clone the repo you should run:\n```\ngit clone --recursive https://github.com/HansKristian-Work/vkd3d-proton\n```\nin order to pull in all the submodules which are needed for building.\n\n## Building vkd3d-proton\n\n### Requirements:\n- [wine](https://www.winehq.org/) (for `widl`) [for native builds]\n  - On Windows this may be substituted for [Strawberry Perl](http://strawberryperl.com/) as it ships `widl` and is easy to find and install -- although this dependency may be eliminated in the future.\n- [Meson](http://mesonbuild.com/) build system (at least version 0.49)\n- [glslang](https://github.com/KhronosGroup/glslang) compiler\n- [Mingw-w64](http://mingw-w64.org/) compiler, headers and tools (at least version 7.0) [for cross-builds for d3d12.dll which are default]\n\n### Building:\n#### The simple way\nInside the vkd3d-proton directory, run:\n```\n./package-release.sh master /your/target/directory --no-package\n```\n\nThis will create a folder `vkd3d-master` in `/your/target/directory`, which contains both 32-bit and 64-bit versions of vkd3d-proton, which can be set up in the same way as the release versions as noted above.\n\nIf you want to build natively (ie. for `libvkd3d-proton.so`), pass `--native` to the build script. This option will make it build using your system's compilers.\n\nIn order to preserve the build directories for development, pass `--dev-build` to the script. This option implies `--no-package`. After making changes to the source code, you can then do the following to rebuild vkd3d-proton:\n```\n# change to build.86 for 32-bit\nninja -C /your/target/directory/build.64 install\n```\n\n#### Compiling manually (cross for d3d12.dll, default)\n```\n# 64-bit build.\nmeson --cross-file build-win64.txt --buildtype release --prefix /your/vkd3d-proton/directory build.64\nninja -C build.64 install\n\n# 32-bit build\nmeson --cross-file build-win32.txt --buildtype release --prefix /your/vkd3d-proton/directory build.86\nninja -C build.86 install\n```\n\n#### Compiling manually (native)\n```\n# 64-bit build.\nmeson --buildtype release --prefix /your/vkd3d-proton/directory build.64\nninja -C build.64 install\n\n# 32-bit build\nCC=\"gcc -m32\" CXX=\"g++ -m32\" \\\nPKG_CONFIG_PATH=\"/usr/lib32/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig\" \\\nmeson --buildtype release --prefix /your/vkd3d-proton/directory build.86\nninja -C build.86 install\n```\n\n## Using vkd3d-proton\n\nThe intended way to use vkd3d-proton is as native Win32 DLLs (d3d12.dll and d3d12core.dll).\nThese serve as a drop-in replacement for D3D12, and can be used in Wine (Proton or vanilla flavors), or on Windows.\n\nvkd3d-proton does not supply the necessary DXGI components on its own.\nInstead, DXVK (2.1+) and vkd3d-proton share a DXGI implementation.\n\n### A note on using vkd3d-proton on Windows\n\nNative Windows use is mostly relevant for developer testing purposes.\nDo not expect games running on Windows 7 or 8.1 to magically make use of vkd3d-proton,\nas many games will only even attempt to load d3d12.dll if they are running on Windows 10.\n\n### Native Linux build\n\nA native Linux binary can be built, but it is not intended to be compatible with upstream Wine.\nA native option is mostly relevant for development purposes for the time being.\n\n## Environment variables\n\nMost of the environment variables used by vkd3d-proton are for debugging purposes. The\nenvironment variables are not considered a part of API and might be changed or\nremoved in the future versions of vkd3d-proton.\n\nSome of debug variables are lists of elements. Elements must be separated by\ncommas or semicolons.\n\n - `VKD3D_CONFIG` - a list of options that change the behavior of vkd3d-proton.\n    - `vk_debug` - enables Vulkan debug extensions and loads validation layer.\n    - `skip_application_workarounds` - Skips all application workarounds.\n      For debugging purposes.\n    - `nodxr` - Disables DXR support.\n    - `dxr` - DXR is normally enabled automatically. This config forces it to be enabled even when considered unsafe.\n    - `force_static_cbv` - Unsafe speed hack on NVIDIA. May or may not give a significant performance uplift.\n    - `single_queue` - Do not use asynchronous compute or transfer queues.\n    - `no_upload_hvv` - Blocks any attempt to use host-visible VRAM (large/resizable BAR) for the UPLOAD heap.\n      May free up vital VRAM in certain critical situations, at cost of lower GPU performance.\n      A fraction of VRAM is reserved for resizable BAR allocations either way,\n      so it should not be a real issue even on lower VRAM cards.\n    - `force_host_cached` - Forces all host visible allocations to be CACHED, which greatly accelerates captures.\n    - `no_invariant_position` - Avoids workarounds for invariant position. The workaround is enabled by default.\n - `VKD3D_DEBUG` - controls the debug level for log messages produced by\n   vkd3d-proton. Accepts the following values: none, err, info, fixme, warn, trace.\n - `VKD3D_SHADER_DEBUG` - controls the debug level for log messages produced by\n   the shader compilers. See `VKD3D_DEBUG` for accepted values.\n - `VKD3D_LOG_FILE` - If set, redirects `VKD3D_DEBUG` logging output to a file instead.\n - `VKD3D_VULKAN_DEVICE` - a zero-based device index. Use to force the selected\n   Vulkan device.\n - `VKD3D_FILTER_DEVICE_NAME` - skips devices that don't include this substring.\n - `VKD3D_DISABLE_EXTENSIONS` - a list of Vulkan extensions that vkd3d-proton should\n   not use even if available.\n - `VKD3D_TEST_DEBUG` - enables additional debug messages in tests. Set to 0, 1\n   or 2.\n - `VKD3D_TEST_MATCH` - a match string. Only the tests whose names exactly match the\n   string will be run, e.g. `VKD3D_TEST_FILTER=clear_render_target` will only match\n   tests named 'clear_render_target'.\n   Useful for debugging or developing new tests.\n - `VKD3D_TEST_FILTER` - a filter string. Only the tests whose names matches the\n   filter string will be run, e.g. `VKD3D_TEST_FILTER=clear_render` will match\n   tests named 'clear_render_target' or 'target_clear_render'.\n   Useful for debugging or developing new tests.\n - `VKD3D_TEST_EXCLUDE` - excludes tests of which the name is included in the string,\n   e.g. `VKD3D_TEST_EXCLUDE=test_root_signature_priority,test_conservative_rasterization_dxil`.\n - `VKD3D_TEST_PLATFORM` - can be set to \"wine\", \"windows\" or \"other\". The test\n   platform controls the behavior of todo(), todo_if(), bug_if() and broken()\n   conditions in tests.\n - `VKD3D_TEST_BUG` - set to 0 to disable bug_if() conditions in tests.\n - `VKD3D_PROFILE_PATH` - If profiling is enabled in the build, a profiling block is\n   emitted to `${VKD3D_PROFILE_PATH}.${pid}`.\n\n### Frame rate limit\nThe `VKD3D_FRAME_RATE` environment variable can be used to limit the frame rate. A value of `0` uncaps the frame rate, while any positive value will limit rendering to the given number of frames per second.\n\nThe `DXVK_FRAME_RATE` environment variable is also detected on VKD3D-Proton, so you may prefer to use that instead of having to remember two separate variables that do the same thing. `VKD3D_FRAME_RATE`, however, only applies to VKD3D (Direct3D 12) scenarios. If both variables are used, `VKD3D_FRAME_RATE` takes precedence.\n\n## Shader cache\n\nBy default, vkd3d-proton manages its own driver cache.\nThis cache is intended to cache DXBC/DXIL -\u003e SPIR-V conversion.\nThis reduces stutter (when pipelines are created last minute and app relies on hot driver cache)\nand load times (when applications do the right thing of loading PSOs up front).\n\nBehavior is designed to be close to DXVK state cache.\n\n#### Default behavior\n\n`vkd3d-proton.cache` (and `vkd3d-proton.cache.write`) are placed in the current working directory.\nGenerally, this is the game install folder when running in Steam.\n\n#### Custom directory\n\n`VKD3D_SHADER_CACHE_PATH=/path/to/directory` overrides the directory where `vkd3d-proton.cache` is placed.\n\n#### Disable cache\n\n`VKD3D_SHADER_CACHE_PATH=0` disables the internal cache, and any caching would have to be explicitly managed\nby application.\n\n### Behavior of ID3D12PipelineLibrary\n\nWhen explicit shader cache is used, the need for application managed pipeline libraries is greatly diminished,\nand the cache applications interact with is a dummy cache.\nIf the vkd3d-proton shader cache is disabled, ID3D12PipelineLibrary stores everything relevant for a full cache,\ni.e. SPIR-V and PSO driver cache blob.\n`VKD3D_CONFIG=pipeline_library_app_cache` is an alternative to `VKD3D_SHADER_CACHE_PATH=0` and can be\nautomatically enabled based on app-profiles if relevant in the future if applications manage the caches better\nthan vkd3d-proton can do automagically.\n\n## CPU profiling (development)\n\nPass `-Denable_profiling=true` to Meson to enable a profiled build. With a profiled build, use `VKD3D_PROFILE_PATH` environment variable.\nThe profiling dumps out a binary blob which can be analyzed with `programs/vkd3d-profile.py`.\nThe profile is a trivial system which records number of iterations and total ticks (ns) spent.\nIt is easy to instrument parts of code you are working on optimizing.\n\n## Advanced shader debugging\n\nThese features are only meant to be used by vkd3d-proton developers. For any builtin RenderDoc related functionality\npass `-Denable_renderdoc=true` to Meson.\n\n - `VKD3D_SHADER_DUMP_PATH` - path where shader bytecode is dumped.\n   Bytecode is dumped in format of `$hash.{spv,dxbc,dxil}`.\n - `VKD3D_SHADER_OVERRIDE` - path to where overridden shaders can be found.\n   If application is creating a pipeline with `$hash` and `$VKD3D_SHADER_OVERRIDE/$hash.spv` exists,\n   that SPIR-V file will be used instead.\n - `VKD3D_AUTO_CAPTURE_SHADER` - If this is set to a shader hash, and the RenderDoc layer is enabled,\n vkd3d-proton will automatically make a capture when a specific shader is encountered.\n - `VKD3D_AUTO_CAPTURE_COUNTS` - A comma-separated list of indices. This can be used to control which queue submissions to capture.\n E.g., use `VKD3D_AUTO_CAPTURE_COUNTS=0,4,10` to capture the 0th (first submission), 4th and 10th submissions which are candidates for capturing.\n If `VKD3D_AUTO_CAPTURE_COUNTS` is `-1`, the entire app runtime can be turned into one big capture.\n This is only intended to be used when capturing something like the test suite,\n or tiny applications with a finite runtime to make it easier to debug cross submission work.\n\n If only `VKD3D_AUTO_CAPTURE_COUNTS` is set, any queue submission is considered for capturing.\n If only `VKD3D_AUTO_CAPTURE_SHADER` is set, `VKD3D_AUTO_CAPTURE_COUNTS` is considered to be equal to `\"0\"`, i.e. a capture is only\n made on first encounter with the target shader.\n If both are set, the capture counter is only incremented and considered when a submission contains the use of the target shader.\n\n### Breadcrumbs debugging\n\nFor debugging GPU hangs, it's useful to know where crashes happen.\nIf the build has trace enabled (non-release builds), breadcrumbs support is also enabled.\n\n`VKD3D_CONFIG=breadcrumbs` will instrument command lists with `VK_AMD_buffer_marker` or `VK_NV_device_checkpoints`.\nOn GPU device lost or timeout, crash dumps are written to the log.\nFor best results on RADV, use `RADV_DEBUG=syncshaders`. The logs will print a digested form of the command lists\nwhich were executing at the time, and attempt to narrow down the possible range of commands which could\nhave caused a crash.\n\n### Shader logging\n\nIt is possible to log the output of replaced shaders, essentially a custom shader printf. To enable this feature, `VK_KHR_buffer_device_address` must be supported.\nFirst, use `VKD3D_SHADER_DEBUG_RING_SIZE_LOG2=28` for example to set up a 256 MiB ring buffer in host memory.\nSince this buffer is allocated in host memory, feel free to make it as large as you want, as it does not consume VRAM.\nA worker thread will read the data as it comes in and log it. There is potential here to emit more structured information later.\nThe main reason this is implemented instead of the validation layer printf system is run-time performance,\nand avoids any possible accidental hiding of bugs by introducing validation layers which add locking, etc.\nUsing `debugPrintEXT` is also possible if that fits better with your debugging scenario.\nWith this shader replacement scheme, we're able to add shader logging as unintrusive as possible.\n\n```\n# Inside folder full of override shaders, build everything with:\nmake -C /path/to/include/shader-debug M=$PWD\n```\nThe shader can then include `#include \"debug_channel.h\"` and use various functions below.\n\n```\nvoid DEBUG_CHANNEL_INIT(uvec3 ID);\n```\n\nis used somewhere in your replaced shader. This should be initialized with `gl_GlobalInvocationID` or similar.\nThis ID will show up in the log. For each subgroup which calls `DEBUG_CHANNEL_INIT`, an instance counter is generated.\nThis allows you to correlate several messages which all originate from the same instance counter, which is logged alongside the ID.\nAn invocation can be uniquely identified with the instance + `DEBUG_CHANNEL_INIT` id.\n`DEBUG_CHANNEL_INIT` can be called from non-uniform control flow, as it does not use `barrier()` or similar constructs.\nIt can also be used in vertex and fragment shaders for this reason.\n\n```\nvoid DEBUG_CHANNEL_MSG();\nvoid DEBUG_CHANNEL_MSG(uint v0);\nvoid DEBUG_CHANNEL_MSG(uint v0, uint v1, ...); // Up to 4 components, can be expanded as needed up to 16.\nvoid DEBUG_CHANNEL_MSG(int v0);\nvoid DEBUG_CHANNEL_MSG(int v0, int v1, ...); // Up to 4 components, ...\nvoid DEBUG_CHANNEL_MSG(float v0);\nvoid DEBUG_CHANNEL_MSG(float v0, float v1, ...); // Up to 4 components, ...\n```\n\nThese functions log, formatting is `#%x` for uint, `%d` for int and `%f` for float type.\n\n## Descriptor debugging\n\nIf `-Denable_descriptor_qa=true` is enabled in build, you can set the `VKD3D_DESCRIPTOR_QA_LOG` env-var to a file.\nAll descriptor updates and copies are logged so that it's possible to correlate descriptors with\nGPU crash dumps. `enable_descriptor_qa` is not enabled by default,\nsince it adds some flat overhead in an extremely hot code path.\n\n### GPU-assisted debugging\n\nIf `VKD3D_CONFIG=descriptor_qa_checks` is set with a build which enables `-Denable_descriptor_qa=true`,\nall shaders will be instrumented to check for invalid access. In the log, you will see this to\nmake sure the feature is enabled.\n\n```\n932:info:vkd3d_descriptor_debug_init_once: Enabling descriptor QA checks!\n```\n\nThe main motivation is the tight integration and high performance.\nGPU-assisted debugging can be run at well over playable speeds.\n\n#### Descriptor heap index out of bounds\n\n```\n============\nFault type: HEAP_OUT_OF_RANGE\nFault type: MISMATCH_DESCRIPTOR_TYPE\nCBV_SRV_UAV heap cookie: 1800\nShader hash and instruction: edbaf1b5ed344467 (1)\nAccessed resource/view cookie: 0\nShader desired descriptor type: 8 (STORAGE_BUFFER)\nFound descriptor type in heap: 0 (NONE)\nFailed heap index: 1024000\n==========\n```\n\nThe instruction `(1)`, is reported as well,\nand a disassembly of the shader in question can be used to pinpoint exactly where\nthings are going wrong.\nDump all shaders with `VKD3D_SHADER_DUMP_PATH=/my/folder`,\nand run `spirv-cross -V /my/folder/edbaf1b5ed344467.spv`.\n(NOTE: clear out the folder before dumping, existing files are not overwritten).\nThe faulting instruction can be identified by looking at last argument, e.g.:\n\n```\nuint fixup_index = descriptor_qa_check(heap_index, descriptor_type, 1u /* instruction ID */);\n```\n\n#### Mismatch descriptor type\n\n```\n============\nFault type: MISMATCH_DESCRIPTOR_TYPE\nCBV_SRV_UAV heap cookie: 1800 // Refer to VKD3D_DESCRIPTOR_QA_LOG\nShader hash and instruction: edbaf1b5ed344467 (1)\nAccessed resource/view cookie: 1802 // Refer to VKD3D_DESCRIPTOR_QA_LOG\nShader desired descriptor type: 8 (STORAGE_BUFFER)\nFound descriptor type in heap: 1 (SAMPLED_IMAGE)\nFailed heap index: 1025\n==========\n```\n\n#### Accessing destroyed resource\n\n```\n============\nFault type: DESTROYED_RESOURCE\nCBV_SRV_UAV heap cookie: 1800\nShader hash and instruction: edbaf1b5ed344467 (2)\nAccessed resource/view cookie: 1806\nShader desired descriptor type: 1 (SAMPLED_IMAGE)\nFound descriptor type in heap: 1 (SAMPLED_IMAGE)\nFailed heap index: 1029\n==========\n```\n\n### Debugging descriptor crashes with RADV dumps (hardcore ultra nightmare mode)\n\nFor when you're absolutely desperate, there is a way to debug GPU hangs.\nFirst, install [umr](https://gitlab.freedesktop.org/tomstdenis/umr) and make the binary setsuid.\n\n`ACO_DEBUG=force-waitcnt RADV_DEBUG=hang VKD3D_DESCRIPTOR_QA_LOG=/somewhere/desc.txt %command%`\n\nIt is possible to use `RADV_DEBUG=hang,umr` as well, but from within Wine, there are weird things\nhappening where UMR dumps do not always succeed.\nInstead, it is possible to invoke umr manually from an SSH shell when the GPU hangs.\n\n```\n#!/bin/bash\n\nmkdir -p \"$HOME/umr-dump\"\n\n# For Navi, older GPUs might have different rings. See RADV source.\numr -R gfx_0.0.0 \u003e \"$HOME/umr-dump/ring.txt\" 2\u003e\u00261\numr -O halt_waves -wa gfx_0.0.0 \u003e \"$HOME/umr-dump/halt-waves-1.txt\" 2\u003e\u00261\numr -O bits,halt_waves -wa gfx_0.0.0 \u003e \"$HOME/umr-dump/halt-waves-2.txt\" 2\u003e\u00261\n```\n\nA folder is placed in `~/radv_dumps*` by RADV, and the UMR script will place wave dumps in `~/umr-dump`.\n\nFirst, we can study the wave dumps to see where things crash, e.g.:\n\n```\n    pgm[6@0x800120e26c00 + 0x584 ] = 0xf0001108\t\timage_load v47, v[4:5], s[48:55] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm\n    pgm[6@0x800120e26c00 + 0x588 ] = 0x000c2f04\t;;\n    pgm[6@0x800120e26c00 + 0x58c ] = 0xbf8c3f70\t\ts_waitcnt vmcnt(0)\n *  pgm[6@0x800120e26c00 + 0x590 ] = 0x930118c0\t\ts_mul_i32 s1, 64, s24\n    pgm[6@0x800120e26c00 + 0x594 ] = 0xf40c0c09\t\ts_load_dwordx8 s[48:55], s[18:19], s1\n    pgm[6@0x800120e26c00 + 0x598 ] = 0x02000000\t;;\n```\n\nexcp: 256 is a memory error (at least on 5700xt).\n```\nTRAPSTS[50000100]:\n\t                excp:      256 |         illegal_inst:        0 |           buffer_oob:        0 |           excp_cycle:        0 |\n\t       excp_wave64hi:        0 |          xnack_error:        1 |              dp_rate:        2 |      excp_group_mask:        0 |\n```\n\nWe can inspect all VGPRs and all SGPRs, here for the image descriptor.\n\n```\n    [  48..  51] = { 0130a000, c0500080, 810dc1df, 93b00204 }\n    [  52..  55] = { 00000000, 00400000, 002b0000, 800130c8 }\n```\n\nDecode the VA and study `bo_history.log`. There is a script in RADV which lets you query history for a VA.\nThis lets us verify that the VA in question was freed at some point.\nAt point of writing, there is no easy way to decode raw descriptor blobs, but when you're desperate enough you can do it by hand :|\n\nIn `pipeline.log` we have the full SPIR-V (with OpSource reference to the source DXIL/DXBC)\nand disassembly of the crashed pipeline. Here we can study the code to figure out which descriptor was read.\n\n```\n    // s7 is the descriptor heap index, s1 is the offset (64 bytes per image descriptor),\n    // s[18:19] is the descriptor heap.\n    s_mul_i32 s1, 64, s7                                        ; 930107c0\n    s_load_dwordx8 s[48:55], s[18:19], s1                       ; f40c0c09 02000000\n    s_waitcnt lgkmcnt(0)                                        ; bf8cc07f\n    image_load v47, v[4:5], s[48:55] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm ; f0001108 000c2f04\n```\n\n```\n    [   4..   7] = { 03200020, ffff8000, 0000002b, 00000103 }\n```\n\nWhich is descriptor index #259. Based on this, we can inspect the descriptor QA log and verify that the application\ndid indeed do something invalid, which caused the GPU hang.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHansKristian-Work%2Fvkd3d-proton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHansKristian-Work%2Fvkd3d-proton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHansKristian-Work%2Fvkd3d-proton/lists"}