startup: decode_sampler() ignores MIN_LOD/MAX_LOD and sets ComparisonFunc ALWAYS on non-comparison samplers #2221

Closed
opened 2026-11-27 00:06:57 +00:00 by github-bot · 5 comments
Owner

@⁠roansystemlabs on GitHub · 2026-11-25 05:47 UTC · original

decode_sampler() in src/startup_stubs/translated_sampler_bindings.h (used by dynamic_sampler(), border_sampler() and the static sampler path) has two gaps:

  1. It never reads sampler word 1. RDNA2 keeps MIN_LOD in bits 0-11 and MAX_LOD in bits 12-23 (unsigned 4.8). The descriptor always gets MinLOD = 0 and MaxLOD = D3D12_FLOAT32_MAX, so a title's LOD clamp is dropped for static samplers and for every sampler heap entry.
  2. It sets ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS on non-comparison samplers. The D3D12 debug layer reports warning 1361 for each one ("ComparisonFunc is D3D12_COMPARISON_FUNC_ALWAYS, but D3D12_FILTER_MIN_MAG_MIP_POINT is not a comparison filter"). The existing startup_sampler_heap_warp and startup_sampler_heap_hardware checks pass, but on Windows 11 26200 each draw reports debug_warnings=1024, and every one of those messages is 1361 (WARP 10.0.26100.9818 and an RTX 3070).

Suggested scope: decode both LOD fields, use D3D12_COMPARISON_FUNC_NEVER when the filter is not a comparison filter, and add a check where two entries differ only in MIN_LOD. Found while testing #1998 item E (PR #2220), whose fixture decodes the LOD fields itself.

AI-assisted.

**@⁠roansystemlabs** on GitHub · 2026-11-25 05:47 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2221) `decode_sampler()` in `src/startup_stubs/translated_sampler_bindings.h` (used by `dynamic_sampler()`, `border_sampler()` and the static sampler path) has two gaps: 1. It never reads sampler word 1. RDNA2 keeps `MIN_LOD` in bits 0-11 and `MAX_LOD` in bits 12-23 (unsigned 4.8). The descriptor always gets `MinLOD = 0` and `MaxLOD = D3D12_FLOAT32_MAX`, so a title's LOD clamp is dropped for static samplers and for every sampler heap entry. 2. It sets `ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS` on non-comparison samplers. The D3D12 debug layer reports warning 1361 for each one ("ComparisonFunc is D3D12_COMPARISON_FUNC_ALWAYS, but D3D12_FILTER_MIN_MAG_MIP_POINT is not a comparison filter"). The existing `startup_sampler_heap_warp` and `startup_sampler_heap_hardware` checks pass, but on Windows 11 26200 each draw reports `debug_warnings=1024`, and every one of those messages is 1361 (WARP 10.0.26100.9818 and an RTX 3070). Suggested scope: decode both LOD fields, use `D3D12_COMPARISON_FUNC_NEVER` when the filter is not a comparison filter, and add a check where two entries differ only in `MIN_LOD`. Found while testing #1998 item E (PR #2220), whose fixture decodes the LOD fields itself. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:06:57 +00:00
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 06:16 UTC · original

I'll take item 2, the non-comparison sampler's ComparisonFunc and warning 1361. I'll check the shared static, dynamic and fallback descriptors against a genuine comparison sampler, then run the existing synthetic sampler-heap draw. I’ll keep the LOD-field work available for coordination with #2177 and #2220.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 06:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2221#issuecomment-7154616166) I'll take item 2, the non-comparison sampler's `ComparisonFunc` and warning 1361. I'll check the shared static, dynamic and fallback descriptors against a genuine comparison sampler, then run the existing synthetic sampler-heap draw. I’ll keep the LOD-field work available for coordination with #2177 and #2220.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-25 06:16 UTC · original

This is the runtime decoder side of the LOD work. #2177 already owns the constant-sampler translator slice, and #2220 can keep its mesh fixture local. The decoder fix is available to claim here. Please use the production decoder from a source-built test and compare two heap entries on a texture with distinct mip colors. Exercise both MIN_LOD and MAX_LOD and include a control that drops the clamp and reads the wrong mip. Record warning 1361 before and after, and verify that a real comparison sampler keeps its comparison function. Keep the translator changes in #2177 separate.

**@⁠R0Y00** on GitHub · 2026-11-25 06:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2221#issuecomment-7154621222) This is the runtime decoder side of the LOD work. #2177 already owns the constant-sampler translator slice, and #2220 can keep its mesh fixture local. The decoder fix is available to claim here. Please use the production decoder from a source-built test and compare two heap entries on a texture with distinct mip colors. Exercise both MIN_LOD and MAX_LOD and include a control that drops the clamp and reads the wrong mip. Record warning 1361 before and after, and verify that a real comparison sampler keeps its comparison function. Keep the translator changes in #2177 separate.
Author
Owner

@⁠roansystemlabs on GitHub · 2026-11-25 06:18 UTC · original

I'll take item 1, the LOD fields in the runtime decoder, as you describe it: the production decode_sampler() driven from a source-built test, two heap entries on a texture with distinct mip colors, both MIN_LOD and MAX_LOD exercised, and a control that drops the clamp and reads the wrong mip. I'll record warning 1361 before and after, check that a real comparison sampler keeps its comparison function, and keep the translator side out of it (#2177).

@⁠RavenCurseBurg has item 2 (ComparisonFunc and 1361). Both touch decode_sampler(), so I'll keep my change to the LOD lines and rebase on whichever lands first. WARP and an RTX 3070.

AI-assisted.

**@⁠roansystemlabs** on GitHub · 2026-11-25 06:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2221#issuecomment-7154658609) I'll take item 1, the LOD fields in the runtime decoder, as you describe it: the production `decode_sampler()` driven from a source-built test, two heap entries on a texture with distinct mip colors, both MIN_LOD and MAX_LOD exercised, and a control that drops the clamp and reads the wrong mip. I'll record warning 1361 before and after, check that a real comparison sampler keeps its comparison function, and keep the translator side out of it (#2177). @⁠RavenCurseBurg has item 2 (`ComparisonFunc` and 1361). Both touch `decode_sampler()`, so I'll keep my change to the LOD lines and rebase on whichever lands first. WARP and an RTX 3070. AI-assisted.
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 06:23 UTC · original

Item 2 is up as #2228 at bf9bf8bc. On one WARP device the info-queue probe counted one instance of warning 1361 for the restored ordinary ALWAYS descriptor and zero for the fixed ordinary descriptor. The border fallback and an actual comparison ALWAYS also produced zero, with no debug errors. The existing sampler-heap draws passed on WARP and hardware. The production diff changes only the ordinary comparison default in decode_sampler(), so the MIN_LOD/MAX_LOD work can use the existing LOD lines.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 06:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2221#issuecomment-7154740809) Item 2 is up as #2228 at `bf9bf8bc`. On one WARP device the [info-queue probe](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45559975104) counted one instance of warning 1361 for the restored ordinary `ALWAYS` descriptor and zero for the fixed ordinary descriptor. The border fallback and an actual comparison `ALWAYS` also produced zero, with no debug errors. The existing sampler-heap draws passed on WARP and hardware. The production diff changes only the ordinary comparison default in `decode_sampler()`, so the MIN_LOD/MAX_LOD work can use the existing LOD lines.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-25 06:53 UTC · original

Item 2 landed in #2228 (c35aa0c3). The Windows sampler suite passed 8/8 locally, including wrapped heap draws on WARP and RTX 4060 Laptop. The original info-queue A/B remains the direct warning 1361 evidence. Item 1 stays open under the existing LOD claim from roansystemlabs.

**@⁠R0Y00** on GitHub · 2026-11-25 06:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2221#issuecomment-7155265572) Item 2 landed in #2228 (c35aa0c3). The Windows sampler suite passed 8/8 locally, including wrapped heap draws on WARP and RTX 4060 Laptop. The original info-queue A/B remains the direct warning 1361 evidence. Item 1 stays open under the existing LOD claim from roansystemlabs.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#2221
No description provided.