#2d-graphics #graphics #2d #gpu #back-end

piet-wgpu

A hardware-accelerated 2D graphics backend for piet using wgpu

8 releases

0.3.4 Feb 11, 2024
0.3.3 Dec 17, 2023
0.3.1 Oct 12, 2023
0.3.0 Jul 29, 2023
0.1.1 May 7, 2023

#724 in Graphics APIs


Used in theo

LGPL-3.0-or-later OR MPL-2.0

93KB
1.5K SLoC

piet-wgpu

A piet implementation based on wgpu.

License

piet-wgpu is free software: you can redistribute it and/or modify it under the terms of either:

  • GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  • Mozilla Public License as published by the Mozilla Foundation, version 2.

piet-wgpu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the Mozilla Public License for more details.

You should have received a copy of the GNU Lesser General Public License and the Mozilla Public License along with piet-wgpu. If not, see https://www.gnu.org/licenses/ or https://www.mozilla.org/en-US/MPL/2.0/.


lib.rs:

A GPU-accelerated 2D graphics backend for piet that uses the wgpu crate.

This crate follows the wgpu middleware pattern, but in a somewhat unique way.

  • The user creates the WgpuContext by calling new() with a device and expected texture format.
  • Before rendering, the user creates a RenderContext by calling prepare() on the WgpuContext with a Device and a Queue. prepare() returns the context, which is expected to be written to.
  • Finally, by calling render on the WgpuContext, the user renders all of the material that was written to the RenderContext using the piet API.

Dependencies

~19–51MB
~782K SLoC