diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 15:13:48 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 15:13:48 -0500 |
| commit | 23b2e0e81d07cb67604178d770dd34dd272fdf4e (patch) | |
| tree | 87a6a1f4ea86e1bedd07bf86251af44e86017d33 /docs | |
| parent | 073bf19892323d909e9a4355b3a27adacf2b54a8 (diff) | |
| parent | bbcbe09371ffa1550e941e4ffd43e7ac020162f1 (diff) | |
Merge pull request #2983 from TheHoracio
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/d3d12_vulkan.md | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md index 373e2313d..3c9e894b3 100644 --- a/docs/d3d12_vulkan.md +++ b/docs/d3d12_vulkan.md | |||
| @@ -850,9 +850,40 @@ and any validation error fails them. | |||
| 850 | from `decode(T#)`. `check.py`'s `SAMPLER_CASES` cover a point mip filter, MAX_LOD 0, MIN_LOD 1, LOD_BIAS ±1, | 850 | from `decode(T#)`. `check.py`'s `SAMPLER_CASES` cover a point mip filter, MAX_LOD 0, MIN_LOD 1, LOD_BIAS ±1, |
| 851 | MIP_FILTER_NONE with and without MIN_LOD, and a T# whose BASE_LEVEL is 1. Each pixel is judged against levels | 851 | MIP_FILTER_NONE with and without MIN_LOD, and a T# whose BASE_LEVEL is 1. Each pixel is judged against levels |
| 852 | worked out from the S# and T# bits in Python, independently of the header. On Vulkan, the sampler's minLod and | 852 | worked out from the S# and T# bits in Python, independently of the header. On Vulkan, the sampler's minLod and |
| 853 | mipLodBias apply to an explicit LOD as well. That this matches the console for `image_sample_lz` and | 853 | mipLodBias apply to an explicit LOD as well. The T#'s MIN_LOD (D3D12's ResourceMinLODClamp) is not covered by |
| 854 | `image_sample_l` is taken from radv, which writes these Vulkan fields straight into the S#; it was not measured | 854 | this test. |
| 855 | on RDNA2 here. The T#'s MIN_LOD (D3D12's ResourceMinLODClamp) is not covered by this test. | 855 | - **Measured on RDNA2** (SHADER-539): `tools/sampler_lod_probe.py --oracle hw` samples a linear 64x64 R32_SFLOAT |
| 856 | texture with seven levels at its top-left texel. The texture memory is a dword ramp, so each result names the | ||
| 857 | level it was read from, and a calibration row per level finds the level starts. It runs 43 rows of | ||
| 858 | `image_sample_l` and `image_sample_lz` on a gfx1036 (Radeon iGPU, Windows 11, AMD 26.10.1, `tools/hw_oracle` | ||
| 859 | HIP launcher, rocm-sdk-core 10.0.0 clang). wave32 and wave64 gave the same level in every row, and three runs | ||
| 860 | were identical. | ||
| 861 | - **The S# fields apply to explicit LODs.** LOD_BIAS (±), MIN_LOD and MAX_LOD apply to `image_sample_l`'s | ||
| 862 | explicit LOD and to `image_sample_lz`'s LOD 0, bias before the clamp, as radv assumes. MIP_FILTER none ignores | ||
| 863 | them and reads the view's base level. | ||
| 864 | - **The T#'s MIN_LOD applies too.** It counts from the resource's level 0, not the view's BASE_LEVEL: BASE_LEVEL | ||
| 865 | 1 with MIN_LOD 2 reads level 2. | ||
| 866 | - **Where the hardware is not Vulkan:** | ||
| 867 | - **Rounding.** The point mip filter's level is floor(lambda + 0.5), so an exact .5 rounds up: LOD 0.5, 1.5 and | ||
| 868 | 2.5 read levels 1, 2 and 3, and so do S# MIN_LOD 1.5 or MAX_LOD 1.5 and LOD 1 with bias +0.5. Vulkan's | ||
| 869 | nearest is ceil(lambda + 0.5) - 1, which reads 0, 1 and 2. | ||
| 870 | - **The T#'s MIN_LOD clamps the still fractional LOD before that rounding.** MIN_LOD 2.25, 2.5 and 2.75 at | ||
| 871 | LOD 0 read levels 2, 3 and 3. `VK_EXT_image_view_min_lod` raises the integer level to floor(minLod), which | ||
| 872 | gives 2, 2 and 2. | ||
| 873 | - **MIP_FILTER none with the T#'s MIN_LOD.** The level is the base raised to floor(MIN_LOD): 2.5 reads level 2, | ||
| 874 | the same as Vulkan. | ||
| 875 | |||
| 876 | So a host whose Vulkan driver follows the spec's nearest rule reads one level lower than the console on 8 of | ||
| 877 | the 43 rows: an exact half-level LOD, or a fractional ResourceMinLODClamp. LOD 1.49 reads level 1 on both. The | ||
| 878 | AMD driver does not follow it. Through the runtime's own path (`vk_sampler_test`, `vulkan_sampler(decode(S#))`), | ||
| 879 | an S# LOD_BIAS of +0.5 on `image_sample_lz` reads level 1, like the console, on the same gfx1036 and on an RX 7800 | ||
| 880 | XT (both AMD 26.10.1). So on AMD hosts the S# case matches. Other hosts (NVIDIA, Intel, Mesa) are not measured | ||
| 881 | here. | ||
| 882 | - **Layout.** gfx1036 lays a linear mip chain out smallest level first, each row padded to 256 bytes. Levels 6..0 | ||
| 883 | of the 64-wide R32 chain start at dwords 0, 64, 192, 448, 960, 1984 and 4032. | ||
| 884 | |||
| 885 | `tests/test_sampler_lod_probe.py` checks the descriptor fields against `check.py` and `gfx10_descriptors.h`, and | ||
| 886 | the model against these levels, without a GPU. | ||
| 856 | - `d3d12_com_test`: drives the COM objects through their vtables. It also checks that a queue `Wait` on a fence | 887 | - `d3d12_com_test`: drives the COM objects through their vtables. It also checks that a queue `Wait` on a fence |
| 857 | the CPU has not signalled holds the GPU back. | 888 | the CPU has not signalled holds the GPU back. |
| 858 | - `dxgi_swapchain_test`: creates a Win32 HWND and exercises `rt::d3d12::create_dxgi_factory`, | 889 | - `dxgi_swapchain_test`: creates a Win32 HWND and exercises `rt::d3d12::create_dxgi_factory`, |