Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1d19671
rdna2spirv: --explicit-lod-bias applies the S# LOD bias in the shader…
Tauwni Nov 25, 2026
66b27ac
lod_bias_probe: measure whether the sampler applies mipLodBias instea…
Tauwni Nov 25, 2026
a03715c
vk_subgroup_info --lod-bias: measure mipLodBias with one compute disp…
Tauwni Nov 25, 2026
98b22ae
ps_ssharp_ld, ps_ssharp_b: the S# mip fields on image_sample_l, _d an…
Tauwni Nov 25, 2026
ff2e459
vk_sampler_test --cube/--3d/--dref; ps_ssharp_cube, ps_ssharp_3d, ps_…
Tauwni Nov 25, 2026
631a538
ps_ssharp_o: the S# mip fields on image_sample_lz_o / image_sample_o …
Tauwni Nov 25, 2026
b145659
Merge remote-tracking branch 'origin/main' into fix/explicit-lod-bias…
Tauwni Nov 25, 2026
3fc6184
make_game: drop the unreachable second try in runtime_gpu_explicit_lo…
Tauwni Nov 25, 2026
1787a81
vk_lod_bias: control read at explicit LOD 1 must return 1.0, else nul…
Tauwni Nov 26, 2026
85eac6b
rdna2spirv: --explicit-lod-bias clamps image_sample_cl / _c_cl outsid…
Tauwni Nov 26, 2026
eb464f2
docs/design.md: the 27.0 M3 checked the draw probe; the LOD 1 control…
Tauwni Nov 26, 2026
a88bb83
Merge remote-tracking branch 'origin/main' into fix/explicit-lod-bias…
Tauwni Nov 26, 2026
743eda0
vk_sampler_test: --cube / --3d tag the T# entry with the array the te…
Tauwni Nov 26, 2026
bcf1997
design.md: the 27.0 M3 reran the compute probe and ps_ssharp at 743ed…
Tauwni Nov 26, 2026
5c702e2
design.md: the M5 (macOS 26.6.2) probe answers false and ps_ssharp pa…
Tauwni Nov 26, 2026
0dcf650
Merge remote-tracking branch 'origin/main' into fix/explicit-lod-bias…
Tauwni Nov 26, 2026
27524a5
Merge remote-tracking branch 'origin/main' into fix/explicit-lod-bias…
Tauwni Nov 28, 2026
9d9d085
CI macOS: ps_ssharp passes with --explicit-lod-bias, drop it from the…
Tauwni Nov 28, 2026
3a7dc61
Merge remote-tracking branch 'origin/main' into fix/explicit-lod-bias…
Tauwni Nov 28, 2026
f238fb2
Merge remote-tracking branch 'refs/remotes/origin/main' into HEAD
Tauwni Nov 28, 2026
05a0f7f
Merge remote-tracking branch 'refs/remotes/origin/main' into fix/expl…
Tauwni Nov 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ on:
- "tools/gen_d3d12_stubs.py"
- "tools/gfx10_formats.json"
- "tools/lane_masks.py"
- "tools/lod_bias_probe.py"
- "tools/mc_command.py"
- "tools/mesh_compute_vs.py"
- "tools/native_pso_hashes.py"
Expand All @@ -59,6 +60,7 @@ on:
- "tools/spirv_loop_guard.py"
- "tools/spirv_opt.py"
- "tools/spirv_stubs.py"
- "tools/vk_lod_bias.py"
- "tools/vk_subgroup_info.py"
- "tools/wave64_emulate_opt.py"
- "tools/wave64_halves.py"
Expand Down Expand Up @@ -91,6 +93,7 @@ on:
- "tools/gen_d3d12_stubs.py"
- "tools/gfx10_formats.json"
- "tools/lane_masks.py"
- "tools/lod_bias_probe.py"
- "tools/mc_command.py"
- "tools/mesh_compute_vs.py"
- "tools/native_pso_hashes.py"
Expand All @@ -111,6 +114,7 @@ on:
- "tools/spirv_loop_guard.py"
- "tools/spirv_opt.py"
- "tools/spirv_stubs.py"
- "tools/vk_lod_bias.py"
- "tools/vk_subgroup_info.py"
- "tools/wave64_emulate_opt.py"
- "tools/wave64_halves.py"
Expand Down Expand Up @@ -596,9 +600,9 @@ jobs:
if: ${{ !cancelled() && steps.macos-build.outcome == 'success' }} # also after a runtime test failure
shell: bash
env:
# ps_ssharp: #1845 (the S#'s LOD bias, which a Metal sampler can't take).
EXPECTED_FAILURES: >-
ps_ssharp
# Nothing expected to fail: ps_ssharp (#1845) passes since --explicit-lod-bias, and main
# dropped cs_fma_fused.
EXPECTED_FAILURES: ""
run: |
set +e
python3 -I scripts/run_gpu_tests.py --build runtime/build --llvm-mc "$LLVM_MC" --work "$RUNNER_TEMP/gpu" 2>&1 |
Expand Down
1 change: 1 addition & 0 deletions docs/design.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ game's device ignores it`, so leaving them set cannot slow a game down (`run_tin
| `cs_w32_salu64` gives eight wrong words on RDNA1 under RADV Mesa 25.2.8 (`0x1E6A2C48 0x1234 0 0x100 47 48 0xFFFF8000 0xFFFFFFFE`, where word 2 should be `0xFFFFFFFF`) | Only the high word of the `s_bfe_i64` result is wrong. The same words appear on four pinned V540s (Navi 12, PCI `1002:7360`) and on a clean upstream/main worktree, and three different valid SPIR-V sign-extension formulations give the same result while the CPU interpreter matches, so this is the driver version rather than the translator (SHADER-276) | Expected with Mesa 25.2.8; the fixture passes on NVIDIA and on AMD's Windows driver. Try a newer Mesa before treating it as a translator bug; do not weaken the fixture's expectation |
| `d3d12_typeless_rtv` fails its WARP comparison on an AMD desktop iGPU (TEST-591) | [Reported on the Ryzen 5 7600X iGPU with Windows 10 build 19045 and AMD 23.40.02](https://github.com/ItsNotRexed/Leonida/issues/166#issuecomment-7083403389). The exact cause is still open. | Retest on a newer Windows and AMD driver combination. Passing results were reported on the [Ryzen 9 7900 iGPU with AMD 25.10.30.02](https://github.com/ItsNotRexed/Leonida/issues/3232#issuecomment-7085263408), a [gfx1036 iGPU with AMD 26.5.2](https://github.com/ItsNotRexed/Leonida/issues/2891#issuecomment-7084023801), and the [Ryzen 7 9800X3D iGPU with driver 32.0.21045.29003](https://github.com/ItsNotRexed/Leonida/pull/3440). |
| `ps_interp_f16_high` fails on a Mac: `PerVertexKHR decoration is not supported in MSL`, then `vkCreateGraphicsPipelines` -3 | MoltenVK can't convert `PerVertexKHR` inputs to Metal | Current `main` translates it with `--f16-interp-fallback` on MoltenVK (see "Macs: 16-bit interpolation") |
| `ps_ssharp` fails on some Macs with MoltenVK 1.4.2 (an Apple M3, not an M5 Pro): `point bias +1: (0,0): (1.0, 0.0, 0.502, 0.502) != (0.502, 0.502, 0.502, 0.502)` | MoltenVK drops the sampler's `mipLodBias`, so the S#'s `LOD_BIAS` moves neither the explicit nor the derivative LOD | Current `main` translates with `--explicit-lod-bias` where `tools/vk_subgroup_info.py --lod-bias` measures that the sampler drops the bias (see "S# LOD bias without the sampler's `mipLodBias`" in [design.md](design.md)). Forcing it on another driver (`LEONIDA_EXPLICIT_LOD_BIAS=1`) counts the bias twice and fails the +-0.3 cases |
| `ps_vcmpx_forms` fails on a Mac: word 1 reads `0xf05e8e16`, want `0xf05e8a12` | MoltenVK's fast-math makes a compare of a NaN with itself true (SHADER-234) | Current `main`'s test programs turn it off (`MVK_CONFIG_FAST_MATH_ENABLED=0`, unless you set the variable yourself); rebuild them |
| On a Mac, a translated shader's GPU time is 1.5 to 16 times what it would be without the precise-arithmetic overhead | MoltenVK's SPIRV-Cross turns every `NoContraction` float add, subtract and multiply into a call to an `[[clang::optnone]]` helper that Metal does not inline. MoltenVK 1.4.2 and `main` up to at least `5189f8de` are affected (SHADER-234, [design notes](design.md#translator-status-and-runtime-contract)) | Expected with these MoltenVK versions, and the output is still exact. Before you time shaders on a Mac, build MoltenVK with SPIRV-Cross `98cbb7c0` or newer in `ExternalRevisions/SPIRV-Cross_repo_revision` (KhronosGroup/MoltenVK#2917 moves it to `57e4efcc`), and point `LEONIDA_VULKAN_LOADER` at its `libMoltenVK.dylib` |
| `d3d12_descriptor_test` reports that the set had room for fewer than 5001 2D views and 2100 samplers, and the device logs that the bindless set holds fewer samplers than a full shader-visible sampler heap | The device's descriptor limits, or its `vkGetDescriptorSetLayoutSupport`, allow no bigger bindless set ([d3d12_vulkan.md](d3d12_vulkan.md) section 5). MoltenVK's answer is ignored, since it rejects every layout of `maxPerSetDescriptors` (1212) or more although it runs the full set | Expected where the limits are low. The test still checks the last index of each array and that the next view and sampler are refused |
Expand Down
27 changes: 26 additions & 1 deletion make_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,8 @@ def exe_shaders(game: str, work: str, mc_signature: str, jobs: int = 1, emulate:
FALLBACK_FLAGS = (("--no-float-controls", "no_float_controls"), ("--bary-fallback", "bary_fallback"),
("--texel-offset-fallback", "texel_offset_fallback"), ("--mesh-compute", "mesh_compute"),
("--f16-interp-fallback", "f16_interp_fallback"), ("--pc-tail-ubo", "pc_tail_ubo"),
("--compact-spirv", "compact_spirv"), ("--mesh-serial-waves", "mesh_serial_waves"))
("--compact-spirv", "compact_spirv"), ("--mesh-serial-waves", "mesh_serial_waves"),
("--explicit-lod-bias", "explicit_lod_bias"))


def fallback_flags(a) -> tuple[str, ...]:
Expand Down Expand Up @@ -2016,6 +2017,19 @@ def runtime_gpu_info() -> dict:
return {}


def runtime_gpu_explicit_lod_bias():
"""explicit_lod_bias as tools/vk_subgroup_info.py --lod-bias measures it on the GPU the runtime would use (one
compute dispatch): True where the sampler drops mipLodBias (MoltenVK on an Apple M3, not on an M5 Pro), False
where it applies it, None when it can't tell."""
try:
r = subprocess.run([sys.executable, "-I", os.path.join(TOOLS, "vk_subgroup_info.py"), "--lod-bias"],
capture_output=True, text=True, timeout=60)
v = json.loads(r.stdout.strip().splitlines()[-1]).get("explicit_lod_bias")
return None if v is None else bool(v)
except (OSError, ValueError, IndexError, subprocess.SubprocessError):
return None


def runtime_gpu_per_vertex():
"""per_vertex_inputs as tools/vk_subgroup_info.py answers for the GPU the runtime would use: False where the
driver can't compile PerVertexKHR (MoltenVK) or lacks fragmentShaderBarycentric, None when it can't tell."""
Expand Down Expand Up @@ -3323,6 +3337,9 @@ def main() -> int:
ap.add_argument("--texel-offset-fallback", action="store_true",
help="fold the run-time texel offset of image_sample*_o into the coordinate, for devices "
"without VK_KHR_maintenance8")
ap.add_argument("--explicit-lod-bias", action="store_true",
help="apply the S# LOD bias in the shaders, for a driver whose sampler drops it; on by itself "
"where tools/vk_subgroup_info.py --lod-bias measures that (MoltenVK on an Apple M3, not an M5 Pro)")
ap.add_argument("--f16-interp-fallback", action="store_true",
help="16-bit interpolation from decoded halves the vertex/mesh shader exports instead of "
"PerVertexKHR inputs; on by itself when the runtime's GPU can't use them (MoltenVK)")
Expand Down Expand Up @@ -3427,6 +3444,14 @@ def main() -> int:
a.f16_interp_fallback = True
elif per_vertex is None:
a.f16_interp_fallback = keep_recorded_fallback("--f16-interp-fallback", work)
if "shaders" in stages and not a.explicit_lod_bias:
drops_bias = runtime_gpu_explicit_lod_bias()
if drops_bias is True:
log("shaders: tools/vk_subgroup_info.py --lod-bias measures that the GPU the runtime would use drops the "
"sampler's LOD bias: translating with --explicit-lod-bias")
a.explicit_lod_bias = True
elif drops_bias is None:
a.explicit_lod_bias = keep_recorded_fallback("--explicit-lod-bias", work)
if "shaders" in stages:
if a.bary_fallback:
# Command-line precedence: --bary-fallback wins over LEONIDA_BARY_FALLBACK=0.
Expand Down
8 changes: 5 additions & 3 deletions runtime/cmake/translator_deps.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# The shader fixtures use test/shaders/build.py, its local imports and the scripts it runs (tools/rdna2spirv.py
# and tools/vk_subgroup_info.py, whose answer picks --bary-fallback). Track the shader-stage dependencies in
# make_game.py's TRANSLATION_SOURCES here too, including the native PSO catalog writer.
# The shader fixtures use test/shaders/build.py, its local imports and the scripts it runs (tools/rdna2spirv.py,
# tools/vk_subgroup_info.py, whose answer picks --bary-fallback, and tools/vk_lod_bias.py, which its --lod-bias
# measurement imports for --explicit-lod-bias). Track the shader-stage dependencies in make_game.py's
# TRANSLATION_SOURCES here too, including the native PSO catalog writer.
# Every add_custom_command that runs build.py DEPENDS on this list, so an edit to a helper such as tools/spirv_asm.py
# rebuilds the test shaders instead of leaving the last build's SPIR-V in place (BUILD-1064).
# tests/test_cmake_translator_deps.py fails when an import is missing here or a build.py rule doesn't use the list.
Expand Down Expand Up @@ -32,6 +33,7 @@ set(LEONIDA_TRANSLATOR_DEPS
${_leonida_repo}/tools/spirv_loop_guard.py
${_leonida_repo}/tools/spirv_opt.py
${_leonida_repo}/tools/spirv_stubs.py
${_leonida_repo}/tools/vk_lod_bias.py
${_leonida_repo}/tools/vk_subgroup_info.py
${_leonida_repo}/tools/wave64_emulate_opt.py
${_leonida_repo}/tools/wave64_halves.py)
Expand Down
19 changes: 19 additions & 0 deletions runtime/test/shaders/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,23 @@ def asm_mattr(path):
CLIP_CASES = {"vs_clip": 1, "vs_clip_param4": 4, "vs_clip_undeclared": 1}


def explicit_lod_bias():
"""LEONIDA_EXPLICIT_LOD_BIAS=1 (or 0). Unset, it is on where tools/vk_subgroup_info.py --lod-bias measures that
the sampler drops mipLodBias (one compute dispatch from Python, no test programs needed), the rule of
scripts/run_gpu_tests.py. No answer leaves it off."""
v = (os.environ.get("LEONIDA_EXPLICIT_LOD_BIAS") or "").strip().lower()
if v in ("1", "true", "yes", "on"):
return True
if v in ("0", "false", "no", "off"):
return False
try:
r = subprocess.run([sys.executable, "-I", os.path.join(TOOLS, "vk_subgroup_info.py"), "--lod-bias"],
capture_output=True, text=True, timeout=60)
return json.loads(r.stdout.strip().splitlines()[-1]).get("explicit_lod_bias") is True
except (OSError, ValueError, IndexError, AttributeError, subprocess.SubprocessError):
return False


def asm_fssm_fields(path):
"""(offset, words) of the "fssm-at" and "fssm-data" header comments, (None, []) without them."""
at, words = None, []
Expand Down Expand Up @@ -195,6 +212,8 @@ def translate_tests(work, names):
cmd.append("--f16-interp-fallback")
if os.environ.get("LEONIDA_TEXOFF_FALLBACK") == "1": # texel offsets without VK_KHR_maintenance8
cmd.append("--texel-offset-fallback")
if explicit_lod_bias(): # the S# LOD bias in the shader, where the sampler drops it (LEONIDA_EXPLICIT_LOD_BIAS)
cmd.append("--explicit-lod-bias")
# 128-byte push constants: the tail in a set-1 uniform block. The values the test programs accept (vk_pc_tail.h).
if (os.environ.get("LEONIDA_PC_TAIL_UBO") or "").strip().lower() in ("1", "true", "yes", "on"):
cmd.append("--pc-tail-ubo")
Expand Down
50 changes: 43 additions & 7 deletions runtime/test/shaders/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,9 @@ def ssharp_words(mip_filter, min_lod=0.0, max_lod=15.0, bias=0.0):
("point min_lod 1", ssharp_words(1, min_lod=1), (0, 1)), # 1 / 1: MIN_LOD clamps an explicit LOD too
("point bias +1", ssharp_words(1, bias=1), (0, 1)), # 1 / 1: the S# bias applies to an explicit LOD
("point bias -1", ssharp_words(1, bias=-1), (0, 1)), # 0 / 0
# +-0.3 keeps LOD 0 / 1 on levels 0 / 1; the bias counted twice (+-0.6) moves one of them
("point bias +0.3", ssharp_words(1, bias=0.3), (0, 1)), # 0 / 1
("point bias -0.3", ssharp_words(1, bias=-0.3), (0, 1)), # 0 / 1
("none", ssharp_words(0), (0, 1)), # 0 / 0: MIP_FILTER_NONE reads the base level
("none min_lod 1", ssharp_words(0, min_lod=1), (0, 1)), # 0 / 0: and ignores the LOD clamp
("point base 1", ssharp_words(1), (1, 1))] # 1 / 1: the T#'s BASE_LEVEL starts the view
Expand Down Expand Up @@ -1652,25 +1655,57 @@ def sampler_mismatch(data, words, view):
return ""


def sampler_test(tools, spirv):
"""ps_ssharp: every SAMPLER_CASES S#/T# pair drawn with vk_sampler_test and judged per pixel by sampler_level.
A grey level-1 texel differs from every level-0 texel in both channels, so a wrong level fails at each pixel."""
shaders = [os.path.join(spirv, name + ".spv") for name in ("vs_ids", "ps_ssharp")]
def sampler_compare_mismatch(data, words, view):
"""ps_ssharp_c: the first pixel whose (c_lz, c_lz, c, c) is not the compare result of the level the S# and T#
select (vk_sampler_test --dref: depth 0.25 in level 0 and 0.75 in level 1, reference 0.5, LESS_EQUAL), or ""."""
if len(data) != SAMPLER_SIZE ** 2 * 16:
return f"expected {SAMPLER_SIZE ** 2} RGBA32F pixels, got {len(data)} bytes"
explicit, implicit = (float(sampler_level(words, view, lod) == 1) for lod in (0, 1))
want = (explicit, explicit, implicit, implicit)
for i, got in enumerate(struct.iter_unpack("<4f", data)):
if any(not math.isclose(g, w, rel_tol=0, abs_tol=1e-6) for g, w in zip(got, want)):
y, x = divmod(i, SAMPLER_SIZE)
return f"({x},{y}): {tuple(round(g, 4) for g in got)} != {want}"
return ""


# The pixel shaders judged by sampler_test and the vk_sampler_test mode each needs. Each writes an explicit-LOD-0 sample
# and an LOD-1 sample, so the same SAMPLER_CASES expectations hold for all: ps_ssharp (image_sample_lz and
# image_sample), ps_ssharp_ld (image_sample_l and image_sample_d), ps_ssharp_b (image_sample_lz and image_sample_b),
# ps_ssharp_cube and ps_ssharp_3d (image_sample_lz and image_sample on a cube and a volume) and ps_ssharp_c
# (image_sample_c_lz and image_sample_c on a depth texture, judged as compare results); ps_ssharp_o (image_sample_lz_o
# and image_sample_o) runs only under LEONIDA_TEXOFF_FALLBACK=1, its Grad derivatives being what it checks.
SAMPLER_FIXTURES = {"ps_ssharp": (), "ps_ssharp_ld": (), "ps_ssharp_b": (), "ps_ssharp_cube": ("--cube",),
"ps_ssharp_3d": ("--3d",), "ps_ssharp_c": ("--dref",), "ps_ssharp_o": ()}
SSHARP_LESS_EQUAL = 3 << 12 # S# word 0 DEPTH_COMPARE_FUNC [14:12] = LESS_EQUAL (Vulkan's VK_COMPARE_OP_LESS_OR_EQUAL)


def sampler_test(tools, spirv, ps="ps_ssharp"):
"""A SAMPLER_FIXTURES shader: every SAMPLER_CASES S#/T# pair drawn with vk_sampler_test and judged per pixel by
sampler_level. A grey level-1 texel differs from every level-0 texel in both channels, so a wrong level fails at
each pixel; ps_ssharp_c's compare reads 0 on level 0 and 1 on level 1."""
mode = SAMPLER_FIXTURES[ps]
dref = "--dref" in mode
if ps == "ps_ssharp_o" and os.environ.get("LEONIDA_TEXOFF_FALLBACK") != "1":
return Skip("SKIP (needs LEONIDA_TEXOFF_FALLBACK=1: vk_sampler_test enables no VK_KHR_maintenance8)")
shaders = [os.path.join(spirv, name + ".spv") for name in ("vs_ids", ps)]
for path in shaders:
if not os.path.isfile(path):
return f"missing {os.path.basename(path)}"
with tempfile.TemporaryDirectory(prefix="leonida-sampler-") as tmp:
for name, words, view in SAMPLER_CASES:
raw = Path(tmp) / "pixels.raw"
raw.unlink(missing_ok=True)
code, out = run(os.path.join(tools, "vk_sampler_test" + EXE), *shaders, raw,
if dref:
words = (words[0] | SSHARP_LESS_EQUAL, *words[1:])
code, out = run(os.path.join(tools, "vk_sampler_test" + EXE), *mode, *shaders, raw,
*(f"{w:x}" for w in words), *(str(v) for v in view))
if code == UNSUPPORTED:
m = re.search(r"unsupported: .*", out)
return Skip(f"SKIP ({m.group(0) if m else 'unsupported device'})")
if code or not raw.is_file():
return f"{name}: {failure(code, out, 3)}"
problem = sampler_mismatch(raw.read_bytes(), words, view)
problem = (sampler_compare_mismatch if dref else sampler_mismatch)(raw.read_bytes(), words, view)
if problem:
return f"{name}: {problem}"
return ""
Expand Down Expand Up @@ -2321,7 +2356,8 @@ def main():
results.append((name, texture_constant_test(tools, spirv, name)))
results.append(("vs_base_ids", base_ids_test(tools, spirv)))
results.append(("ps_tex", bindless_test(tools, spirv)))
results.append(("ps_ssharp", sampler_test(tools, spirv)))
for name in SAMPLER_FIXTURES:
results.append((name, sampler_test(tools, spirv, name)))
results.append(("ps_imgatomic", bindless_test(tools, spirv, "ps_imgatomic")))
for name in MIP_TEST_PASSES:
results.append((name, texture_mip_test(tools, spirv, name)))
Expand Down
21 changes: 21 additions & 0 deletions runtime/test/shaders/ps_ssharp_3d.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; The S# mip fields on a 3D sample, as ps_ssharp.asm does them on 2D (--explicit-lod-bias on images_3d, binding 6).
; Same descriptor path and target: s0:s1 is the console VA of a T# (8 dwords) with the S# (4 dwords) 32 bytes after it.
; Run: vk_sampler_test --3d vs_ids.spv ps_ssharp_3d.spv out.raw <S# words> [<base level> <last level>]
; (check.py: SAMPLER_CASES through sampler_test(..., "ps_ssharp_3d")). The volume is 128x128x2 then 64x64x1 with every
; slice the same, sampled at (u, v, 0.25): the third coordinate doesn't vary across the target, so image_sample sees
; LOD 1 and image_sample_lz LOD 0, as in ps_ssharp. -> mrt0 = (lz.r, lz.g, implicit.r, implicit.g).
s_load_dwordx8 s[8:15], s[0:1], 0x0
s_load_dwordx4 s[16:19], s[0:1], 0x20
s_waitcnt lgkmcnt(0)
v_interp_p1_f32_e32 v2, v0, attr0.x
v_interp_p2_f32_e32 v2, v1, attr0.x
v_interp_p1_f32_e32 v3, v0, attr0.y
v_interp_p2_f32_e32 v3, v1, attr0.y
v_mov_b32_e32 v10, v2
v_mov_b32_e32 v11, v3
v_mov_b32_e32 v12, 0.25
image_sample v[6:7], v[10:12], s[8:15], s[16:19] dmask:0x3 dim:SQ_RSRC_IMG_3D
image_sample_lz v[4:5], v[10:12], s[8:15], s[16:19] dmask:0x3 dim:SQ_RSRC_IMG_3D
s_waitcnt vmcnt(0)
exp mrt0 v4, v5, v6, v7 done vm
s_endpgm
Loading
Loading