Replies: 3 comments 14 replies
-
Would this add rust as a dependency to raylib? |
Beta Was this translation helpful? Give feedback.
-
Reasons against changing raylib to accommodate this proposal: |
Beta Was this translation helpful? Give feedback.
-
I once thought of implementing a raylib platform backend (similar to GLFW, SDL2, RGFW) with sokol. |
Beta Was this translation helpful? Give feedback.
-
Context
WebGPU
is a new graphics API that aims to be a modern graphics API on the web.wgpu
is one of the available implementations ofWebGPU
, written in Rust, and used internally in Firefox.wgpu
currently translates WebGPU calls toDirectX 11
,DirectX 12
,Vulkan
,Metal
, andOpenGL
/GLES
/WebGL
.wgpu-native
is the C binding library forwgpu
, usable from C / C++.As an exercise, I attempt to port raylib to use
wgpu
. This proves to be a challenge since raylib is deeply dependent onrlgl
andOpenGL
itself. Virtually, every raylib core module usesrlgl
. My goal is to split the core modules from the graphics backend and write a newwgpu
graphics backend. This can help future-proofing raylib, while still supporting it on older systems. I do not intend to replacerlgl
completely.How?
To write a new graphics backend, I probably need to split/abstract the graphics initialization.
Some ideas I had in mind:
rcore_desktop_glfw_wgpu
) This approach is similar to whatImGui
does, by letting the user include the right combination of window platform and rendering backend. This approach might not fully work since raylib is tightly integrated withOpenGL
.rlgl
backend. Make allraylib.h
's functions not depend onrlgl
directly, but rather select the correct graphics backend based on the build configuration.rlgl
functions inwgpu
. To be honest, I am not sure about that solution. Mapping old-styleOpenGL
calls to modern graphics APIs can lead to suboptimal usage/performance.This proves to be an extremely critical decision from a developer experience and simplicity standpoint.
I need help
I opened this discussion to gain some feedback and start a discussion.
For now, I modified the CMake scrips to download
wgpu-native
and build it from source. You can view the changes here: https://github.com/AregevDev/raylib/tree/wgpu.Beta Was this translation helpful? Give feedback.
All reactions