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

Add pixels::PixelsBuilder::alpha_mode #376

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

makitard
Copy link

@makitard makitard commented Oct 3, 2023

Fix for #370

@@ -319,7 337,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle HasRawDisplayHandle>
let mut pixels = Vec::with_capacity(pixels_buffer_size);
pixels.resize_with(pixels_buffer_size, Default::default);

let alpha_mode = surface_capabilities.alpha_modes[0];
let alpha_mode = self.alpha_mode;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably check whether the selected alpha mode is supported by the surface. Return an error if it is not.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the same be done for Pixels::surface_texture_format and Pixels::render_texture_format then?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that is the case. AlphaMode is for the surface configuration, not for any textures. The original code here used the first alpha mode from the surface capabilities. Even if that isn't a great default choice, it was at least guaranteed to be supported by the surface.

///```
///use pixels::wgpu::CompositeAlphaMode;
///
///let mut pixels = PixelsBuilder::new(320, 240, surface_texture)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is not passing in CI.

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.

2 participants