Repository navigation
shader: a comparison sampler replaces the reduction instead of OR-ing into it - #2812
spy0eye-beep wants to merge 1 commit into
Conversation
The comparison bit was OR-ed into a filter that already holds the reduction in bits 7-8, which turned a minimum sampler (0x100) into a maximum one (0x180). StaticSampler::make_comparison replaces the reduction; comparison_replaces_the_reduction covers standard, minimum and maximum reductions. immediate_sampler_slots_distinguish_comparison_uses builds its expectation with it too. Split out of Marvisak#1483. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kotekompotek
left a comment
There was a problem hiding this comment.
Real bug fix: filter bits 7-8 are D3D12's reduction-type field (0 standard, 1 comparison, 2 minimum, 3 maximum), and OR-ing 0x80 into a minimum sampler (0x100) produced 0x180 = maximum instead of comparison. Masking then setting (& !0x180 | 0x80) replaces the field correctly. The test matrix covers standard/min/max reductions across point/linear/aniso bases. LGTM.
|
Verified
|
Shaders: port four translator fixes from upstream (Marvisak#2813, Marvisak#2812, Marvisak#2816, Marvisak#2817)
AwsAli05
left a comment
There was a problem hiding this comment.
The focused reduction test passed at 333e39c3 on Windows. A call-site improvement would make the shader-emission test exercise the original failure directly. It currently emits a comparison sampler from all-zero words and builds the expected filter by calling the same new helper. Use a word set with a nonstandard reduction (for example, bit 29 set in word 0 for MIN) and assert comparison bits 0x80 in the emitted static sampler. That would catch a regression back to OR-ing at the call site.
AI-assisted review and test.
…neg-NaN - Marvisak#2909: reject empty query heaps at creation (count == 0) - Marvisak#2789: ds_wrap_rtn_b32 reads both of its data operands - Marvisak#2771: a global or scratch load into LDS has no result register - Marvisak#2765: scratch with neither address names no register (GFX10.3 ST mode) - Marvisak#2812: a comparison sampler replaces the reduction instead of OR-ing in - Marvisak#2823: neg input modifier flips bit 31 by XOR (a NaN's sign too) Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Automated triage for the maintainers.
CI: passing. Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested merged onto origin/main (63bcca4) on Windows 11 x64:
cargo test -p victory-shader --lib emit::sampler::tests: 7 passed, 0 failed (including newcomparison_replaces_the_reduction).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…ion instead of OR-ing into it
The comparison bit was OR-ed into a filter that already holds the reduction in bits 7-8, which turned a minimum sampler (0x100) into a maximum one (0x180). StaticSampler::make_comparison replaces the reduction; comparison_replaces_the_reduction covers standard, minimum and maximum reductions. Ported from Marvisak#2812 (333e39c). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split out of #1483 as requested in review.
D3D12 keeps the reduction in filter bits 7-8 (0 standard, 1 comparison, 2 minimum, 3 maximum). OR-ing 0x80 into a minimum sampler (0x100) produced a maximum one (0x180).
StaticSampler::make_comparisonclears the reduction and sets comparison; both call sites use it, and the existingimmediate_sampler_slots_distinguish_comparison_usesexpectation is updated rather than duplicated.Test:
comparison_replaces_the_reductioncovers standard, minimum and maximum reductions with point, linear and anisotropic filters.🤖 Generated with Claude Code