Shaders: gradient samples on cube images #138
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!138
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/138/head"
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?
@LaunchDoesntCode on GitHub · 2026-11-24 00:51 UTC · original
shader/cube-gradient-samples→main· +213 −42 · 1 files · 4 commits · closed without mergingDepends on: #73. This branch is built on #73's head, so until that merges the diff shows its commit too. Only the last commit,
492e948, is new here.What
image_sample_dandimage_sample_d_clon cube images were refused ("a cube sample with texel coordinates, gradients or a level query"). They now translate. Texel coordinates and level queries on cubes are still refused.How
cube_directionis linear in the face coordinates, so the newcube_gradientreturns its derivative for the host'ssampleGrad: twice each face gradient, signed per face, zero along the face's own axis. Both share a smallcube_facehelper for the per-face select.Measured
victory translateover the Xbox 1.0.2.1 shader containers (26,503 containers, 26,084 programs), #73's head against this branch:No other category got worse; "a cross-lane operation outside compute" goes 48 → 50 because two programs now get further. The corpus has 52
image_sample_dand 248image_sample_d_clon cubes, none witha16.Tested
x86_64-pc-windows-msvcon Linux and run under Proton 10 (vkd3d-proton), RTX 5090.cargo test -p victory-shader: all pass exceptstub_pipeline_is_created, which also fails on unmodifiedmainunder Proton (vkd3d-proton accepts the zero digest).main+ #73 + this commit merges cleanly, builds, and passes the same tests.Not tested: a Windows run, please
I have no Windows build of this yet, so two things are unchecked:
victory translate --validatewithdxil.dllon the newly emitted programs.cube_direction, not confirmed against the console's output. If someone on Windows can look at a cube-lit surface or reflection in the title with this branch, that would settle it. A wrong sign or scale would show as the wrong mip level (too blurry or too sharp) rather than a crash.AI-assisted (Claude Code).
🤖 Generated with Claude Code
@DaviTostes on GitHub · 2026-11-24 00:53 UTC · original
Tested
492e948on Arch Linux x86_64, rustc 1.98.1:cargo test -p victory-shader: 51 passed, 0 failed (2 test binaries). The full workspace still needs #112 for thevictory-gpuE0425.The diff adds no test for the cube gradient samples, so this only shows the existing shader suite stays green; a synthetic
image_sample_d/gradient case on a cube would cover the new path.No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
@ifBars on GitHub · 2026-11-24 00:59 UTC · original
Confirmed the Windows validation and pipeline creation for three pixel shaders seen during first-story rendering on Windows 10 22H2, RTX 3060 Ti, driver 610.88, Agility SDK 620. On our downstream build with #73, all three reached the unsupported cube-gradient case. Adding only
492e948let all three pass Microsoft dxil.dll (Windows SDK 10.0.26100.0) and create D3D12 pipelines with the translate command's generated vertex shader.The shader hashes were
2deec721a63fe8a5,7bdefdfde461f6e3, andee41ebc3eb3fbbdc. This check covers shader translation and host PSO creation. Visual correctness and frame time were outside the test. AI-assisted with Codex.@LaunchDoesntCode on GitHub · 2026-11-24 01:01 UTC · original
Thanks for the run. Added the synthetic case in
ff95daf:gradient_samples_lower_on_planes_and_cubeshand-builds a pixel program (two table descriptors, one MIMG, an export) and takes it through every stage to DXIL forimage_sample_dandimage_sample_d_cl, each on a 2D image and on a cube.800227dmerges currentmain(the lowering tests gained a second helper there; both are kept).cargo test -p victory-shaderunder Proton 10: 69 passed; the one failure isstub_pipeline_is_created, which fails the same way onmainthere.What the test does not show is that the gradients are right, only that the path lowers. The request for a look at a cube-lit surface on Windows still stands.
No game data used. AI-assisted (Claude Code).
@r4tedx on GitHub · 2026-11-24 03:14 UTC · original
Review note on the a16 layout in this PR ("With a16, sampling coordinates, gradients, LOD and clamp are f16"). On GFX10.3 a16 does not make the derivatives 16-bit; only the
_g16opcodes do. LLVM's MC testgfx10_asm_mimg.shaswhich is four 32-bit derivatives and one dword of packed coordinates. With the derivatives read as packed halves, the coordinates come from the wrong dword. Also, with a16 the bias is an f16 in the low half of its dword (
SITargetLowering::lowerImage: "Bias is of type half but occupies full 32-bit"), not an f32.The decoder on
maincounts a16 derivatives as packed too (gfx10/fields.rs), so this is easy to inherit; I did in #160 and fixed it there (7265593).From the documents and synthetic tests only; I have no copy of the title and have not run this on console hardware.
@fuzeofficlal on GitHub · 2026-11-24 11:07 UTC · original
I ran a Windows pixel readback on exact head
800227d, with an original six-face cube and four mip levels. On both RTX 5090 and WARP, all 32 lanes forimage_sample_dand all 32 forimage_sample_d_clmatched native HLSLTextureCube.SampleGrad. The native outputs also matched an independent expected face/mip selection for every lane.The probe covers ordinary-precision face-center samples, both in-face gradient axes, and several minimum-LOD values. It validates face and mip selection in this fixture.
Pull request closed