Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack of scaled layers breaks at certain window size #668

Closed
dominikh opened this issue Aug 18, 2024 · 3 comments
Closed

Stack of scaled layers breaks at certain window size #668

dominikh opened this issue Aug 18, 2024 · 3 comments

Comments

@dominikh
Copy link

When rendering with a base color other than black, the following scene

scene.push_layer(BlendMode::new(Mix::Normal, Compose::SrcOver), 1.0, Affine::scale(2.0), &Rect::new(0.0, 0.0, 1024.0, 1024.0)); 
scene.push_layer(BlendMode::new(Mix::Normal, Compose::SrcOver), 1.0, Affine::scale(2.0), &Rect::new(0.0, 0.0, 1024.0, 1024.0)); 
scene.push_layer(BlendMode::new(Mix::Normal, Compose::SrcOver), 1.0, Affine::scale(2.0), &Rect::new(0.0, 0.0, 1024.0, 1024.0)); 
scene.push_layer(BlendMode::new(Mix::Normal, Compose::SrcOver), 1.0, Affine::scale(2.0), &Rect::new(0.0, 0.0, 1024.0, 1024.0)); 
scene.push_layer(BlendMode::new(Mix::Normal, Compose::SrcOver), 1.0, Affine::scale(2.0), &Rect::new(0.0, 0.0, 1024.0, 1024.0)); 

scene.pop_layer();
scene.pop_layer();
scene.pop_layer();
scene.pop_layer();
scene.pop_layer();

will display the base color for small window sizes, but black for large window sizes. In my case, "small" is any window with a pixel area less than 2**20.

To reproduce the problem, I've needed at least 5 layers, and a scale transform that's >1.0; but even 1.00001 was sufficient.

@DJMcNab
Copy link
Member

DJMcNab commented Aug 18, 2024

I strongly suspect that this is a duplicate of #366. The reason it displays black is because the rendering never occurs, because you run out of memory in the blend stack.

However, I don't know why a different scale transform would have any impact here, so I'm leaving this open.

@dominikh
Copy link
Author

dominikh commented Aug 18, 2024

Indeed, changing

// 16 * 16 (1 << 8) is one blend spill, so this allows for 4096 spills.
let blend_spill = BufferSize::new(1 << 20);
to 1<<22 "fixes" it for this particular scene with the scale of 2, and 1<<21 suffices for a scale of 1.00001. I suppose the scale matters simply because it changes how many tiles are covered? Though that doesn't explain why a scale of 1 didn't run into this problem at any window size.

@dominikh
Copy link
Author

I'll chalk this up to getting unlucky with what tiles were occupied at different scales and close it as a duplicate of #366.

@dominikh dominikh closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2024
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

No branches or pull requests

2 participants