DioxusLabs / DioxusLabs/dioxus

How to get a wgpu surface from a canvas?

Open
#3,725 1 comment 8 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

## Feature Request

I am currently aware that one can render wgpu similar to the example here: https://github.com/DioxusLabs/dioxus/blob/main/examples/wgpu.rs
But the problem is it occupies the entire of the window. You can go far with this approach by adding hacks to only render to a viewport whose position is synced up to the element, by hooking onto scroll, resize events. But its very easy to get it out of sync.

Imho the more correct way would be to directly get the canvas surface and have wgpu render on to it instead. But I can't see ways/examples dioxus currently offers this at the moment.

## Implement Suggestion

Add a way to get webgpu surface in desktop clients

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.