vello_hybrid: Extend calculation for images is wrong
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 4.3k
- Forks
- 300
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 61
Description
The following test case causes a huge mismatch between Vello CPU and Vello Hybrid:
#[vello_test(width = 100, height = 100)]
fn image_bilinear_probe_centered_pad(ctx: &mut impl Renderer) {
let image_source = ctx.get_image_source(bilinear_probe_gradient());
let image = Image {
image: image_source,
sampler: ImageSampler {
x_extend: Extend::Pad,
y_extend: Extend::Pad,
quality: ImageQuality::Medium,
alpha: 1.0,
},
};
ctx.set_paint_transform(Affine::translate((47.5, 47.5)));
ctx.set_paint(image);
ctx.fill_rect(&Rect::new(10.0, 10.0, 90.0, 90.0));
}
Left is Vello CPU, right is Vello Hybrid:
Vello CPU correctly renders the right part in fully red (255,0,0), while Vello Hybrid renders it as (223, 0 32). The problem is that in Vello hybrid, we first apply the extend to the coordinates and then apply the -0.5/+0.5 offsets for bilinear sampling. However, how it should be done (and how it is currently done in Vello CPU) is that each position for bilinear sampling is extended individually. Unfortunately, fixing this would probably make image rendering even slower than it already is...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating and running the image_bilinear_probe_centered_pad test case. Compare the Vello CPU and Vello Hybrid image-sampling paths, focusing on Extend::Pad and the bilinear sampling offsets. Done means Vello Hybrid matches Vello CPU at the padded edge, including the fully red pixels shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100