textures: accept logical dimensions for late BC7 tails #245

Merged
Vonsek merged 2 commits from upstream-pr/248 into main 2026-11-21 19:57:26 +00:00
Vonsek commented 2026-11-21 19:13:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T19:13:20Z.


Change

Add an optional --base-size WIDTH HEIGHT to the BC7 tail draw. This lets the caller supply the logical resource size when a late mip has already clamped to one texel on an axis. The terminal 1×1 case can represent either a 4096×4 texture or a 4×4096 texture. Both now work with their respective explicit dimensions. Existing commands retain the original size inference. Addresses the late-tail finding on #204.

The declared size determines the resource allocation and each fallback render target. The check rejects an absent mip or first-resident dimensions inconsistent with the declared texture. Point-sampled references use the visible pixel center, including when the source and target dimensions have a non-integer ratio.

Verification

Tested commits 4843327 and fb43669 on merged upstream base 64e8d0e, Windows 11 x64 build 26200, Python 3.12.10:

python -m venv out/pe-env
.\out\pe-env\Scripts\python.exe -m pip install -r requirements-dev.txt
. ./tools/dev.ps1
$latePython = (Resolve-Path out/pe-env/Scripts/python.exe).Path
cmake --fresh --preset dev "-DINTAKE_PYTHON=$latePython"
cmake --build --preset dev --target offscreen_check --parallel 4
ctest --preset dev --no-tests=error -R '^(bc7_draw|pixel_aot)_(hardware|warp)$' -V
$lateDxc = (Get-Command dxc.exe).Source
.\out\pe-env\Scripts\python.exe -B tests/bc7_draw_check.py $lateDxc out/build/dev/offscreen_check.exe warp

Before the change, the 2×1 and 1×1 cases from a 4096×4 chain at first resident level 11, or its 1×1 case alone at level 12, both failed with Logical BC7 texture exceeds fixture bounds. The new WARP regression failed on the old CLI. On the rebased change all four focused CTests and the direct WARP test passed. With explicit dimensions, both WARP 10.0.26100.9818 and the RTX 5080 on driver 32.0.16.1692 matched the 16,384-pixel fallback and every resident draw. Both also passed the transposed orientation and a 116×76 texture beginning at mip 3. In the 29×19 fallback, WARP and hardware selected opposite neighbors at the exact source texel boundary at (14, 0). Both accepted their own complete texel and rejected a control shader mixing red/blue from the left neighbor with green/alpha from the right at just that pixel. Debug layers were unavailable; neither backend skipped.

At 92×4 with first resident mip 5, the original viewport failed the terminal 1×1 readback on WARP. Scaling only from the 2×1 resident extent failed the preceding 2×1 readback on RTX 5080. Commit fb43669 centers the viewport span between both derivative estimates in log space. The unchanged translated shader uses implicit Texture2D.Sample. Both adapters matched each magnified fallback and both native levels for 92×4 and 4×92. All four focused CTests and the direct WARP check passed. Review measurements.

Evidence and follow-up

The MIT-licensed fixture builds each mip from a repeated mode-6 BC7 block and independently generated reference colors. Distinct endpoints and per-texel indices distinguish level selection and sample position. Negative controls require rejection of mip 12 for a 4×4 base and of a 1×2 first level for a 4096×4 texture at mip 11. The test supplies the base dimensions explicitly. This experiment uses source-built textures and makes no claim about any installation.

AI-assisted contribution.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for the fixture checks.
  • I considered a negative control or failure case for a new fixture.
  • I documented the optional CLI arguments.
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6533246592 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/248). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T19:13:20Z. --- ## Change Add an optional `--base-size WIDTH HEIGHT` to the BC7 tail draw. This lets the caller supply the logical resource size when a late mip has already clamped to one texel on an axis. The terminal 1×1 case can represent either a 4096×4 texture or a 4×4096 texture. Both now work with their respective explicit dimensions. Existing commands retain the original size inference. Addresses [the late-tail finding on #204](https://github.com/R0Y00/Xbox2Windows/pull/204#discussion_r4654299987). The declared size determines the resource allocation and each fallback render target. The check rejects an absent mip or first-resident dimensions inconsistent with the declared texture. Point-sampled references use the visible pixel center, including when the source and target dimensions have a non-integer ratio. ## Verification Tested commits `4843327` and `fb43669` on merged upstream base `64e8d0e`, Windows 11 x64 build 26200, Python 3.12.10: ```powershell python -m venv out/pe-env .\out\pe-env\Scripts\python.exe -m pip install -r requirements-dev.txt . ./tools/dev.ps1 $latePython = (Resolve-Path out/pe-env/Scripts/python.exe).Path cmake --fresh --preset dev "-DINTAKE_PYTHON=$latePython" cmake --build --preset dev --target offscreen_check --parallel 4 ctest --preset dev --no-tests=error -R '^(bc7_draw|pixel_aot)_(hardware|warp)$' -V $lateDxc = (Get-Command dxc.exe).Source .\out\pe-env\Scripts\python.exe -B tests/bc7_draw_check.py $lateDxc out/build/dev/offscreen_check.exe warp ``` Before the change, the 2×1 and 1×1 cases from a 4096×4 chain at first resident level 11, or its 1×1 case alone at level 12, both failed with `Logical BC7 texture exceeds fixture bounds`. The new WARP regression failed on the old CLI. On the rebased change all four focused CTests and the direct WARP test passed. With explicit dimensions, both WARP 10.0.26100.9818 and the RTX 5080 on driver 32.0.16.1692 matched the 16,384-pixel fallback and every resident draw. Both also passed the transposed orientation and a 116×76 texture beginning at mip 3. In the 29×19 fallback, WARP and hardware selected opposite neighbors at the exact source texel boundary at (14, 0). Both accepted their own complete texel and rejected a control shader mixing red/blue from the left neighbor with green/alpha from the right at just that pixel. Debug layers were unavailable; neither backend skipped. At 92×4 with first resident mip 5, the original viewport failed the terminal 1×1 readback on WARP. Scaling only from the 2×1 resident extent failed the preceding 2×1 readback on RTX 5080. Commit `fb43669` centers the viewport span between both derivative estimates in log space. The unchanged translated shader uses implicit `Texture2D.Sample`. Both adapters matched each magnified fallback and both native levels for 92×4 and 4×92. All four focused CTests and the direct WARP check passed. [Review measurements](https://github.com/R0Y00/Xbox2Windows/pull/248#discussion_r4654574273). ## Evidence and follow-up The MIT-licensed fixture builds each mip from a repeated mode-6 BC7 block and independently generated reference colors. Distinct endpoints and per-texel indices distinguish level selection and sample position. Negative controls require rejection of mip 12 for a 4×4 base and of a 1×2 first level for a 4096×4 texture at mip 11. The test supplies the base dimensions explicitly. This experiment uses source-built textures and makes no claim about any installation. AI-assisted contribution. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for the fixture checks. - [x] I considered a negative control or failure case for a new fixture. - [x] I documented the optional CLI arguments. - [x] I did not include game files, dumps, distribution links or secrets.
upstream-sync closed this pull request 2026-11-24 06:42:01 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:42:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T19:21:53Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 484332760f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6007657599 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/248#pullrequestreview-6007657599). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T19:21:53Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `484332760f` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
Vonsek commented 2026-11-24 06:42:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T19:26:16Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6007672894 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/248#pullrequestreview-6007672894). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T19:26:16Z. **Review:** COMMENTED --- _No description provided._
denn0x commented 2026-11-24 06:47:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-21T19:16:09Z.


Independent run at 4843327 (on 64e8d0e) on an AMD GPU, to add RDNA 4 next to the RTX 5080 and WARP results.

Environment: Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, D3D12 debug layer enabled.

  • AMD Radeon RX 9070 XT (vendor 1002, device 7550), driver 32.0.32015.7029
  • WARP: Microsoft Basic Render Driver 10.0.26100.9818
ctest --preset dev --no-tests=error -R '^(bc7_draw|pixel_aot)_(hardware|warp)$' -V
1/4 Test #102: pixel_aot_hardware ...............   Passed    6.24 sec
2/4 Test #103: bc7_draw_hardware ................   Passed    4.70 sec
3/4 Test #105: pixel_aot_warp ...................   Passed    2.31 sec
4/4 Test #106: bc7_draw_warp ....................   Passed    1.46 sec
100% tests passed, 0 tests failed out of 4

Every resident and fallback draw in bc7_draw_hardware reported max_absolute_error=0 and debug_errors=0 debug_warnings=0. That run includes:

  • the --base-size 4096×4 and 4×4096 late tails at first resident levels 11 and 12;
  • the 116×76 texture starting at mip 3, with the 29×19 exact-boundary draw and its mixed-texel control;
  • the transposed-dimension rejection.

Not measured: which neighbour the RX 9070 XT picks at the exact tie at (14, 0). The check accepts either complete texel and does not print the choice.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7067895571 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/248#issuecomment-7067895571). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-21T19:16:09Z. --- Independent run at `4843327` (on `64e8d0e`) on an AMD GPU, to add RDNA 4 next to the RTX 5080 and WARP results. **Environment:** Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, D3D12 debug layer enabled. - AMD Radeon RX 9070 XT (vendor 1002, device 7550), driver 32.0.32015.7029 - WARP: Microsoft Basic Render Driver 10.0.26100.9818 ```powershell ctest --preset dev --no-tests=error -R '^(bc7_draw|pixel_aot)_(hardware|warp)$' -V ``` ```text 1/4 Test #102: pixel_aot_hardware ............... Passed 6.24 sec 2/4 Test #103: bc7_draw_hardware ................ Passed 4.70 sec 3/4 Test #105: pixel_aot_warp ................... Passed 2.31 sec 4/4 Test #106: bc7_draw_warp .................... Passed 1.46 sec 100% tests passed, 0 tests failed out of 4 ``` Every resident and fallback draw in `bc7_draw_hardware` reported `max_absolute_error=0` and `debug_errors=0 debug_warnings=0`. That run includes: - the `--base-size` 4096×4 and 4×4096 late tails at first resident levels 11 and 12; - the 116×76 texture starting at mip 3, with the 29×19 exact-boundary draw and its mixed-texel control; - the transposed-dimension rejection. Not measured: which neighbour the RX 9070 XT picks at the exact tie at (14, 0). The check accepts either complete texel and does not print the choice. _AI-assisted (Claude Code)._
Vonsek commented 2026-11-24 06:47:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T19:28:36Z.


@codex review

Please recheck the implicit mip selection finding against fb43669. The regression now covers both resident levels of 92×4 and 4×92 on WARP and RTX 5080. Before-and-after readbacks.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7068048185 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/248#issuecomment-7068048185). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T19:28:36Z. --- @codex review Please recheck the implicit mip selection finding against `fb43669`. The regression now covers both resident levels of 92×4 and 4×92 on WARP and RTX 5080. [Before-and-after readbacks](https://github.com/R0Y00/Xbox2Windows/pull/248#discussion_r4654574273).
chatgpt-codex-connector[bot commented 2026-11-24 06:47:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T19:32:19Z.


Codex Review: Didn't find any major issues. 👍

Reviewed commit: fb436695d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7068092933 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/248#issuecomment-7068092933). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T19:32:19Z. --- <!-- codex-review-receipt:v1 --> Codex Review: Didn't find any major issues. :+1: **Reviewed commit:** `fb436695d2` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot commented 2026-11-24 06:47:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T19:13:28Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T19:32:20.778319Z fb43669 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7067858084 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/248#issuecomment-7067858084). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T19:13:28Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"fb436695d2eff0f2ecb7e3a5cc1cab482145f6e7","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-21T19:32:20.778319Z">2026-11-21T19:32:20.778319Z</relative-time> | `fb43669` | Manual request | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
chatgpt-codex-connector[bot commented 2026-11-24 06:50:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T19:21:53Z.

Code review location: tests/pixel_aot_render.cpp; line 193

@@ -181,9 +188,9 @@ void draw_verified(ID3D12Device* device, const char* path, const std::vector<Pix
         // Keep the implicit derivatives at the requested mip even when its
         // logical dimensions round down. Center the fractional viewport so
         // each visible pixel still point-samples its corresponding texel.
-        const float mipScale = std::ldexp(float(req.scale), -static_cast<int>(req.sampledLevel));
-        const float viewportWidth = (std::max)(float(width), input.width * mipScale);
-        const float viewportHeight = (std::max)(float(height), input.height * mipScale);
+        const float mipScale = std::ldexp(1.0f, -static_cast<int>(firstResident + req.sampledLevel));
+        const float viewportWidth = (std::max)(float(width), base.width * mipScale);
+        const float viewportHeight = (std::max)(float(height), base.height * mipScale);

P2 Badge Scale native-draw derivatives from the first resident mip

For a tail starting at mip 5 with --base-size 92 4 and valid 2×1 and 1×1 cases, the SRV begins at a rounded 2×1 mip, but the terminal draw now uses a 1.4375×1 viewport. Implicit LOD is based on the SRV's first visible extent, so the point mip filter gets log2(2 / 1.4375) ≈ 0.476 and selects resident level 0 instead of level 1. The verifier consequently compares the wrong mip against the 1×1 reference and rejects a correct copy shader. Keep the declared base for resource and target dimensions, but derive the derivative-preserving viewport from the first resident extent and the relative sampled level.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4654559504 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/248#discussion_r4654559504). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T19:21:53Z. **Code review location:** `tests/pixel_aot_render.cpp`; line 193 ~~~~diff @@ -181,9 +188,9 @@ void draw_verified(ID3D12Device* device, const char* path, const std::vector<Pix // Keep the implicit derivatives at the requested mip even when its // logical dimensions round down. Center the fractional viewport so // each visible pixel still point-samples its corresponding texel. - const float mipScale = std::ldexp(float(req.scale), -static_cast<int>(req.sampledLevel)); - const float viewportWidth = (std::max)(float(width), input.width * mipScale); - const float viewportHeight = (std::max)(float(height), input.height * mipScale); + const float mipScale = std::ldexp(1.0f, -static_cast<int>(firstResident + req.sampledLevel)); + const float viewportWidth = (std::max)(float(width), base.width * mipScale); + const float viewportHeight = (std::max)(float(height), base.height * mipScale); ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Scale native-draw derivatives from the first resident mip** For a tail starting at mip 5 with `--base-size 92 4` and valid `2×1` and `1×1` cases, the SRV begins at a rounded `2×1` mip, but the terminal draw now uses a `1.4375×1` viewport. Implicit LOD is based on the SRV's first visible extent, so the point mip filter gets `log2(2 / 1.4375) ≈ 0.476` and selects resident level 0 instead of level 1. The verifier consequently compares the wrong mip against the `1×1` reference and rejects a correct copy shader. Keep the declared base for resource and target dimensions, but derive the derivative-preserving viewport from the first resident extent and the relative sampled level. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Vonsek commented 2026-11-24 06:50:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T19:26:16Z.

Code review location: tests/pixel_aot_render.cpp; line 193

@@ -181,9 +188,9 @@ void draw_verified(ID3D12Device* device, const char* path, const std::vector<Pix
         // Keep the implicit derivatives at the requested mip even when its
         // logical dimensions round down. Center the fractional viewport so
         // each visible pixel still point-samples its corresponding texel.
-        const float mipScale = std::ldexp(float(req.scale), -static_cast<int>(req.sampledLevel));
-        const float viewportWidth = (std::max)(float(width), input.width * mipScale);
-        const float viewportHeight = (std::max)(float(height), input.height * mipScale);
+        const float mipScale = std::ldexp(1.0f, -static_cast<int>(firstResident + req.sampledLevel));
+        const float viewportWidth = (std::max)(float(width), base.width * mipScale);
+        const float viewportHeight = (std::max)(float(height), base.height * mipScale);

Confirmed on WARP with the source-built 92×4 texture at first resident mip 5. On 4843327, mip 5 matched, then mip 6 returned red 0.113708 at (0, 0) against the 1×1 reference value 0.0313721. The same draw passed on RTX 5080. I also tried the resident-only viewport. That passed on WARP, but RTX then selected mip 6 during the mip 5 draw, returning 0.0313721 against 0.0627441.

fb43669 centers the viewport span midway in log space between the rounded first-resident extent and the unrounded base-derived extent. The translated copy shader still uses implicit Texture2D.Sample. On both WARP and RTX 5080, each of the five magnified fallbacks and both native draws now matched every RGBA channel for 92×4 and 4×92. The regression checks both orientations with distinct adjacent mip colors. The existing mixed-texel negative control and all four BC7/pixel WARP/hardware CTests also passed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4654574273 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/248#discussion_r4654574273). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T19:26:16Z. **Code review location:** `tests/pixel_aot_render.cpp`; line 193 ~~~~diff @@ -181,9 +188,9 @@ void draw_verified(ID3D12Device* device, const char* path, const std::vector<Pix // Keep the implicit derivatives at the requested mip even when its // logical dimensions round down. Center the fractional viewport so // each visible pixel still point-samples its corresponding texel. - const float mipScale = std::ldexp(float(req.scale), -static_cast<int>(req.sampledLevel)); - const float viewportWidth = (std::max)(float(width), input.width * mipScale); - const float viewportHeight = (std::max)(float(height), input.height * mipScale); + const float mipScale = std::ldexp(1.0f, -static_cast<int>(firstResident + req.sampledLevel)); + const float viewportWidth = (std::max)(float(width), base.width * mipScale); + const float viewportHeight = (std::max)(float(height), base.height * mipScale); ~~~~ --- Confirmed on WARP with the source-built 92×4 texture at first resident mip 5. On 4843327, mip 5 matched, then mip 6 returned red 0.113708 at (0, 0) against the 1×1 reference value 0.0313721. The same draw passed on RTX 5080. I also tried the resident-only viewport. That passed on WARP, but RTX then selected mip 6 during the mip 5 draw, returning 0.0313721 against 0.0627441. fb43669 centers the viewport span midway in log space between the rounded first-resident extent and the unrounded base-derived extent. The translated copy shader still uses implicit `Texture2D.Sample`. On both WARP and RTX 5080, each of the five magnified fallbacks and both native draws now matched every RGBA channel for 92×4 and 4×92. The regression checks both orientations with distinct adjacent mip colors. The existing mixed-texel negative control and all four BC7/pixel WARP/hardware CTests also passed locally.
Sign in to join this conversation.
No reviewers
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!245
No description provided.