shader: lower image_sample_l and image_sample_b in gfx2hlsl (Part of #1723) #2038

Closed
tedin7 wants to merge 4 commits from upstream-pr/2045 into main
tedin7 commented 2026-11-24 23:37:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T23:37:44Z.


Part of #1723

What this unblocks: startup pixel shaders that use biased sampling (image_sample_b) now translate to SampleBias instead of stopping at "Unsupported".

image_sample_l was already lowered on main, so this change adds only image_sample_b.

Change

  • tools/startup/gfx2hlsl.py: image_sample_b shares the image_sample_l address handling. The bias is the last address register (after u, v and the slice or z). It becomes Texture.SampleBias(sampler, uv, bias).
    • The bias needs the implicit level, so outside straight-line pixel code with a known active lane it is refused by name. It is never sampled at level zero with the bias dropped.
    • Only dim, dmask and cache-policy bits (glc, slc, dlc) are accepted. unorm, a16, tfe, lwe, d16, r128, an empty dmask, 1D and cube are refused. Refusal messages name the real opcode.
    • The image_sample_l messages are unchanged.
  • tests/startup_image_sample_b_check.py, registered in CMakeLists.txt as startup_image_sample_b: reuses the recorded image_sample_l stages with only the MIMG opcode changed (0x24 to 0x25). It checks the bias register for 2D, NSA, 3D and 2D array, and the refusals.

Verification

Run on the Linux worker (Python only, no GPU):

  • python3 -B tests/startup_image_sample_b_check.py on origin/main: fails (Unsupported: image_sample_b).
  • Same command with this change: startup_image_sample_b_check: ok.
  • python3 -B tests/startup_image_sample_l_check.py: PASS.
  • python3 -B tests/startup_image_sample_c_check.py, startup_image_sample_a16_check.py, startup_image_gather_lz_check.py, startup_sampler_heap_check.py: PASS.

Not run: Win2025 GPU/D3D12 commands. The new test is Python only, and tests/pixel_sample_lod_check.py already covers the bias on D3D12 for the other translator.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593639740 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T23:37:44Z. --- Part of #1723 What this unblocks: startup pixel shaders that use biased sampling (`image_sample_b`) now translate to `SampleBias` instead of stopping at "Unsupported". `image_sample_l` was already lowered on main, so this change adds only `image_sample_b`. ## Change - `tools/startup/gfx2hlsl.py`: `image_sample_b` shares the `image_sample_l` address handling. The bias is the last address register (after u, v and the slice or z). It becomes `Texture.SampleBias(sampler, uv, bias)`. - The bias needs the implicit level, so outside straight-line pixel code with a known active lane it is refused by name. It is never sampled at level zero with the bias dropped. - Only dim, dmask and cache-policy bits (glc, slc, dlc) are accepted. unorm, a16, tfe, lwe, d16, r128, an empty dmask, 1D and cube are refused. Refusal messages name the real opcode. - The `image_sample_l` messages are unchanged. - `tests/startup_image_sample_b_check.py`, registered in `CMakeLists.txt` as `startup_image_sample_b`: reuses the recorded `image_sample_l` stages with only the MIMG opcode changed (0x24 to 0x25). It checks the bias register for 2D, NSA, 3D and 2D array, and the refusals. ## Verification Run on the Linux worker (Python only, no GPU): - `python3 -B tests/startup_image_sample_b_check.py` on `origin/main`: fails (`Unsupported: image_sample_b`). - Same command with this change: `startup_image_sample_b_check: ok`. - `python3 -B tests/startup_image_sample_l_check.py`: PASS. - `python3 -B tests/startup_image_sample_c_check.py`, `startup_image_sample_a16_check.py`, `startup_image_gather_lz_check.py`, `startup_sampler_heap_check.py`: PASS. Not run: Win2025 GPU/D3D12 commands. The new test is Python only, and `tests/pixel_sample_lod_check.py` already covers the bias on D3D12 for the other translator. AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-25 00:05:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:42:22Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f97aa96eaf

ℹ️ 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:6049220939 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#pullrequestreview-6049220939). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:42:22Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `f97aa96eaf` <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>
tedin7 commented 2026-11-25 01:01:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:58:12Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049918966 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#pullrequestreview-6049918966). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:58:12Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-25 01:01:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:58:13Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049919218 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#pullrequestreview-6049919218). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:58:13Z. **Review:** COMMENTED --- _No description provided._
chatgpt-codex-connector[bot commented 2026-11-25 01:01:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:37:54Z.


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-24T23:42:24.692144Z f97aa96 PR opened
ℹ️ 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:7147619899 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#issuecomment-7147619899). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:37:54Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"f97aa96eaf16704e9362a8a0d2e2f266d0027f20","has_any_findings":true,"has_unresolved_findings":true,"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-24T23:42:24.692144Z">2026-11-24T23:42:24.692144Z</relative-time> | `f97aa96` | PR opened | <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>
denn0x commented 2026-11-25 01:02:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-25T00:26:41Z.


The bias is read from the wrong address register.

  • What the sources say. RDNA 2 ISA section 8.2.5 orders the MIMG address as { offset } { bias } { z-compare } { derivative } { body }, with the bias "One Dword float". The coordinates are the body, so the bias is the FIRST address register. That differs from image_sample_l, where the level is the last one. (#2051 also cites LLVM 15's sample_b intrinsic argument order to the same effect.)
  • What the PR does. With this PR, image_sample_b v[4:7], v[0:2], s[0:7], s[8:11] dmask:0xf dim:SQ_RSRC_IMG_2D becomes SampleBias(smp, float2(v0, v1), v2). The correct lowering is SampleBias(smp, float2(v1, v2), v0).
  • Why the test passes anyway. tests/startup_image_sample_b_check.py asserts the last-register reading (bias_register(...) == ('v0', 'v1', None, 'v2')), so it passes on the wrong semantics.
  • Overlap. #2051 covers the same item with the bias first, and also checks the NSA, array and 3D forms. I'd suggest keeping image_sample_l here only if it adds something #2051 and main do not already cover.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148516114 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#issuecomment-7148516114). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-25T00:26:41Z. --- The bias is read from the wrong address register. - **What the sources say.** RDNA 2 ISA section 8.2.5 orders the MIMG address as `{ offset } { bias } { z-compare } { derivative } { body }`, with the bias "One Dword float". The coordinates are the body, so the bias is the FIRST address register. That differs from `image_sample_l`, where the level is the last one. (#2051 also cites LLVM 15's `sample_b` intrinsic argument order to the same effect.) - **What the PR does.** With this PR, `image_sample_b v[4:7], v[0:2], s[0:7], s[8:11] dmask:0xf dim:SQ_RSRC_IMG_2D` becomes `SampleBias(smp, float2(v0, v1), v2)`. The correct lowering is `SampleBias(smp, float2(v1, v2), v0)`. - **Why the test passes anyway.** `tests/startup_image_sample_b_check.py` asserts the last-register reading (`bias_register(...) == ('v0', 'v1', None, 'v2')`), so it passes on the wrong semantics. - **Overlap.** #2051 covers the same item with the bias first, and also checks the NSA, array and 3D forms. I'd suggest keeping `image_sample_l` here only if it adds something #2051 and main do not already cover.
tedin7 commented 2026-11-25 01:02:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:38:25Z.


Fixed in 42becacd: image_sample_b now reads bias from the first address register per RDNA 2 ISA section 8.2.5, and the test was updated accordingly.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148722931 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#issuecomment-7148722931). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:38:25Z. --- Fixed in 42becacd: image_sample_b now reads bias from the first address register per RDNA 2 ISA section 8.2.5, and the test was updated accordingly.
chatgpt-codex-connector[bot commented 2026-11-25 01:02:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:42:22Z.

Code review location: tools/startup/gfx2hlsl.py; line 1251

@@ -1233,19 +1233,21 @@ def image(self, ops, mods, how):
         if one and (how != 'sample' or len(cs) != 1 or not dmask or any(not m.startswith(('dim:', 'dmask:')) for m in mods)):
             raise Unsupported('unverified 1D image sample address or modifiers')
         lod = None
-        if how == 'l':
+        if how in ('l', 'b'):
+            op_name = 'image_sample_' + how
             # Address dwords are the coordinates and then the explicit level; offsets, bias, clamp and derivatives
             # would add dwords or modifiers this lowering does not read, so they are refused. Only the cache-policy
             # bits (glc, slc, dlc), which never change the sampled value, are accepted next to dim and dmask;
             # unorm, r128, tfe, lwe, a16, d16 and reserved bits would each change the address, resource or result
             # layout and are refused by name.
             for m in mods:
                 if not (m.startswith(('dim:', 'dmask:')) or m in ('dlc', 'glc', 'slc')):
-                    raise Unsupported('image_sample_l modifier %s' % m)
+                    raise Unsupported('%s modifier %s' % (op_name, m))
             if dmask == 0:
-                raise Unsupported('image_sample_l with an empty dmask')
+                raise Unsupported('%s with an empty dmask' % op_name)
             if len(cs) != (4 if three else 3):
-                raise Unsupported('image_sample_l with %d address registers' % len(cs))
+                raise Unsupported('%s with %d address registers' % (op_name, len(cs)))
+            # image_sample_b carries the bias where image_sample_l carries the level: the last address register.
             lod, cs = cs[-1], cs[:-1]

P1 Badge Read the image_sample_b bias from the first address register

For gfx1013 image_sample_b, the address layout is (bias, u, v[, z/slice]), not coordinates followed by bias; the existing lowering in tools/pixel_aot.py:4507–4514 also uses this order. The new plain fixture should therefore sample (v1, v2) with bias v0, but this shared extraction emits (v0, v1) with bias v2. Newly accepted shaders consequently sample the wrong coordinates and mip, including the NSA, 3D, and array forms. Extract the first component for 'b' while retaining the last for 'l', and correct the new test assertions that currently enforce the wrong order.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688109976 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#discussion_r4688109976). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:42:22Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 1251 ~~~~diff @@ -1233,19 +1233,21 @@ def image(self, ops, mods, how): if one and (how != 'sample' or len(cs) != 1 or not dmask or any(not m.startswith(('dim:', 'dmask:')) for m in mods)): raise Unsupported('unverified 1D image sample address or modifiers') lod = None - if how == 'l': + if how in ('l', 'b'): + op_name = 'image_sample_' + how # Address dwords are the coordinates and then the explicit level; offsets, bias, clamp and derivatives # would add dwords or modifiers this lowering does not read, so they are refused. Only the cache-policy # bits (glc, slc, dlc), which never change the sampled value, are accepted next to dim and dmask; # unorm, r128, tfe, lwe, a16, d16 and reserved bits would each change the address, resource or result # layout and are refused by name. for m in mods: if not (m.startswith(('dim:', 'dmask:')) or m in ('dlc', 'glc', 'slc')): - raise Unsupported('image_sample_l modifier %s' % m) + raise Unsupported('%s modifier %s' % (op_name, m)) if dmask == 0: - raise Unsupported('image_sample_l with an empty dmask') + raise Unsupported('%s with an empty dmask' % op_name) if len(cs) != (4 if three else 3): - raise Unsupported('image_sample_l with %d address registers' % len(cs)) + raise Unsupported('%s with %d address registers' % (op_name, len(cs))) + # image_sample_b carries the bias where image_sample_l carries the level: the last address register. lod, cs = cs[-1], cs[:-1] ~~~~ --- **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Read the image_sample_b bias from the first address register** For gfx1013 `image_sample_b`, the address layout is `(bias, u, v[, z/slice])`, not coordinates followed by bias; the existing lowering in `tools/pixel_aot.py:4507–4514` also uses this order. The new `plain` fixture should therefore sample `(v1, v2)` with bias `v0`, but this shared extraction emits `(v0, v1)` with bias `v2`. Newly accepted shaders consequently sample the wrong coordinates and mip, including the NSA, 3D, and array forms. Extract the first component for `'b'` while retaining the last for `'l'`, and correct the new test assertions that currently enforce the wrong order. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-25 01:02:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:42:22Z.

Code review location: tools/startup/gfx2hlsl.py; line 1398

@@ -1386,6 +1394,9 @@ def op_image_sample_lz(self, ops, mods):
     def op_image_sample_l(self, ops, mods):
         self.image(ops, mods, 'l')
 
+    def op_image_sample_b(self, ops, mods):
+        self.image(ops, mods, 'b')

P1 Badge Document the new startup biased-sampling capability

Adding image_sample_b support changes a public translator capability, but this commit updates neither README.md nor docs/experiments.md, contrary to the root AGENTS.md requirement. The startup experiment documentation does not record this new path's supported dimensions, straight-line pixel-stage restriction, reproduction command, or Python-only verification status. Update the relevant startup experiment section so contributors can discover and reproduce the capability without relying on the commit message.

AGENTS.md reference: AGENTS.md:L211-L212

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688109982 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#discussion_r4688109982). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:42:22Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 1398 ~~~~diff @@ -1386,6 +1394,9 @@ def op_image_sample_lz(self, ops, mods): def op_image_sample_l(self, ops, mods): self.image(ops, mods, 'l') + def op_image_sample_b(self, ops, mods): + self.image(ops, mods, 'b') ~~~~ --- **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Document the new startup biased-sampling capability** Adding `image_sample_b` support changes a public translator capability, but this commit updates neither `README.md` nor `docs/experiments.md`, contrary to the root `AGENTS.md` requirement. The startup experiment documentation does not record this new path's supported dimensions, straight-line pixel-stage restriction, reproduction command, or Python-only verification status. Update the relevant startup experiment section so contributors can discover and reproduce the capability without relying on the commit message. AGENTS.md reference: [AGENTS.md:L211-L212](https://github.com/R0Y00/Xbox2Windows/blob/f97aa96eaf16704e9362a8a0d2e2f266d0027f20/AGENTS.md#L211-L212) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
tedin7 commented 2026-11-25 01:02:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:58:12Z.

Code review location: tools/startup/gfx2hlsl.py; line 1251

@@ -1233,19 +1233,21 @@ def image(self, ops, mods, how):
         if one and (how != 'sample' or len(cs) != 1 or not dmask or any(not m.startswith(('dim:', 'dmask:')) for m in mods)):
             raise Unsupported('unverified 1D image sample address or modifiers')
         lod = None
-        if how == 'l':
+        if how in ('l', 'b'):
+            op_name = 'image_sample_' + how
             # Address dwords are the coordinates and then the explicit level; offsets, bias, clamp and derivatives
             # would add dwords or modifiers this lowering does not read, so they are refused. Only the cache-policy
             # bits (glc, slc, dlc), which never change the sampled value, are accepted next to dim and dmask;
             # unorm, r128, tfe, lwe, a16, d16 and reserved bits would each change the address, resource or result
             # layout and are refused by name.
             for m in mods:
                 if not (m.startswith(('dim:', 'dmask:')) or m in ('dlc', 'glc', 'slc')):
-                    raise Unsupported('image_sample_l modifier %s' % m)
+                    raise Unsupported('%s modifier %s' % (op_name, m))
             if dmask == 0:
-                raise Unsupported('image_sample_l with an empty dmask')
+                raise Unsupported('%s with an empty dmask' % op_name)
             if len(cs) != (4 if three else 3):
-                raise Unsupported('image_sample_l with %d address registers' % len(cs))
+                raise Unsupported('%s with %d address registers' % (op_name, len(cs)))
+            # image_sample_b carries the bias where image_sample_l carries the level: the last address register.
             lod, cs = cs[-1], cs[:-1]

Fixed in fe23a5b3 (bias now read from the first address register; WARP draw test added in fff7d500, rebased on current main, push pending). Verified locally: tests/startup_image_sample_b_check.py and all startup_gfx2hlsl_*_check.py pass. AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688736601 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#discussion_r4688736601). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:58:12Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 1251 ~~~~diff @@ -1233,19 +1233,21 @@ def image(self, ops, mods, how): if one and (how != 'sample' or len(cs) != 1 or not dmask or any(not m.startswith(('dim:', 'dmask:')) for m in mods)): raise Unsupported('unverified 1D image sample address or modifiers') lod = None - if how == 'l': + if how in ('l', 'b'): + op_name = 'image_sample_' + how # Address dwords are the coordinates and then the explicit level; offsets, bias, clamp and derivatives # would add dwords or modifiers this lowering does not read, so they are refused. Only the cache-policy # bits (glc, slc, dlc), which never change the sampled value, are accepted next to dim and dmask; # unorm, r128, tfe, lwe, a16, d16 and reserved bits would each change the address, resource or result # layout and are refused by name. for m in mods: if not (m.startswith(('dim:', 'dmask:')) or m in ('dlc', 'glc', 'slc')): - raise Unsupported('image_sample_l modifier %s' % m) + raise Unsupported('%s modifier %s' % (op_name, m)) if dmask == 0: - raise Unsupported('image_sample_l with an empty dmask') + raise Unsupported('%s with an empty dmask' % op_name) if len(cs) != (4 if three else 3): - raise Unsupported('image_sample_l with %d address registers' % len(cs)) + raise Unsupported('%s with %d address registers' % (op_name, len(cs))) + # image_sample_b carries the bias where image_sample_l carries the level: the last address register. lod, cs = cs[-1], cs[:-1] ~~~~ --- Fixed in fe23a5b3 (bias now read from the first address register; WARP draw test added in fff7d500, rebased on current main, push pending). Verified locally: tests/startup_image_sample_b_check.py and all startup_gfx2hlsl_*_check.py pass. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 01:02:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:58:13Z.

Code review location: tools/startup/gfx2hlsl.py; line 1398

@@ -1386,6 +1394,9 @@ def op_image_sample_lz(self, ops, mods):
     def op_image_sample_l(self, ops, mods):
         self.image(ops, mods, 'l')
 
+    def op_image_sample_b(self, ops, mods):
+        self.image(ops, mods, 'b')

Docs already cover this path in docs/experiments.md (startup section: image_sample_b, first-register bias, SampleBias lowering, 2D/single-channel/straight-line limits, refused forms). Nothing further needed in fff7d500. AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688736835 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#discussion_r4688736835). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:58:13Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 1398 ~~~~diff @@ -1386,6 +1394,9 @@ def op_image_sample_lz(self, ops, mods): def op_image_sample_l(self, ops, mods): self.image(ops, mods, 'l') + def op_image_sample_b(self, ops, mods): + self.image(ops, mods, 'b') ~~~~ --- Docs already cover this path in docs/experiments.md (startup section: image_sample_b, first-register bias, SampleBias lowering, 2D/single-channel/straight-line limits, refused forms). Nothing further needed in fff7d500. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 08:04:41 +00:00
tedin7 commented 2026-11-25 08:05:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T07:28:08Z.


Closing as superseded: image_sample_b and image_sample_l are already on main via #2051.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7155893517 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2045#issuecomment-7155893517). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T07:28:08Z. --- Closing as superseded: `image_sample_b` and `image_sample_l` are already on `main` via #2051.

Pull request closed

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!2038
No description provided.