sparse_strips: Apply image sampler opacity instead of panicking#1736
Open
AdrianEddy wants to merge 2 commits into
Open
sparse_strips: Apply image sampler opacity instead of panicking#1736AdrianEddy wants to merge 2 commits into
AdrianEddy wants to merge 2 commits into
Conversation
AdrianEddy
force-pushed
the
image-opacity-tint-fold
branch
from
July 20, 2026 18:39
5179894 to
37d270b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Image::encode_intocurrently doesunimplemented!("Applying opacity to image commands")wheneverImageSampler.alpha != 1.0, so any image drawn with less-than-full opacity panics the renderer.This folds
sampler.alphainto the paint's straight-alpha tint (scaling the tint's alpha channel, synthesizing a whiteMultiplytint when none exists) and resetssampler.alpha = 1.0. It's output-equivalent for both tint modes, since the strip shader computessample_premul * tint_premul(Multiply) andtint_premul * sample.alpha(AlphaMask) — pre-scaling the tint's alpha scales the result uniformly.The second commit fixes a latent GPU bug this newly exposes: the GPU packed tint used
packed_color == 0as the "no tint" sentinel, so a present but fully transparent tint (α=0, which premultiplies to 0) was read as "no tint" and rendered opaque on GPU while the CPU path rendered it correctly transparent. Tint presence is now carried by the mode field (0=none / 1=alpha-mask / 2=multiply) rather than the color, which also fixes any directly-set fully-transparentTint.Tests: 4 encoder unit tests (both modes, α=0, existing-tint scaling) and a
pack_tintregression test; the WGSL is naga-validated by the shader build.This PR was generated by Claude.