- Closes#235
- Now using alpha blending (non-premultiplied) in the scaling renderer
so that the clear color can be blended with the texture. This can be
made configurable, but we'll go with this for now.
* Fix half-pixel offsets in scaling renderer
- This bug was very subtle. It can be hard to notice!
- Context: When the scaling renderer transformation matrix is created,
it needs to center the image within the border.
- The previous code always evaluated the translation to (0, 0)
- This PR makes half-pixel adjustments to the translation when needed,
making it impossible to rasterize the texture on a half-pixel
boundary.
- I spotted this while working on pixel-aspect-ratio support, but it can
most easily be witnessed in the `conway` example by grabbing the top
or bottom resize handle on the window and slow dragging it up and down
by 1-pixel-at-a-time. When you hit a half-pixel bug the entire texture
will change slightly; some pixels will become hidden or duplicated.
* Bump MSRV
- Vertex UVs can be computed from the positions, which saves a small amount of code and a small amount of bandwidth (both inconsequential).
- This is mostly for readability.
- Fixes vertically-flipped pixel buffer in the `custom-shader` example.
- Fixes a regression caused by #223
- `downlevel_webgl2_defaults` only supports 2048x2048 pixels buffers
- This will allow pixel buffers up to the max supported by the hardware
- Cargo treats non-prefixed version numbers the same when the patch number is omitted.
- This is just cleaner and makes breaking updates easier to manage.
- It would be nice to return an error from the render function
- imgui-winit is still a WIP (open PR: https://github.com/Yatekii/imgui-wgpu-rs/pull/66)
- Update README
Co-authored-by: Mohammed Alyousef <mohammed.alyousef@neurosrg.com>
- Fixes#140
- Adds a public method to get the current GPU framebuffer texture format (AKA the render texture format).
- This wasn't as difficult as it seemed; the extra API is used by the examples to get the right texture format instead of being hardcoded.
* Update to wgpu 0.9
* Fix validation error in WGSL shader
- This moves the hardcoded vertex positions and texture coordinates to
the vertex buffer.
- Replaces the two-triangle quad to 1 full-screen triangle (fixes#180)
- Rewrites the custom shader example to fix a bug with large surface
textures;
- The input texture size was used for the output texture, causing the
purple rectangle to appear very jumpy on large displays in full screen.
- The `ScalingRenderer` now exposes its clipping rectangle. The custom
shader example uses this for its own clipping rectangle, but it can
also be used for interacting with the border in general.
* Switch to `wgpu::include_wgsl!()`
- This is a nice little simplification.
- Thanks to @JMS55 for the suggestion!
* Update egui-winit example to greatly simplify the platform event handler
- I was able to upstream this logic into the egui_winit_platform crate
* Fix the wgpu validation error