Skip to content

improve: only require scene-color mips for non-zero LOD - #11

Merged
odvcencio merged 1 commit into
mainfrom
fix/ir-test-exhaustiveness-and-level-zero-mips
Aug 9, 2026
Merged

improve: only require scene-color mips for non-zero LOD#11
odvcencio merged 1 commit into
mainfrom
fix/ir-test-exhaustiveness-and-level-zero-mips

Conversation

@odvcencio

Copy link
Copy Markdown
Contributor

Summary

Refines the SceneColorMips requirement so the host only builds a scene-color mip chain when sampling at a non-zero or dynamic LOD. Level-zero taps continue to emit textureSampleLevel for WGSL non-uniform control flow compatibility, but skip unnecessary mip generation. Also implements missing interface stubs in IR test helpers to satisfy updated contract expectations.

Changes

  • Introduce StageRequiresSceneColorMips and RequiresSceneColorMips to distinguish explicit LOD usage from actual mip chain dependencies
  • Update hostRequirements to conditionally set SceneColorMips based on whether the sampled LOD is non-zero or dynamic
  • Add isLiteralZero helper to safely evaluate literal expressions during LOD analysis
  • Clarify documentation for SceneColorMips and SceneSampleLevel regarding level-zero tap behavior
  • Fulfill newly added interface methods (exprs, children, nestedStmts) on unrenderable IR test types

Testing

  • Run go test ./... to verify all tests pass, including the new scenarios in lower/post_surface_test.go

- SceneColorMips requirement now only set when sampling at non-zero or dynamic LOD, not for literal level-zero taps
- Literal level-zero taps still emit textureSampleLevel (needs EXT_shader_texture_lod) but don't require host to build mip chain
- Add StageRequiresSceneColorMips and RequiresSceneColorMips to detect non-zero/dynamic LOD usage
- Update documentation to clarify that level-zero taps are valid in non-uniform WGSL control flow
- Add tests verifying level-zero doesn't require mips while dynamic LOD does
- Update test stubs to implement new interface methods (exprs, nestedStmts, children)
@odvcencio
odvcencio merged commit 42aff79 into main Aug 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant