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

Closed
opened 2026-11-25 05:47:07 +00:00 by roansystemlabs · 5 comments
roansystemlabs commented 2026-11-25 05:47:07 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T05:47:07Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6598117236 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2221). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-25T05:47:07Z. --- `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.
RavenCurseBurg commented 2026-11-25 07:01:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T06:16:09Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154616166 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2221#issuecomment-7154616166). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T06:16:09Z. --- 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.
R0Y00 commented 2026-11-25 07:01:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T06:16:26Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154621222 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2221#issuecomment-7154621222). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T06:16:26Z. --- 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.
roansystemlabs commented 2026-11-25 07:01:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T06:18:38Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154658609 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2221#issuecomment-7154658609). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-25T06:18:38Z. --- 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.
RavenCurseBurg commented 2026-11-25 07:01:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T06:23:26Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154740809 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2221#issuecomment-7154740809). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T06:23:26Z. --- 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.
R0Y00 commented 2026-11-25 07:01:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T06:53:28Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7155265572 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2221#issuecomment-7155265572). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T06:53:28Z. --- 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.
Sign in to join this conversation.
No labels
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.

Reference
R0Y00/Xbox2Windows#2213
No description provided.