Repository navigation
Float compares with NaN operands, f64 math past the f32 and int64 ranges - #46
Conversation
|
Thanks! Merged onto current Unicorn Overlord: the title screen stays black. The SEGA logo and the opening text render. After them the picture stays black while the music plays. The black frame at 15.6 s is a normal gap between logos; it is there on It's the f32 compare change. Unicorn's shaders have no f64 instructions at all:
Their HLSL bodies never call the new f64 helpers either. For non-NaN operands the new compares give what the old ones did, so a NaN must reach one of these Since the console's compares are ordered too, I suspect the NaN itself is the real bug: something XCL computes differently from the console, so that the console never sees a NaN there. Options:
Note that the f64 helpers sit in the shared prelude, so any change there recompiles every shader of every title after a merge. XDefiant then stays black for minutes on its first run. Not covered yet with #46: Fortnite and XDefiant. Minecraft looked fine. |
0f48804 to
5b65d40
Compare
|
Tested on RTX 5070 Ti only (Blackwell, driver 32.0.16.2114, D3D12 wave range 32..32). The RDNA2 iGPU on this machine is disabled, so it wasn't tested. The branch was merged onto
|
On AMD, a shader with !(a >= b) followed by a < b on the same operands returned true for a < b when an operand was NaN, although the DXIL is correct. Every f32 and f64 compare now tests for NaN explicitly. floor, ceil, trunc and fract went through int64_t and broke on large values, inf, NaN, signed zeros and abs and neg modifiers. ldexp built 2^n as an f32, sqrt and rsq started from an f32 root, and cvt_i32_f64(NaN) gave -2^31. The f64 helpers now work on the bits. New GPU tests cover the edge cases and compare random inputs against the CPU.
The seven new GPU tests only ran on GPUs with wave64, so on NVIDIA they all returned early. They check each lane on its own, so they now run once as a wave64 program where the GPU has wave64 and once as a wave32 program on any GPU, and check the 32 lanes that ran.
5b65d40 to
b8fca79
Compare
|
Merged (be1994b), thanks – and sorry for the wait. Re-tested on current One fix on top (6a41c55): #67 removed |
A shared stand-in (`standin::shell`) is a Rust object, not a D3D12Core pipeline. Device xcl-dev#34 MakeResident and xcl-dev#35 Evict keep the PC layout for console code and had no override, so a stand-in pipeline in the title's object array reached the driver as `*mut Shell`. Both are overridden now. Microsoft's MakeResident / Evict support residency changes on descriptor heaps, heaps, committed resources and query heaps only; a pipeline state is ID3D12Pageable but not among them, so the pipeline behind a stand-in is no valid entry either. Each shell is left out of the array: the driver gets the other objects in order, in a copy (the title's array is left as it is), and its HRESULT is returned as it is. A call with stand-ins only returns S_OK without a driver call. Arrays without a stand-in (empty, null, supported objects) go as they are. Nothing builds or waits for a lazy pipeline. The other entry points named in xcl-dev#2455 are not reachable by title code on main: device xcl-dev#46 SetResidencyPriority and xcl-dev#51 EnqueueMakeResident are console extensions there (a logged S_OK stub), xcl-dev#44 is the console's CreatePlacedResourceX (no native pipeline library for StorePipeline), and xcl-dev#12 CreateCommandList goes to `create_command_list_pc`, which resolves the initial pipeline. Fixes xcl-dev#2455 Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Fixes float compares with NaN operands and several f64 operations in the shader translator.
!(a >= b)followed bya < bon the same operands returned true fora < bwhen an operand was NaN. The DXIL is correct, so the driver causes it. Every f32 and f64 compare now tests for NaN explicitly.floor,ceil,truncandfractwent throughint64_t, so large values, inf, NaN, signed zeros andabsandnegmodifiers came out wrong.ldexpbuilt 2^n as an f32, soldexp(1, 1023)was inf.sqrtandrsqstarted from an f32 root, sosqrt(1e300)was inf.cvt_i32_f64(NaN)gave -2^31 instead of 0.Testing