shader: lower v_cvt_f32_f64, the first double in the emitter #138
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/138"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Zettrox/ztrx. Originally posted by xiaotu030202 on 2026-11-25T13:47:11Z.
What this fixes
v_cvt_f32_f64was refused outright — not because the instruction is hard, but because nothing inemittouched adoubleat all. #132's log has two shaders that stop there:Three things were missing, and all three had to exist before the instruction could:
TypeDef::Double— LLVM type4could not be writtenrecord(4)Types.f64Module::double()Cast::FPTrunc— the enum jumpedSiToFp = 6→Bitcast = 117The lowering is three steps: the console's double arrives as an
i64(two VGPRs, through the existingsrc64), bitcasts tof64, narrows withfptrunc. That is what DXC emits for(float)d.The feature flag, and why the error message was the wrong thing to read
My first attempt used a
doublewithout declaring it. The validator was precise:The delta is
0x4— and0x4is not the answer. It is the difference the validator computed between two values, not the bit to set.d3dcommon.hhas the real one:0x1, the first entry of the enum. Every other flag already in this file matches that enum exactly —STENCIL_REF 0x200,TYPED_UAV_LOADS 0x800,WAVE_OPS 0x4000,INT64_OPS 0x8000,BARYCENTRICS 0x20000— which is what made the header the right authority rather than the diff.Setting
0x4passed the usage check and failed the next one:Two wrong answers that each look like progress is exactly why I went to the header instead of bisecting.
Tests, checked in both directions
v_cvt_f32_f64_narrows_a_double_to_one_dword— a compute shader holding the instruction, lowered;build_csrunsdxil.dllover the container, so a wrong one is a failure, not a skip.v_cvt_f32_f64_takes_a_scalar_pair_too— the same with an SGPR pair rather than a VGPR pair, which is the other way a title reaches it.Verification
Windows 11, RTX 5070 Ti, Rust 1.98.1 (pinned), MSVC 14.44.35207, Windows SDK 10.0.26100.0,
VICTORY_DXILset. No game files.What is not claimed
v_cvt_f64_f32is still refused — the same gap in the other direction. It needsfpext(which I added toCastand then removed, since nothing constructed it) and a 64-bit destination register pair, which is a different code path from the one this PR touches. Doing one and leaving its mirror refused is deliberate: half a feature that says so beats half a feature that does not.I have not seen those two shaders translate. What is established: the instruction lowers, the DXIL validates, 214 tests pass. Whether the two now go through, or stop at the next thing they contain, is what
victory translate --listovershaders.rpfwould say — and that needs game files.If someone can run the census on this branch, the two hashes either disappear from the refusal list or name the next reason, and either answer is worth having.
Imported from Zettrox/ztrx. Originally posted by xiaotu030202 on 2026-11-25T14:10:31Z.
Superseded by #142, which is all three of these in one branch.
They were split because each was verifiable on its own, but two of them cannot apply to
mainwithout the first — so reviewing them apart means reviewing a branch that does not build. #142 has the same content with one description and one diff.Closing rather than leaving three open PRs for one feature.
Pull request closed