Commit graph

262 commits

Author SHA1 Message Date
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
Bernardo Meurer db8f6bb356
gitignore: add Cargo.lock (#63)
`pixels` is a library, and thus should _not_ check-in it's lockfile.

c.f. https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html#cargotoml-vs-cargolock
2020-04-12 21:37:55 -07:00
Jay Oster b38363a602
Fix CI (#58)
* Replace bespoke Error impl with `thiserror`

* cargo update

* Finix winit version in dev-dependencies
2020-03-17 20:36:08 -07:00
Jay Oster 7701ac2d0e
Add docs badge (#51) 2019-11-20 00:27:51 -08:00
Jay Oster 17c94574a2
Safety dance (#50)
* Update Cargo.lock

* Forbid unsafe

* Update README
2019-11-19 22:10:08 -08:00
fuckwit c5718cc041 Remove Unsafe in macro.rs (#43)
* remove unsafe slice::from_raw_parts

this should be a way to remove the unsafe code in the Spirv Deref impl.
Not sure how it affects performance yet.
I will take a look at the bytecode and see if maybe the compiler is
smart enough to optimize that away.

* change renderers to accomodate new Deref

Let the deref return a `Vec<u32>` instead of a slice reference. This
should not hurt performance too much as this will be done a finite
amount of times att startup.

* replaced deref with normal impl

* fixed endianness, fixed offset + rustfmt

* bump version

* fixed clippy lints

* respect the target endianness

* use wgpu::read_spirv()

* remove an unneccessary allocation of a vec

* move borrow into macro
2019-11-19 21:27:55 -08:00
Jay Oster bb898d78de
Add minimal-sdl2 example (#48) 2019-11-19 19:58:21 -08:00
Jay Oster 8061ce0ea4
Reorganize dependencies (#46)
* Reorganize dependencies

* Enable logging in the minimal-winit example

* Fix a very minor bug in the minimal-winit example
2019-11-19 19:37:36 -08:00
Jay Oster cb14f2d977
Add minimal example with winit (#45)
- Closes #44
2019-11-09 23:32:37 -08:00
Jay Oster 98983d201d Fix doc comment 2019-11-06 23:15:28 -08:00
Jay Oster d56625577d
Update READMEs (#42) 2019-11-06 22:37:16 -08:00
Jay Oster efa57289cb
Hypothesis: Removing the Travis cache should make CI builds much faster (#41) 2019-11-06 22:07:07 -08:00
Jay Oster a92adf1b12
Add explicit clippy deny all, and forbid unsafe code (where possible) (#38) 2019-11-06 21:16:25 -08:00
Thom Chiovoloni e0225c145d Add a conways game of life example (#37)
* Add a conways game of life example

* Rustfmt conway example

* Respond to review feedback (p_width/p_height)

* Use line_drawing instead of manual bresenham

* Optimize count_neibs

* Remove inline(never) leftover from when profiling

* Bring back wrapping behavior (without regressing perf)

* Fix missing bounds check
2019-11-05 23:15:58 -08:00
Jay Oster 17c6054f40 Bump version 2019-11-03 22:28:00 -08:00
Jay Oster d97f57cb79 Fix the maintenance badge 2019-11-03 22:12:56 -08:00
Jay Oster 84d35e1205
Update wgpu to 0.4.0 (#35)
- Closes #16
- Closes #32
2019-11-03 22:07:57 -08:00
Jay Oster 2d0b053cd7 flat_map 2019-11-03 16:58:58 -08:00
Jay Oster 0792d47ae7
Add badges for crates.io (#34) 2019-11-03 16:55:17 -08:00
Jay Oster f19740003f Minor doc improvement 2019-11-02 23:16:26 -07:00
Jay Oster 703773f35d
Exclude extraneous files from crate (#33) 2019-11-02 22:44:10 -07:00
Jay Oster 6a2c1426fc Add sponsors button 2019-11-02 20:17:13 -07:00
Jay Oster 28f927e153
Switch from rand_core to randomize (#31)
- For #7
2019-11-02 15:29:09 -07:00
Jay Oster 113ffafced Use TextureFormat to show the example iterates one-byte-per-pixel 2019-10-31 20:35:54 -07:00
Jay Oster de50b40d41 Add license 2019-10-30 23:30:09 -07:00