Repository navigation
Sample magnified nearest planes through cached columns and rows - #35
Merged
Merged
Conversation
Nearest, axis-aligned sampling with u independent of y now finds the texel column of every device column once per image (same float expressions as the per-pixel path, via the shared origin/nearestCol helpers) and, when rows repeat (|m[3]| < 1), expands each texel row once for all device rows on it. ImageShader.srcRow hands out the expanded row, so coverage spans composite straight from it, and opaque runs at full alpha copy it into the destination through opaqueSpan without spanOver. Unit-scale one-bit planes fill whole bytes of one colour at once. Caches keep their buffers across ImageShader.Reset: no allocations after warm-up. Sampler is documented as not safe for concurrent use. BenchmarkMagnifiedBits (cera's scan-page geometries), -count 6: 2.1x 2587µs -> 926µs (-64%) 8.3x 517µs -> 88µs (-83%) 7.9x 420µs -> 78µs (-81%) 1x 1803µs -> 1043µs (-42%) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JLyJY68DWZFiofJb5BDadh
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.
What and why
Fixes #34.
Nearest, axis-aligned sampling where u does not depend on y (
m[1] = m[2] = 0) now:origin,nearestCol), so a pixel gets the same texel either way.|m[3]| < 1), expands each texel row once and copies it for every device row on it. No float work per pixel.ImageShader.srcRowreturns the expanded row, so coverage spans composite straight from it. Opaque runs at alpha 255 copy it into the destination through the existingopaqueSpanpath, withoutspanOver.0x00/0xff) are filled 8 pixels at a time.Cache buffers survive
ImageShader.Reset, so there are no allocations after warm-up.Sampleris now documented as not safe for concurrent use.Not included:
OpaqueShaderinterface, since that would change the API. Once cera gets this version it can drop its ownbitShaderand useImageShaderagain.Benchmarks
BenchmarkMagnifiedBitsuses the geometries of cera's scan pages;-count 6, compared with benchstat:Tests
bitplane_test.go:cera's test suite passes with this stilus through a local
replace.Checklist
go test ./...passesgofmtandgo vetare clean (also built for js/wasm, arm64, 386)benchstatbefore/after)🤖 Generated with Claude Code
https://claude.ai/code/session_01JLyJY68DWZFiofJb5BDadh
Generated by Claude Code