textures: draw BC7 mip chains through the final texel #204
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!204
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/204/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?
@Vonsek on GitHub · 2026-11-21 18:21 UTC · original
Vonsek:codex/bc7-small-mips→main· +45 −7 · 4 files · 1 commits · merged 2026-11-21 18:24 UTCChange
Read each BC7 mip as a grid of complete 16-byte blocks and retain one reference color per logical texel. Both draw commands now accept mips down to 1×1. A rectangular chain can continue when one axis reaches one texel. The base texture still requires block-aligned dimensions. The tail command validates the supplied levels against the actual mip sequence, including its final level.
Verification
Base
d1f7c33, changecc1c1a9, Windows 11 x64 build 26200. Commands from the fresh worktree:Before the reader change, the WARP CTest failed with
Invalid single-level BC7 case dimensions or headerwhen the square chain reached its 2×2 mip. Before the CLI change, the 13-level strip returned exit code 2 at argument validation. With this commit both CTests and the direct WARP check passed. WARP 10.0.26100.9818 and the RTX 5080 on driver 32.0.16.1692 reported zero maximum absolute error on the 2×2 and 1×1 square mips, and on all 13 levels of the 4096×4 strip. Both adapters ran with the debug layer unavailable, with no skips.Evidence and follow-up
The MIT-licensed fixture builds mode-6 blocks in Python. Each generated strip has a distinct endpoint per mip and a known interpolated pattern inside each block. The check compares all four channels of every visible texel. The controls reject a repeated 1×1 level, an unaligned 2×1 base, and a stale red reference value at (0, 0) in the final mip.
The case layout and extent limits are recorded in the experiment notes. Microsoft describes logical versus physical mip dimensions in its block-compression guide.
AI-assisted contribution.
Checklist
@ -298,0 +302,4 @@{return (upper.width > 1 || upper.height > 1) &&lower.width == std::max<UINT>(1, upper.width / 2) &&lower.height == std::max<UINT>(1, upper.height / 2);@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 18:29 UTC · original
For a valid 188×4 chain down to 1×1, this now accepts the 2×1 penultimate level, but
draw_verifiedstill uses that level's logical dimensions as the viewport. With theFILTER_MIN_MAG_MIP_POINTsampler intests/pixel_aot_vs.hlsl, the implicit LOD islog2(188/2) ≈ 6.55, selecting mip 7 (1×1) while verification expects mip 6 (2×1). Correct compressed data therefore produces a falsepixel_mismatch. Adjust the LOD/viewport selection for rounded-down non-power-of-two mips and cover such a chain in the fixture.Useful? React with 👍 / 👎.
@ -317,3 +326,3 @@UINT first = 0;const auto parsed = std::from_chars(arg.data(), arg.data() + arg.size(), first);if (parsed.ec != std::errc{} || parsed.ptr != arg.data() + arg.size() || first > 10)if (parsed.ec != std::errc{} || parsed.ptr != arg.data() + arg.size() || first > 12)@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 18:29 UTC · original
For the new 4096×4 strip, supplying its 2×1 and 1×1 levels with first resident mip 11, or just its 1×1 level with first resident mip 12, passes this widened range check but fails the following bounds validation. Reconstructing both base axes with
level.width << firstandlevel.height << firstincorrectly expands the already-clamped height, yielding 4096×2048 or 4096×4096 and triggeringLogical BC7 texture exceeds fixture bounds. In fact, every mip-12 tail is rejected this way. Carry the logical base extents through validation and resource creation, or otherwise account for axes that have already clamped to one texel.Useful? React with 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 18:29 UTC · original
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
cc1c1a9ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@ -298,0 +302,4 @@{return (upper.width > 1 || upper.height > 1) &&lower.width == std::max<UINT>(1, upper.width / 2) &&lower.height == std::max<UINT>(1, upper.height / 2);@Vonsek on GitHub · 2026-11-21 18:41 UTC · original · edited 2026-11-21 18:42 UTC
Confirmed on the stated 188×4 chain. With the merged renderer, both WARP and an RTX 5080 reported the first mismatch at mip 6, pixel (0, 0), red 0.0627441 expected and 0.0313721 observed. A local change centers the unrounded viewport over the logical render target. With the same source-built blocks and shader, both adapters matched all eight channels at mip 6 and all four at mip 7. The local regression suite also checks 28×128 and 128×28 chains, including a view starting at mip 2. The follow-up is in #226.
@ -317,3 +326,3 @@UINT first = 0;const auto parsed = std::from_chars(arg.data(), arg.data() + arg.size(), first);if (parsed.ec != std::errc{} || parsed.ptr != arg.data() + arg.size() || first > 10)if (parsed.ec != std::errc{} || parsed.ptr != arg.data() + arg.size() || first > 12)@Vonsek on GitHub · 2026-11-21 18:41 UTC · original · edited 2026-11-21 19:13 UTC
Confirmed on WARP with the same source-built mip files. At commit
cc1c1a9the full 4096×4 chain through level 12 passed. Supplying only the 2×1 and 1×1 cases with first resident level 11, or only the 1×1 case with first resident level 12, returned exit code 1 withLogical BC7 texture exceeds fixture bounds. These are input-validation failures before texture creation. A 1×1 resident case and its mip index alone cannot distinguish a 4096×4 base from a 4×4096 base. Supporting both faithfully requires carrying the intended base dimensions through validation, resource creation and the fallback draws. The separate local viewport change addresses the first review finding only. The implementation is in #248. WARP and the RTX 5080 both verified the 4096×4 and 4×4096 fallback draws when given their respective base sizes, including when only the 1×1 mip was supplied.@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 18:29 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
cc1c1a920eℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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".