Commit graph

136 commits

Author SHA1 Message Date
Jay Oster 161b448a18
Add egui example. (#146) 2021-03-09 01:40:24 -08:00
Jay Oster 333ce71468
Fix resize in the imgui-winit example (#145)
- Was originally resizing the pixel buffer with `PhysicalSize` units, which is definitely incorrect. (The pixel buffer is created with `LogicalSize` units.)
- Updated the World struct to retain its own size information.
2021-03-07 03:50:10 -08:00
Jay Oster 5dbe87d0c0
Fix matrix when creating a scaling renderer (#143)
- This issue can be seen when creating a window and pixel buffer that have differing sizes; the image will be stretched to fill the window.
- If the window supports the resize callback to correct the image aspect ratio, resizing the window will correct the matrix immediately, adding the black border as expected. This is a jarring effect when the texture size ratio is not an integer.
- This bug also causes issues with the new `resize_buffer()` API.
2021-03-03 10:45:14 -08:00
JMS55 f2d4a4f084
Upgrade to wgpu 0.7 (#134)
Co-authored-by: Jay Oster <jay@kodewerx.org>
2021-02-28 15:29:36 -08:00
Jay Oster 0709161e02 Remove commented code 2021-02-28 14:08:41 -08:00
Josh 26ae25c3d8
Resize buffer (#136)
- Fixes #125
2021-02-28 14:05:28 -08:00
Mohammed Alyousef f845d59213
add fltk example (#137)
* add fltk example

* fix clippy lint

* fix rustfmt check

* add missing trailing new line

* use no-pango feature

* remove call to win.draw()
2021-02-07 10:36:21 -08:00
Jay Oster c522d12e0e
Fix build for imgui-winit example (#138)
- The dependencies are a mess!
- Had to fork `imgui-wgpu`, which sits between 0.12 and 0.13 (has support for `winit` 0.24, but not `wgpu` 0.7)
- This is a temporary fix for CI, until https://github.com/Yatekii/imgui-wgpu-rs/pull/44 is merged and a new release of `imgui-wgpu` is out
- The WIP `wgpu` 0.7 update in https://github.com/parasyte/pixels/pull/134 will be needed for `imgui-wgpu` 0.14
- Update MSRV for `imgui` 0.7
2021-02-06 13:13:04 -08:00
Jay Oster 0a893d6eff
Update all dependencies (#130) 2021-01-05 18:20:36 -08:00
Jay Oster efb64078ec
CI improvements (#132)
- Run Cargo check against the entire workspace
- Use minimal toolchain profile for lints
2020-12-27 06:35:17 -08:00
Jay Oster c0d1fca061
Remove Travis badge (#131) 2020-12-19 07:15:47 -08:00
Jay Oster cb315ec0a1
Fix raqote example on high-DPI displays (#129) 2020-12-13 19:37:35 -08:00
Jay Oster 70ff52948b
Refactor builder (#128)
* Refactor PixelsBuilder into its own module

* Remove HasRawWindowHandle from public interface
2020-12-13 19:15:00 -08:00
Jay Oster f85145d774
Test all crates in the workspace (#127)
* Test all crates in the workspace

* Fix tests for Rust 1.41.0
2020-12-10 20:00:13 -08:00
Jay Oster d425cfee7f
Clippy (#126)
Changes `Rc<Vec<u8>>` to `Rc<[u8]>`. See: https://rust-lang.github.io/rust-clippy/master/index.html#rc_buffer
2020-12-10 19:28:54 -08:00
schnippl0r fb243b8973
Expose new API method render_texture_format(). (#123)
This method is needed to let the user of the API configure the texture
format of the target texture/render texture that the surface texture is
rendered on. This texture format is hardware/platform dependent.

For example, this method makes it possible to use the pixels crate on
Android because Android seems not to use the previously hard-coded
texture format wgpu::TextureFormat::Bgra8UnormSrgb.
2020-12-10 18:40:06 -08:00
Jay Oster e5f92519f1
Fix cron schedule to run only at midnight weekly (#120)
- Was running every minute of the day on Sunday, whoops!
2020-09-20 01:00:20 -07:00
Jay Oster 1cf980534c
Replace raqote-winit screenshot (#119)
- The old one had artifacts on the window border
2020-09-18 20:06:40 -07:00
Jay Oster 6c36b3955b
Add an example with raqote (#118)
* Add an example with raqote

* Fix raqote dependency
2020-09-18 03:59:05 -07:00
Jay Oster 11dca72955
Add Dear ImGui example (#116)
* Add Dear ImGui example

- Closes #90

* Change argument order to match `render_with`

* Remove unnecessary borrow

* Refactor error messages

* Add a space

* Refactor Gui field privacy

* Add a menu bar and allow the about window to be closed

- The local bool is necessary because the menu bar closures are not allowed to borrow `self` for mutable access while `imgui::Ui<'ui>` is alive.
- The token-based menu bar lifetime is even more verbose than this.
2020-09-18 03:57:28 -07:00
Jay Oster b6526c27e5
Remove pixels-dragons (#114)
- I don't want to publish this crate.
- Can't publish pixels 0.2.0 if it depends on an internal unpublished crate.
- This requires allowing unsafe code, and removing the safety dance badge.
2020-08-20 17:19:40 -07:00
Jay Oster 265ba2e5b3
Render API v2 (#112)
* WIP: Render API v2

* Fix doctests

* Expose all of PixelsContext (#110)

* Fix ScalingRenderer::new() taking &mut Device

* Replace getters with direct access to &mut PixelsContext

* Fix wrong reference type

* Fix unneeded mut

* Remove unnecessary mutable borrow, resurrect the shorter getter methods

* Initial port to wgpu master (0.6)
Surface creation is broken (see examples)
Does not support compressed textures

* Fix SurfaceTexture and examples

* Add support for compressed texture formats

* resize doesn't need mutability

* Update documentation

* Update wgpu

* Prepare release

* Goodbye Travis! Thanks for all the fish

Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
2020-08-20 16:49:19 -07:00
Jay Oster 01d32c11f0
Bump beryllium version (#109)
- Closes #53
2020-07-29 19:07:34 -07:00
Jay Oster 1dd84cb412
Prepare 0.1.0 (#105) 2020-07-19 14:15:27 -07:00
Jay Oster 6c37916a56
Remove the workaround for metal 0.18.1 (yanked) (#104) 2020-07-19 13:52:00 -07:00
Jay Oster f118805eb7
Update README (#103) 2020-07-19 13:40:56 -07:00
Jay Oster fcc8f9fe65
Fix surface texture size in some of the examples (#102) 2020-07-19 04:38:17 -07:00
Jay Oster 1191379388
Temporary workaround to fix build on macOS (#101) 2020-07-19 03:29:47 -07:00
Jay Oster 8190c18241
Add custom shader example (#100)
* Add custom-shader example

* Update README

* Allow log level to be changed in release mode
2020-07-19 02:18:02 -07:00
Jay Oster e3b10ab83b
Fix the doc issue described in #80 (#99) 2020-07-19 01:56:52 -07:00
Jay Oster b5b55c43f7
Add feature flag to enable all log levels in examples (#98)
- Adds extra troubleshooting documentation to the README
2020-07-18 23:00:26 -07:00
Jay Oster 7e38a7262d
Some documentation fixes. (#97) 2020-07-18 22:25:51 -07:00
Jay Oster 27e7bfe998
New render api (#96)
* Extreme WIP: New wgpu access api

* Add getters for device and queue to Pixels

* Don't run ScalingRenderer in render_custom()

* Expose Pixels::scaling_renderer

* Fix exposing ScalingRenderer

* Tweak Pixels::render_custom()

* Cleanup

* More cleanup

* Fix doc comment

* Clippy

* Fix doctests

Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
2020-07-18 18:12:37 -07:00
Jay Oster 755b1fed28
Add environment variable overrides for wgpu::PowerPreference (#94)
* Add environment variable overrides for `wgpu::PowerPreference`

* Bump MSRV
2020-07-17 17:31:16 -07:00
Jay Oster b397eb4e48
Change Vsync setting to use Fifo present mode (#93)
And add a method to set `Mailbox` or other explicit modes.

Closes #88
2020-07-17 16:34:54 -07:00
Jay Oster 7779d682cf
Fix compatible_surface overrides when RequestAdapterOptions is provided (#85)
- This will use the default `compatible_surface` from `SurfaceTexture` when `RequestAdapterOptions` is configured without `compatible_surface`.
2020-06-05 02:20:17 -07:00
JMS55 4991d2cddc
Switch from futures-executor to pollster (#84) 2020-05-29 05:29:12 -07:00
JMS55 b55f75e157
Fix include_spv!() documentation (#81) 2020-05-23 16:59:11 -07:00
Jay Oster de21862c77
Prepare 0.0.4 (#79) 2020-05-21 20:04:12 -07:00
Aeledfyr c96e46d3d4
Add a method to convert cursor coords to pixel coords (#77)
* Add a method to convert cursor coords to pixel coords

* Add method `window_pos_to_pixel` to Pixels struct
   * Converts cursor / window physical coordinates to pixel coords

* Fix formatting

* Return result rather than clamping pixel coordinates

* Use transformation matrices to convert from cursor coord to pixel

* Adds a struct ScalingMatrix that manages the creation and usage
  of the transformation matrix used in the renderer.
* Added an inverse function on ScalingMatrix - 4x4 matrix inverse
  (This should probably use a library, but it doesn't seem worth
  adding a dependancy for one function)

* Optimize matrix multiplication for cursor position calculation

* Use ultraviolet for matrix and vector math

* Add suggested changes

This keeps the split between usize and isize
This also changes the input cursor position to f32, because it was
immediately cast to an f32 for the transformations.
2020-05-20 21:37:29 -07:00
Aeledfyr b43336d45d
Add builder methods for VSync and setting wgpu backend (#78)
* Add builder methods for VSync and setting wgpu backends

* enable_vsync sets the VSync mode
* wgpu_backend sets the wgpu BackendBit struct
* Made RequestAdapterOptions use compatible_surface by default

* Internally store wgpu::PresentMode for enabling vsync

This doesn't expose the PresentMode for the external api, because
the variants of PresentMode aren't very obvious to people without
wgpu experience.  Mailbox corresponds to VSync enabled, and
Immediate corresponds to VSync disabled.
2020-05-19 18:09:57 -07:00
Jay Oster 809d3f6dd9
Update badges (#73)
- crates.io badges are now deprecated: https://github.com/rust-lang/crates.io/issues/2436
2020-04-18 15:20:48 -07:00
Jay Oster 4098df59f6
Fix github actions (#74)
* Try to fix github actions

* Fix typos
2020-04-18 14:58:42 -07:00
Jay Oster 774b749145
Slim dependencies (#71) 2020-04-13 21:06:01 -07:00
Jay Oster f874d976c9
Add a badge for github-actions status (#69)
- I would like to add a badge to the Cargo manifest too, but it's currently WIP: https://github.com/rust-lang/crates.io/pull/1838
2020-04-13 20:39:09 -07:00
Jay Oster 91db963490
Fix panic in winit examples when pixels.render() returns Error (#70) 2020-04-13 20:38:51 -07:00
Bernardo Meurer d88b4520f8
ci: move to github actions (#61) 2020-04-13 13:15:46 -07:00
Jay Oster 9de2383712
Fix dependency bloat (#67)
* Move all examples to individual crates

* CI: Add libsdl2

* Use Ubuntu bionic for updated libsdl; 2.0.8

* Clippy

* libudev-dev is a dependency of libsdl2-dev

* Clippy

* Remove unnecessary dev-dependency

* `winit` is actually used in unit tests

* Fix a typo

* Move `simple-invaders` crate
2020-04-13 10:12:18 -07:00
Jay Oster 37b90fe6b4
Fix transform for wgpu 0.5 (#66) 2020-04-12 23:51:04 -07:00
Bernardo Meurer 246375f0e9
treewide: bump dependencies (#60) 2020-04-12 23:13:40 -07:00