Replace glium/egui with dedicated wgpu renderer crate #20

Open
opened 2022-11-02 20:40:10 +00:00 by mars · 0 comments
Owner

Currently, the glium crate (OpenGL) is used directly by Magpie for its rendering, and the sandbox is using egui's painting API to render Canary's graphics. This has a lot of shortcomings:

  1. Canary rendering code is not reusable because every Canary-enabled binary uses its own implementation.
  2. Canary's renderer is not batteries-included and people who want to create new Canary applications are forced to write their rendering code from scratch.
  3. egui and glium have different APIs, so every time a change to Canary is made, both have to be updated.
  4. egui's painter API only supports textured triangles, but in the future, Canary will need to support a lot more than a single mesh.
  5. I'm not really used to OpenGL.

What I want to do instead is to use a single wgpu-based Canary renderer that can be used in egui, Magpie, and whatever other frontends we come up with. This opens the door to potential integrations with bevy and Cyborg, which both use wgpu, as well as many other Rust projects out there that use wgpu.

Steps needed:

  1. Create and implement a new wgpu-based Canary renderer library named canary-wgpu at renderer/wgpu.
  2. Add wgpu to Magpie, setup wgpu in Magpie, then replace the glium renderer with the canary-wgpu crate.
  3. Update sandbox's eframe and egui crates to 0.19, enable the wgpu feature of eframe 0.19, and use eframe's provided wgpu instance to initialize canary-wgpu.
  4. Use egui's external texture API to create a render target for canary-wgpu, and render each panel's texture onto each panel's window as a quad with egui's painter API.
Currently, the glium crate (OpenGL) is used directly by Magpie for its rendering, and the sandbox is using egui's painting API to render Canary's graphics. This has a lot of shortcomings: 1. Canary rendering code is not reusable because every Canary-enabled binary uses its own implementation. 2. Canary's renderer is not batteries-included and people who want to create new Canary applications are forced to write their rendering code from scratch. 3. egui and glium have different APIs, so every time a change to Canary is made, both have to be updated. 4. egui's painter API only supports textured triangles, but in the future, Canary will need to support a lot more than a single mesh. 5. I'm not really used to OpenGL. What I want to do instead is to use a single wgpu-based Canary renderer that can be used in egui, Magpie, and whatever other frontends we come up with. This opens the door to potential integrations with bevy and Cyborg, which both use wgpu, as well as many other Rust projects out there that use wgpu. Steps needed: 1. Create and implement a new wgpu-based Canary renderer library named `canary-wgpu` at `renderer/wgpu`. 2. Add wgpu to Magpie, setup wgpu in Magpie, then replace the glium renderer with the `canary-wgpu` crate. 3. Update sandbox's eframe and egui crates to 0.19, enable the wgpu feature of eframe 0.19, and use eframe's provided wgpu instance to initialize `canary-wgpu`. 4. Use egui's external texture API to create a render target for `canary-wgpu`, and render each panel's texture onto each panel's window as a quad with egui's painter API.
mars added the
performance
feature
cleanup
consistency
labels 2022-11-02 20:40:10 +00:00
mars self-assigned this 2022-11-02 20:40:10 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: canary/canary-rs#20
No description provided.