Repository navigation
Recompiler: keep clamped VOP3 pkrtz when patching 32-bit PS exports - #3600
Conversation
patch_ps_32bit_exports turns a compressed `exp mrtK` fed by v_cvt_pkrtz_f16_f32 into an uncompressed export of the conversion's raw f32 sources, and must decline the patch when the VOP3 form carries an input or output modifier. It looked the clamp bit up as "CLMP", but the encoding table names the ENC_VOP3 field "CLAMP"; field_value returns None for an unknown name, which the lookup turns into 0. So a clamped conversion was never declined and its clamp was dropped: a render target with a 32-bit format received the unclamped f32 value instead of the value the title clamped to [0, 1]. The new test exports a VOP3 pkrtz of a large float to a 32-bit MRT: it is patched without CLAMP and left alone with CLAMP, in both the HLSL and the direct DXIL backends. It fails on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
merge-check
|
|
merge-check claim |
|
merge-check |
patch_ps_32bit_exports(from #3200) turns a compressedexp mrtKfed byv_cvt_pkrtz_f16_f32into an uncompressed export of the conversion's raw f32 sources when the render target is 32-bit. It must decline when the VOP3 form has an input or output modifier, but it looked up the clamp bit as"CLMP", while theENC_VOP3field is named"CLAMP". An unknown field name reads as 0, so a clamped conversion was still patched and the clamp was dropped: the 32-bit render target got the unclamped f32 value instead of the value clamped to [0, 1].V_CVT_PKRTZ_F16_F32has no VOP3P form, so only VOP3 is affected.What is in it
crates/xcl/src/gpu/recomp/mod.rs: check"CLAMP"instead of"CLMP"(one line).crates/xcl/src/gpu/dxil/core_tests.rs:ps_32bit_rt_export_declines_patch_for_clamped_vop3_pkrtzexports a VOP3 pkrtz of a large float to a 32-bit MRT. Without CLAMP it is patched; with CLAMP it is left alone, in both the HLSL and the direct DXIL backends.Tested
stable-x86_64-pc-windows-msvc. Suite in debug, smoke in release.cargo test --workspace --no-fail-fast -- --test-threads=4on 868e466: 2905 passed, 0 failed, 51 ignored. These are the same 28 SKIPPED notices as on main:no wave64(wave64 GPU tests ingpu::recomp::lower,lower_dxil,recomp::tests,dxil::kernel)no heap windows(heap_window_out_of_memory_falls_back_to_the_switch_form,bind::tests::two_pass_binds_set_the_shared_view_heap)d3d12SDKLayers.dll(the title under the debug layerwith dred false/true,uploads_start_from_each_subresources_state)cannot disable the driver cache (Windows Developer Mode is required)(shaders::tests::pso_measurement_compiles_an_exact_synthetic_record)cargo test -p xcl --lib ps_32bit_rt_export: 3 passed, 0 failed on this branch. On main 6bfb5c5 with only the new test applied, it gives 2 passed, 1 failed: the new test fails at the clamped HLSL check, and the unclamped control passes. With the HLSL checks removed, it also fails on main at the direct DXIL check, because the raw 0x781d3718 is stored to RT1.Regression run
main:
PR head:
Not tested
AI use
🤖 Generated with Claude Code