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

Remove pixels::SurfaceTexture? #188

Open
parasyte opened this issue Sep 1, 2021 · 0 comments
Open

Remove pixels::SurfaceTexture? #188

parasyte opened this issue Sep 1, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@parasyte
Copy link
Owner

parasyte commented Sep 1, 2021

Tracking ticket for a public API change proposal. The idea was introduced in #185 (comment)

wgpu::SurfaceConfiguration contains the same basic information that we need for surface management (mainly the size). We can replace our pixels::SurfaceTexture type with a wgpu::SurfaceConfiguration. It would change the old way of creating a builder:

let surface_texture = SurfaceTexture::new(window_size.width, window_size.height, &window);
let builder = PixelsBuilder::new(width, height, surface_texture);

To the new way:

let surface_config = pixels::surface_config(window_size.width, window_size.height, None);
let builder = PixelsBuilder::new(width, height, &window, surface_config);

Where pixels::surface_config has this function signature:

pub fn surface_config(width: u32, height: u32, format: Option<wgpu::TextureFormat>) -> wgpu::SurfaceConfiguration

The only reason to do this would be to have Pixels own a SurfaceConfiguration instead of creating a new one every time the surface needs to be reconfigured. And of course, exposing the configuration publicly. The pixels::surface_config() helper is optional, and a surface configuration can be created in any way.

@parasyte parasyte added the enhancement New feature or request label Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant