AI-assisted. Addresses IAmNotSiob's review on #512 (he is taking the
arithmetic sites under SHADER-56/#513; f16_roundtrip stays here).
SPIR-V's OpQuantizeToF16 returns +0/-0 when the magnitude is too small for a
normal f16, and it pins no rounding mode. The docstring, the design row and the
test's rule text now say "round to nearest, f16 denormals flushed to signed
zero" and warn against reusing the helper where denormals or a rounding mode
matter.
The mini-interpreter used struct.pack('<e'), which keeps f16 subnormals: it was
more precise than any conforming driver, so a test could pass here and fail on a
GPU. It now flushes after float_to_half, and the test's independent oracle does
the same. A new case pins 1e-6 -> +0.0 and -1e-6 -> -0.0 through a translated
flagged shader (PS input 1e-6 is an f16 subnormal, 6.1e-5 is the smallest
normal); without the interpreter flush that test is red.
Existing 1.1 -> 1.099609375 pin and the opcode pin are unchanged.
A UINT opaque-white border read back as 0 (Vonsek, on an RTX 5080). The S# has
no integer border types, since the hardware reads them by the image's format.
So bind_sampler gave Vulkan VK_BORDER_COLOR_FLOAT_*, which an integer image
reads as 0. The float and UINT samplers also shared one S# key and so one
VkSampler.
An integer border is now marked in the S#: BORDER_COLOR_PTR = 0x800
(gfx10::kIntegerBorderPtr), a field the hardware reads only for table colours.
That gives it its own key, and vulkan_sampler picks VK_BORDER_COLOR_INT_*.
d3d12_descriptor_test runs Vonsek's case: an R8G8B8A8_UINT texture sampled past
its edge through UINT black and white border samplers reads 0 and 1, and a
float white border reads 255. The case fails with the float enums on an RTX
4090. gfx10_descriptors_test and d3d12_sampler2_test check the mark.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CreateSampler2 wraps CreateSampler. The UINT border colour maps (0,0,0,0),
(0,0,0,1) and (1,1,1,1) to the S#'s border types, and anything else to the
table. Non-normalized coordinates set FORCE_UNNORMALIZED. A description the PC
runtime refuses (unknown flags; a non-normalized sampler with an unequal
min/mag filter, a linear mip filter, anisotropy, comparison, a U/V address mode
other than clamp/border, or a non-zero LOD or bias) leaves the slot as it was,
as the runtime does on an RTX 4090 and on WARP. The layer now answers
D3D12_OPTIONS17 with NonNormalizedCoordinateSamplersSupported, as both report.
d3d12_sampler2_test compares the S# bytes with CreateSampler's and the 22
edge cases with the host's PC runtime live.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CreateCommittedResource1/2/3, CreateCommandQueue1 and GetCopyableFootprints1
as thin wrappers over the existing methods. D3D12_RESOURCE_DESC1 drops to
D3D12_RESOURCE_DESC; the initial state or barrier layout is unused, because new
textures start UNDEFINED and move on first use. The newer arguments are answered
as the PC runtime answers them (measured on an RTX 4090, driver 621.14):
- a protected resource session: E_INVALIDARG (no session support reported);
- a sampler-feedback mip region: E_INVALIDARG on textures, ignored on buffers;
GetCopyableFootprints1 returns its failure answer for such a texture;
- a buffer's initial layout other than UNDEFINED: E_INVALIDARG;
- a castable count with a null list: no list;
- a castable list: E_INVALIDARG, since it needs RelaxedFormatCastingSupported,
which the layer does not report (D3D12_OPTIONS12 is unanswered);
- CreateCommandQueue1's creator ID: ignored.
d3d12_method_variants_test compares each variant with its base method, runs the
edge cases and, when the host has a D3D12 device, compares each answer with the
PC runtime live. Thanks to ezwinxdlmao for the probe notes in #156.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The runtime uses version 1.2 root signatures (D3D12_ROOT_SIGNATURE_DESC2),
which older SDKs such as 10.0.22621 don't declare, so the build failed
halfway through with a compiler error. The prerequisites now name the SDK,
docs/testing.md has a Known problems row for the error, and CMake checks
for it at configure time and stops with the fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The in-box d3d12.dll of Windows 10 (and Windows 11 23H2, #361) serializes
root signatures only up to 1.1: on Windows 10 it rejects even an empty 1.2
description with E_INVALIDARG (#528). #361 made the tests skip there, but the
d3d12_xs serializer still forwarded 1.2 descriptions unchanged, so every 1.2
root signature from the package DLLs or the game failed on those hosts.
- d3d12_xs_rootsig: downgrade_root_signature_1_2_to_1_1 rewrites a 1.2
description whose static samplers all have Flags == 0 as the same root
signature in 1.1 (1.2 differs only in D3D12_STATIC_SAMPLER_DESC1::Flags).
- d3d12_xs: probe the host once with an empty 1.2 description; where it
stops at 1.1, serialize 1.2 as 1.1, or refuse one with sampler flags
with a log line.
- root_sig_test: the registered shim's 1.2 checks run on every runtime again;
new checks cover the rewrite field by field, through the registered shim
and back through the host deserializer, and the refusal.
- root_signature_oracle_test: its 1.2 cases use sampler flags, which have no
1.1 form, so they print SKIP where the host can't serialize 1.2.
- docs/d3d12_vulkan.md: the measurement and the rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v_fma_f16, v_fmac_f16 and v_pk_fma_f16 used GLSL Fma (rounded to f32) and then narrowed, a double rounding;
an RX 6700 matches a correctly rounded f16 FMA in 12,612/12,612 cases (#374). fma_f16_odd: exact f32 product,
TwoSum, round-to-odd at f32, then f16_bits. Design row for f16 rounding.
#488 landed the translator fix. This adds what it left out: a semantic
test that executes the translated fixture on one 32-wide subgroup (a
mask of 63 is an out-of-range shuffle there), and the contract-table row
with how the rule was found (FUZZ-7) and confirmed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The GetResourceTiling notes in d3d12_vulkan.md section 4.2 were measured on
NVIDIA only. On an RX 9070 XT (RDNA4, driver 32.0.31041.1004, Windows 11,
main 91b36cf) the AMD PC runtime splits standard and packed mips differently,
so d3d12_vulkan_device_test's tiling comparison fails there: tile shapes agree
in all 17 texture layouts and 11 match exactly, but in 6 AMD keeps more mips as
standard tiles. Record those six, the rule that fits all 17 AMD results (a
hypothesis), and that the split to follow is open (#374).
AI-assisted (Claude Code).
Map the shared-exponent format through resource creation and buffer-image copies so shaders can resolve its existing GFX10 view. Check the sampled channels and compare the mip-array footprints with the host runtime.
CopyResource, CopyTextureRegion (texture to texture, footprint to texture and back, boxes, offsets, array slices,
mips, 3D) and CopyBufferRegion run on the layer and on a host D3D12 device (LEONIDA_HOST_ADAPTER picks it) and the
bytes read back are compared, for 39 format/shape cases including BC1-7 and depth-stencil.
Layer fixes it found: texture formats R8G8_SNORM, R16_UNORM, R32G32_UINT, R9G9B9E5, B5G6R5 and B5G5R5A1 were
refused; a block-compressed texture-to-texture box reaching the padded mip edge was refused as invalid_copy.
Known differences (TEXTURE1D, D24 on GPUs without it, D24 X8 byte) are documented.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unimplemented import used to return 0 silently, which is S_OK for an
HRESULT function with its out parameters never written. The thunk now passes
the caller's return address and rcx/rdx/r8/r9 to a shared stub, and
LEONIDA_UNIMPLEMENTED picks the behaviour:
- log (default): exactly as before.
- fail: E_NOTIMPL for imports known to return HRESULT (D3D12Create*/Serialize*,
CreateDXGIFactory*, XGameRuntimeInitialize, and the GDK XAsync/XTaskQueue/
XUser/XStore/XGameSave/XPackage/XGameUi families minus their documented
void/bool/int functions), 0 otherwise.
- stop: print the import, the caller as module+RVA and the four argument
registers, then break under a debugger or exit with code 3.
--dry-run now counts unimplemented imports by return class. The stub zeroes
xmm0 and has unwind info, so float callers and debuggers are unaffected.
unimplemented_policy_test builds a synthetic image and checks all three modes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
v_add_nc_i32 and v_sub_nc_i32 raised Unsupported. The VOP3 clamp bit on
v_add_nc_u32 / v_sub_nc_u32 / v_subrev_nc_u32 was silently ignored, so a
saturating add came out wrapped. On GFX9+ an integer add/sub with clamp
saturates (LLVM selects uaddsat/usubsat and saddsat/ssubsat to these ops):
unsigned to [0, 0xFFFFFFFF], signed to [INT_MIN, INT_MAX].
tests/semantic/test_alu_add_nc_clamp.py checks all five ops with and without
clamp against a plain-Python reference; docs/design.md gets a contract row.
Add a character-skeleton page: 597-name #ft table, the following 597-record parent/reference-TRS table, the model bone-hash mapping, and the character material texture-parameter split. Update animation.md with the partial clip decode (two named clips, 0x48-byte track arrays, 63/38 and 12/38 masks) and the 46-byte MoVE header correction. Link the new page from models.md and design.md. No game data.