CreateCommittedResource, CreateDescriptorHeap, CreateCommandQueue, CreateFence
and Map now return the host PC runtime's HRESULTs for invalid arguments.
compare_invalid_arguments in d3d12_vulkan_device_test checks the invalid
descriptions and their valid neighbours, plus ALLOW_RENDER_TARGET and
ALLOW_DEPTH_STENCIL on every format both devices create, against the host
device.
On main the new test found 25 mismatches in its first 55 cases (invalid
heap properties and flags, buffer layouts, upload/readback states, clear
values and texture flags accepted; two access violations, on a zero-width
buffer and a zero-size texture array), then the process died creating a
2049-layer texture. main also refused zero-descriptor heaps and answered
E_POINTER where the host treats a null output as a capability check.
CreateDescriptorHeap answers a null output before its flag, type and node
rules, as the host does; committed resources and fences check their
arguments first. A GPU_UPLOAD heap is refused, matching the layer's
OPTIONS16.GPUUploadHeapSupported FALSE; the test compares that case only on
a host without GPU upload heaps (Resizable BAR off).
CreateCommittedResource accepts a sample quality on a single-sampled texture
and the two standard MSAA patterns, as the host does.
The flag and format rules were measured on an RX 9070 XT, an integrated Radeon
GPU and WARP. Answers that differ between them, or that the layer can't follow,
are not compared and are listed in docs/d3d12_vulkan.md. Each new refusal is
logged once with its reason.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The game's translated ray-tracing shaders read the console's BVH records
themselves (docs/d3d12_vulkan.md 4.8), so the layer has to write them. This
adds the GPU builder, checked against tools/xdxr_bvh.py:
- src/xdxr_build.comp: one pipeline, one dispatch per step. Triangle leaves
(any of R32G32B32/R32G32 vertices, none/R16/R32 indices, a stride, an
optional 3x4 transform) or 128-byte INSTANCE records with world-to-object
inverses; Morton keys and a bitonic sort; BOX32 nodes four consecutive
children at a time, level by level, with the parent table; the header.
Buffer device addresses as uvec2: needs bufferDeviceAddress, not
shaderInt64. NaN triangles, mask-0 instances, instances without a BLAS and
singular transforms get empty boxes.
- src/xdxr_build.h: XdxrLayout (exact result and scratch sizes from the
element count, for the prebuild info too) and XdxrBuilder (records the
dispatches). A bias maps the application's 40-bit BLAS addresses to device
addresses.
- test/vk_xdxr_build_test.cpp: nine synthetic cases built on the GPU and
dumped; ctest `xdxr_build` + `xdxr_build_check`, which runs
`tools/xdxr_bvh.py check-build`: validate, then trace 1000 rays per case
against brute force.
- vk_test_device.h: opt-in bufferDeviceAddress (request_buffer_device_address,
device_address()).
- tools/xdxr_bvh.py: check-build; trace takes the bias; instances without a
BLAS and inactive triangles are valid.
Not wired to BuildRaytracingAccelerationStructure yet: that path builds a
VkAccelerationStructureKHR today (#743), and which one the layer uses is a
maintainer decision.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sampler_descriptor() already encodes D3D12_FILTER_REDUCTION_TYPE_MINIMUM and MAXIMUM into the S# filter_mode and gfx10_descriptors.h already provides vulkan_reduction_mode(), but bind_sampler() ignored it and logged that minimum/maximum samplers blend for now.
Enable Vulkan 1.2 samplerFilterMinmax in device creation and vk_test_device.h, chain VkSamplerReductionModeCreateInfo in bind_sampler() when supported and not combined with compareEnable (falling back to blend with a log otherwise), update docs/d3d12_vulkan.md, and add a synthetic 2x2 GPU sampling test in d3d12_descriptor_test comparing MINIMUM, MAXIMUM, and STANDARD (negative control) linear filters.
Texture3D SRVs already encode ResourceMinLODClamp into the T# descriptor, but image_descriptor() rejected non-zero clamps and bind_image() only applied VK_EXT_image_view_min_lod / empty-mip-set swizzle zeroing to 2D, 2D-array and cube colour views.
Allow non-zero ResourceMinLODClamp on sampled 3D colour views, forward the T# clamp to Vulkan in bind_image(), update docs/d3d12_vulkan.md, and add synthetic GPU sampling and negative-control checks in d3d12_descriptor_test.
A mapped title names its files on the console's drives, but nothing mapped them: the file calls went
straight to the host and --game-dir was only used to find modules, so the first file a title opens at boot
would fail. New shims for CreateFile*, FindFirstFile*/FindNextFile*/FindClose, GetFileAttributes*/
GetFileAttributesEx* and DeleteFile* (kernel32, kernelbase and the api-ms-win-core-file sets) map a GAME:
path under --game-dir, and send every open that can write and every delete to --overlay (default
<game-dir>\overlay), which reads and listings prefer. A write-open copies the package file into the overlay
first, so OPEN_EXISTING keeps its bytes, and a delete of a package file leaves a marker instead of removing
it, so the package is never modified. A path that climbs above GAME: with ".." or names another drive is
refused with ERROR_INVALID_NAME. A path without the prefix is still a host path.
The prefixes and the overlay come from ivall/xcl (GPL-2.0-only), as facts only, no code.
file_system ctest: 43 checks over folders in %TEMP%, covering mapping and case, copy-up and read
preference, a new file in folders the package lacks, delete and re-create, the merged listing, host-path
passthrough, the escape refusal and the narrow variants.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
With U in range, a POINT/CLAMP sampler, a POINT/WRAP one and the fallback sampler give the same pixels, so the
first pass cannot tell which sampler a draw used. The control adds 1 to U before image_sample and picks the sampler
per half through the sampler table: 4096 of 4096 pixels match the CPU prediction and 1536 differ from the plain pass.
Sampler control suggested and measured by @Vonsek in #1489.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main is at 99f99890. One conflict, both sides kept:
- tests/test_shader_checks.py: main shortened the comment above TOTAL and
counts a fourth vk_store_test shader (cs_sample_lz_int_d16: 3 -> 4) on the
lines this branch's comment change touches. Main's comment with a clause
for the "words" fixtures and the image_get_lod draws, main's count, and
this branch's STORE_WORDS and GET_LOD_TESTS terms.
The automatic merges were read as well: check.py and run_gpu_tests.py run
cs_sample_lz_int_d16 through vk_store_test's "load-d16" mode next to the
"words" fixtures, and gfx10_descriptors.h still encodes the T# of the 16x4
image the same way.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Under Wine with a Vulkan GPU both failed instead of skipping:
- d3d12_stencil_copy: its ctest entry sets LEONIDA_HOST_ADAPTER=warp, and
copycmp::create_host exits 1 when that adapter isn't there, which under
Wine it never is.
- d3d12_rgb96: Wine 11 has a WARP adapter (vkd3d), so the 'no WARP' skip
doesn't fire and the test compares against vkd3d's footprints.
Both now return 77 when the host D3D12 is Wine's, as the other host
comparisons do since #1343. Windows is unchanged.
AI-assisted (Claude Code).
MUBUF/MTBUF accesses follow the RDNA2 ISA's swizzled buffer addressing
(8.1.5, tables 33/35/37) with the V# fields of Mesa's gfx10-rsrc.json:
SWIZZLE_ENABLE word1 bit 31, INDEX_STRIDE word3 [22:21], ADD_TID_ENABLE
word3 bit 23, element size fixed at 4 bytes. ADD_TID adds the wave lane to
the index (swizzled or linear), dword k of a swizzled access is 4 * IS bytes
after dword k - 1, and OOB_SELECT 3 with swizzle and a stride checks like
mode 0. Literal V# words fold; run-time ones use IS = 2^(swz * (3 + n)), so
IS = 1 is the linear address. A literal swizzled V# used to be Unsupported
and a run-time one was translated unswizzled.
Tests: tests/semantic/test_buffer_swizzle.py (hand-worked addresses, literal
and run-time V#s) and the GPU fixture cs_buf_swizzle.asm.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The graphics stage infos chain structs that variants built at draw time still read. d3d12_subgroup_test builds its V# with OOB_SELECT 3. check.py and run_gpu_tests.py skip the wave64 pixel fixture where the fragment stage could not be required 64-wide (vk_harness says so). d3d12_subgroup is registered with ctest and exits 77 without a Vulkan device.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The translated shaders declare Capability Int64 for the physical-storage-buffer address arithmetic; the standalone device now enables shaderInt64, but the test device (vk_test_device.h) did not, so vkCreateShaderModule broke VUID-VkShaderModuleCreateInfo-pCode-08740 on every translated module under validation (found with d3d12_subgroup_test).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
d3d12_subgroup_test now draws ps_w64x_readlane.asm (a wave64 pixel shader with
v_readlane of lanes 40, 5, 33 and 63) over 64x64 pixels through a D3D12 graphics
PSO into a float target: every pixel must carry the derived words where the PSO
required 64 (4096 of 4096 on the Radeon 880M). Probe shaders (compute and
fragment) store gl_SubgroupSize, so the size the driver ran them with is
observed and must equal what the PSO required; a wave32 compute shader's control
run is asserted to differ on a device whose default is not 32, and the pixel
probe shows the wave32 request changing 64-wide to 32-wide on the 880M. The
wave64 pixel control is asserted to differ only where the default pixel
subgroup is not 64.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Where the size cannot be required (the stage is not in requiredSubgroupSizeStages,
or subgroupSizeControl is off) but the device default is the wanted size, the
shader works as it is. The decision now says device_default (not guaranteed
stable, but not inexact and not logged as such); only a different default stays
unavailable. The REQUIRE_FULL_SUBGROUPS citations are corrected: the feature rule
is VUID-VkPipelineShaderStageCreateInfo-flags-02785, the stage rule flags-08988
(flags-02784 is the ALLOW_VARYING feature rule).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Dispatches cs_w64x_readlane translated natively and with --wave64-emulate, and
the wave32 cs_wqm_w32, through compute PSOs of the Vulkan device and compares
the words they store. The PSO's request must match the decision function; the
native wave64 shader must be exact where the device can give 64 and is only
reported where it cannot, the emulated one must be exact everywhere. A control
run with nothing requested is printed. The shaders are translated at build time
with test/shaders/build.py when llvm-mc is available.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Device creation enables subgroupSizeControl and computeFullSubgroups where the
GPU has them and keeps minSubgroupSize, maxSubgroupSize, the default
subgroupSize, maxComputeWorkgroupSubgroups and requiredSubgroupSizeStages in
VulkanDeviceInfo::subgroup (also printed at creation). CreateComputePipelineState
and CreateGraphicsPipelineState run decide_subgroup_size() per stage and chain
the result into the stage create-info; the "wave64 compute shader runs
32-wide" log line goes away. A size the device cannot give is logged once per
stage with the first shader's name, and tells the build to use
--wave64-emulate where that exists (compute, mesh).
pipeline_subgroup_requests() exposes what each stage of a PSO asked for.
vktest::Device fills the same properties and the compute and draw tests pass
them on.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
decide_subgroup_size() maps a shader index entry and the device's subgroup
size properties to what a stage should request: nothing for an emulated
shader, VkPipelineShaderStageRequiredSubgroupSizeCreateInfo with the size the
translation assumed (64 for wave64, 32 otherwise) where the feature is on, the
stage is in requiredSubgroupSizeStages, the size is a power of two within
[min, max] and the workgroup fits size * maxComputeWorkgroupSubgroups, and
REQUIRE_FULL_SUBGROUPS for compute when computeFullSubgroups is on and local X
is a multiple of the size. A device with one size that is the wanted one needs
nothing; otherwise the size is reported unavailable.
subgroup_size_test checks it against AMD-like, NVIDIA-like and old-RADV
properties, the limits, and the resulting create-info chain.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ShaderEntry gains subgroup_size (0 when the entry says null or has none) and
wave64_exchange; emulated() is true for a shader translated with
--wave64-emulate, which is exact on any subgroup size. shader_library_test
checks an absent, a native and an emulated entry.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
NVIDIA's validation layer checks the presenter's sRGB swapchain as if it requested STORAGE, then reports VUID-VkSwapchainCreateInfoKHR-imageFormat-01778 and its max-layers/max-extent follow-ons. The presenter only requests TRANSFER_DST, plus TRANSFER_SRC for capture, so that is a layer false positive. Count this VUID separately and return the ctest skip code only when it is the sole validation error; any other error, or a mix, still fails.
The matcher is covered by synthetic first-message and follow-on checks in xbox_present_test. On an RX 7900 XTX with validation on, the test remains clean and passes.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
tools/wave64_halves.py classifies each wave64 VS/PS/GS by partition
invariance: A exact as translated, B exact by construction (waterfall loops,
wave-aggregated atomics up to slot order, readfirstlane/readlane of values
that are the same in every lane), C not exact (lane counts/ranks/ids,
readlane of varying data, stale scalars behind votes, masks as data, ...).
index.json gets wave64_graphics, wave64_graphics_reasons and
wave64_graphics_idioms; --wave64-graphics warn|error|off (error refuses
tier C). One rewrite: readlane of a proven-uniform VGPR reads the own copy.
--census prints tier counts from an index.json. ps_w64_* fixtures,
w64_graphics.py (fragment subgroup size required 64 vs 32) and semantic
tests; vk_harness gets VKH_HEAP_DUMP and a subgroup-size report.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a Windows HDR desktop, DWM scales SDR content by the user's configured
SDR white level, causing GDI GetPixel reads to reflect the boosted and
potentially clipped values (e.g. 66,205,255 for a 51,153,230 clear).
Use IDXGIOutput6::GetDesc1 to check if the monitor displaying the test window
is running in HDR mode (DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020), and skip
the on-screen colour check with an informative message if so, avoiding false
test failures.
Tested on AMD Radeon RX 9070 (driver 26.10.1, Windows 11).
AI-assisted.
Conflicts were list/registration hunks in runtime/CMakeLists.txt, check.py, run_gpu_tests.py and tests/test_shader_checks.py; kept main's side and re-added vk_sampler_test, ps_ssharp and the TOTAL count.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- find_tear_mode rejects a mode whose surface caps lack the swapchain's image usage or extent.
- present_timing: a repeated or stale token is never late.
- percent_scanned is measured at commit, so it agrees with the display time.
- The "no effect" log distinguishes the kill switch from a missing extension or mode.
- LEONIDA_PRESENT_NO_TEAR is read with _dupenv_s: any non-empty value but "0" disables.
- xbox_present_test: the real-time comment is back where it belongs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In `desc_probe` (`%desc_lookup_fn`), the bindless index word at `base + 9`
was loaded from the `%desc_map` storage buffer before the conditional branch
`OpBranchConditional %match %dl_hit %dl_next`.
On every non-matching slot probed as well as on 8-probe misses, this issued
an unnecessary global storage buffer load that was immediately discarded.
Moving the index load into `%dl_hit` eliminates up to 8 storage buffer reads
per miss and 1 read per non-matching collision slot, reducing memory traffic
and register pressure.
Mirrored the same deferred load structure in `runtime/test/vk_descriptor_bench.cpp`.
Added `test_desc_probe_defers_index_load_to_hit_block` to `tests/test_desc_cache.py`.