[PR #7242] [MERGED] Shader packs: textureQueryLod #7438

Closed
opened 2026-11-03 06:39:33 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7242
Author: @arslanarm
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: shaderpacks/texture-query-lod


📝 Commits (1)

  • 118bdbf Shader packs: textureQueryLod

📊 Changes

3 files changed (+103 additions, -0 deletions)

View changed files

📝 crates/horizon-shaders/src/translate/mod.rs (+48 -0)
📝 crates/horizon-shaders/src/translate/rewrite.rs (+46 -0)
📝 crates/horizon-shaders/src/translate/scan.rs (+9 -0)

📄 Description

🤖 Opened by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally.

What and why

Fixes #7170.

The problem: textureQueryLod (GLSL 4.60, 8.9.1) has no counterpart in naga, so a program that calls it failed with Unknown function 'textureQueryLod'. With RenderPearl v2.7.2 that was every program including lib/material/normal.glsl.

The fix: a program that calls it now gets Horizon's own, in the prelude, the way textureGatherOffsets already works:

  • y is the level of detail relative to the base level, worked out as texturing does (OpenGL 4.6, 8.14.1): the log2 of the larger texel-space change of the coordinates between neighbouring pixels.
  • x is that level clamped to the texture's levels (textureQueryLevels).
  • It covers 2D, 2D array, 3D and cube samplers of float, int and uint. For a cube map, the direction is first projected onto its face.
  • A pack function that takes the sampler and passes it on works too, as with textureGatherOffsets.

Measured with real_packs (SHOW_ERRORS=1, 40 packs), main fbb17c980 against this branch:

  • Only RenderPearl's output changes. Its gbuffers programs no longer fail on textureQueryLod; they now stop on an interface-block error that #7171's interface-block PR fixes.
  • With the #7171 branches applied, its remaining failures are max3/min3, a .length() array size and a sample offset (not filed yet).

Test: texture_query_lod_translates. It calls it on 2D, 3D and uint samplers and through a pack function, and checks the result validates and is written as SPIR-V; a program that doesn't call it gets none of it. Run against main's code it fails: Unknown function 'textureQueryLod'.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Horizon-only (shader packs; vanilla has no such feature). Sources: GLSL 4.60, 8.9.1 (Texture Query Functions); OpenGL 4.6 core, 8.14.1 (Scale Factor and Level-of-Detail).

Other projects' code

RenderPearl v2.7.2, MIT: github.com/Luracasmus/renderpearl@86de79c4fa/LICENSE (tag v2.7.2). The files were read from the Modrinth v2.7.2 zip, whose LICENSE is identical to that one.

What was read:

  • lib/material/normal.glsl, lines 22–25 (the line Horizon's error names);
  • prelude/compat.glsl, lines 204–211 (where max3/min3 come from, for the note above);
  • a grep of the whole pack for textureQueryLod.

What follows RenderPearl: nothing beyond calling textureQueryLod. The test's calls, on samplers of its own, are written for this.

Self-check

pr_ready (tools/pr_ready.py --quick on plony-pc, against origin/main at fbb17c980, 1 min 0 s)

Check Result
Scope ✅ 3 files, +103 −0
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 612 passed (31 s)
rustfmt ✅ (7 s)
clippy ✅ (20 s)
tests: horizon-shaders ✅ 143 passed (1 s)
doc tests ✅ 0 passed
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7242 **Author:** [@arslanarm](https://github.com/arslanarm) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shaderpacks/texture-query-lod` --- ### 📝 Commits (1) - [`118bdbf`](https://github.com/horizon-rust/horizon/commit/118bdbf9a52cf4740acaf07cfdf5ffb310c4c1ad) Shader packs: textureQueryLod ### 📊 Changes **3 files changed** (+103 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-shaders/src/translate/mod.rs` (+48 -0) 📝 `crates/horizon-shaders/src/translate/rewrite.rs` (+46 -0) 📝 `crates/horizon-shaders/src/translate/scan.rs` (+9 -0) </details> ### 📄 Description > 🤖 Opened by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally. ## What and why Fixes #7170. **The problem:** `textureQueryLod` (GLSL 4.60, 8.9.1) has no counterpart in naga, so a program that calls it failed with `Unknown function 'textureQueryLod'`. With RenderPearl v2.7.2 that was every program including `lib/material/normal.glsl`. **The fix:** a program that calls it now gets Horizon's own, in the prelude, the way `textureGatherOffsets` already works: - `y` is the level of detail relative to the base level, worked out as texturing does (OpenGL 4.6, 8.14.1): the log2 of the larger texel-space change of the coordinates between neighbouring pixels. - `x` is that level clamped to the texture's levels (`textureQueryLevels`). - It covers 2D, 2D array, 3D and cube samplers of float, int and uint. For a cube map, the direction is first projected onto its face. - A pack function that takes the sampler and passes it on works too, as with `textureGatherOffsets`. **Measured** with `real_packs` (`SHOW_ERRORS=1`, 40 packs), main fbb17c980 against this branch: - Only RenderPearl's output changes. Its gbuffers programs no longer fail on `textureQueryLod`; they now stop on an interface-block error that #7171's interface-block PR fixes. - With the #7171 branches applied, its remaining failures are `max3`/`min3`, a `.length()` array size and a sample offset (not filed yet). Test: `texture_query_lod_translates`. It calls it on 2D, 3D and uint samplers and through a pack function, and checks the result validates and is written as SPIR-V; a program that doesn't call it gets none of it. Run against main's code it fails: `Unknown function 'textureQueryLod'`. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [x] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Horizon-only (shader packs; vanilla has no such feature). Sources: GLSL 4.60, 8.9.1 (Texture Query Functions); OpenGL 4.6 core, 8.14.1 (Scale Factor and Level-of-Detail). ## Other projects' code RenderPearl v2.7.2, MIT: https://github.com/Luracasmus/renderpearl/blob/86de79c4fa7d07fb47628dd9620efb10fb4be9d9/LICENSE (tag v2.7.2). The files were read from the Modrinth v2.7.2 zip, whose `LICENSE` is identical to that one. What was read: - `lib/material/normal.glsl`, lines 22–25 (the line Horizon's error names); - `prelude/compat.glsl`, lines 204–211 (where `max3`/`min3` come from, for the note above); - a grep of the whole pack for `textureQueryLod`. What follows RenderPearl: nothing beyond calling `textureQueryLod`. The test's calls, on samplers of its own, are written for this. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on plony-pc, against origin/main at fbb17c980, 1 min 0 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +103 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 612 passed (31 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (20 s) | | tests: horizon-shaders | ✅ 143 passed (1 s) | | doc tests | ✅ 0 passed | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:39:33 +07:00
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7438
No description provided.