Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upInvestigate rendering backends, such as gfx-rs or wgpu-rs #34
Comments
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
|
Games From Scratch: Cross Platform OpenGL Alternatives has a good list, several options. Use an existing rendering engine (no go, would like to stay lower level as Steven already is, but could be viable in some situations). Use Vulkan + MoltenVK (but then, another layer of abstraction, and does everything have Vulkan yet? Not quite ready to let go of OpenGL yet). Or what I'm interested in: use an abstraction layer. bgfx gets high marks but there is also:
Neither of these are too appealing. The other options are to implement our own rendering backends separately, or, stay on OpenGL (do nothing). But bgfx continues to tempt. An informative presentation: From the Dark Side of the Moon: GPU Programming with BGFX and Eclipse, a good introduction to bgfx (although for a different platform, general concepts apply). BGFX has its own shader compiler, shaderc, which accepts its own shading language language .sc, similar to glsl, but is preprocessed, so it is compiled to other rendering backend languages, examples:
and:
The only potential problem with bgfx is the Rust wrapper, https://github.com/rhoot/bgfx-rs was last modified 2 years ago, and isn't published on crates.io. There is an open pull request rhoot/bgfx-rs#3 to update to the latest bgfx and dependencies, but the CI failed. Last commit adds this disclaimer to the readme:
There are 7 forks, which one is the newest? fuzzybinary is 7 commits ahead, and jazzay in turn has a fork of it, even. TheJare is 18 commits ahead, 2 behind. Either way, using bgfx will likely mean I'll need to do some of my own maintenance on bgfx-rs. And having bindings to a library written in another language is another downside, why not go all Rust? This is the mission of gfx-rs. Their goals are outlined in the 2017 blog post We need to go lower:
The momentum and community seems to be more behind gfx-rs than bgfx-rs, how much effort would it be to port Steven to it? |
iceiix
changed the title
Investigate rendering backends
Investigate rendering backends, such as gfx-rs
Nov 29, 2018
iceiix
changed the title
Investigate rendering backends, such as gfx-rs
Investigate rendering backends, such as gfx-rs/glutin
Nov 29, 2018
This comment has been minimized.
This comment has been minimized.
|
This is cool too: https://github.com/tomaka/glutin - bills itself as a "Pure Rust alternative to GLFW". Steven doesn't use GLFW, but it uses the tried and true SDL, which is in some ways a predecessor to GLFW. SDL2 is the only 3rd party dependency that has to be manually installed (e.g., besides Rust crates through cargo) since OpenSSL was removed https://github.com/iceiix/steven/issues/2, would be nice to get rid of it, simplifying installation. SDL2 can be replaced with glutin independently of changing out the OpenGL rendering code with gfx-rs or whatever, and should be easier, Steven doesn't use it very much:
|
This comment has been minimized.
This comment has been minimized.
|
Merged in the switch to glutin, but still using Steven's homegrown OpenGL 3.2 wrapper. glium is another wrapper, intended to be higher-level and safer to use; very popular and it aims to detect undefined behaviors and manage state. But "Glium is no longer actively developed by its original author. That said, PRs are still welcome and maintenance is continued by the surrounding community." It may be nice to catch more bugs at compile-time or with glium library checks, especially since rendering can be so platform-specific, but it is no silver bullet. The author has moved onto vulkano, a Vulkan wrapper. Another newer lighter wrapper is grr but it is only for OpenGL 4.5+ (Difference between OpenGL 3.x and 4.x?). Would like to stick to OpenGL 3 to maximize compatibility for now (what about OpenGL 2? History of OpenGL, differences between OpenGL 2.1 and 3.0?, probably not worth going back to 2 now that 3 is widely supported). gfx-rs certainly worth keeping an eye on, if going to put in the effort to switch out the whole rendering system, would like to get some more benefits. |
iceiix
changed the title
Investigate rendering backends, such as gfx-rs/glutin
Investigate rendering backends, such as gfx-rs
Dec 2, 2018
This comment has been minimized.
This comment has been minimized.
|
Update: gfx-hal is out: https://www.reddit.com/r/rust_gamedev/comments/a9vs20/gfxhal_is_finally_published/ but it has a regression from gfx in terms of supporting WebGL, because it is based on Vulkan instead of OpenGL. However, it may support WebGPU well:
How promising is WebGPU? https://en.wikipedia.org/wiki/WebGPU
as of yet unreleased, but once it is more supported, could consider using it. |
iceiix
transferred this issue from iceiix/steven
Jan 12, 2019
iceiix
added
the
enhancement
label
Jan 12, 2019
This comment has been minimized.
This comment has been minimized.
|
gfx-rs is coming up again in #92 WebAssembly support, once it supports wasm32-unknown-unknown/WebGL target, it will be quite appealing for this project. grovesNL is working on adding that, using his "GL on Whatever" set of bindings: https://github.com/grovesNL/glow to target OpenGL + OpenGL ES + WebGL avoiding target-specific code. As an intermediate step, may want to see if can replace the homegrown steven_gl wrapper with glow? Though ultimately, gfx-rs may be the way to go. Start porting to it now? (for native at first). Another complication, from https://gfx-rs.github.io/2018/12/27/this-year.html:
wgpu: https://github.com/gfx-rs/wgpu, still incomplete pre-"draw the first triangle" stage, but under active development, last modified within days. A pleasure to use for native or web, sounds promising. But is this too many abstractions, WebGPU to gfx-rs to Vulkan-like API/SPIR-V to WebGL? |
iceiix
changed the title
Investigate rendering backends, such as gfx-rs
Investigate rendering backends, such as gfx-rs or wgpu
Jan 20, 2019
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
https://wiki.alopex.li/AGuideToRustGraphicsLibraries2019 No clear winner still, but there are some important recent developments: 2019-04-26 https://phaazon.net/blog/pre-luminance-n-random-thoughts - for 1.0.0 the author is planning "At least one WebGL implementation and it must be WASM compatible." 2019-04-18 https://amethyst.rs/blog/moss-grant-announce/ - Amethyst was awarded a $10,000 grant for making it run in the browser with WebAssembly, and they plan to help where possible with: https://github.com/rust-windowing/winit/pull//797 stdweb support for eventloop 2.0 WebGPU working group https://www.w3.org/community/gpu/ https://github.com/gpuweb/ (not to be confused with https://github.com/webgpu and https://webgpu.com) is still active, as is https://github.com/gfx-rs/wgpu/, but isn't shipping in browsers yet. Targeting wgpu may very well be a good option, and the wgpu developers agree: https://old.reddit.com/r/rust/comments/bjnxd3/a_guide_to_rust_graphics_libraries_as_of_2019/emeznnf/
|
This comment has been minimized.
This comment has been minimized.
|
Posted more thoughts at https://www.reddit.com/r/rust/comments/bjnxd3/a_guide_to_rust_graphics_libraries_as_of_2019/emfekoe/ (in https://www.reddit.com/r/rust/comments/bjnxd3/a_guide_to_rust_graphics_libraries_as_of_2019/), but looking at https://github.com/gfx-rs/wgpu/ more closely, it already supports Vulkan (Windows/Linux), D3D12/11 (Windows), and Metal (macOS/iOS) platforms. Could I port to |
This comment has been minimized.
This comment has been minimized.
|
#171 wasm broken: not yet implemented: Glutin-Blank: Platform unsupported |
iceiix
referenced this issue
May 29, 2019
Open
wasm broken: not yet implemented: Glutin-Blank: Platform unsupported #171
This comment has been minimized.
This comment has been minimized.
|
https://old.reddit.com/r/rust_gamedev/comments/brehgw/rendy_02_released/ has some more insights:
warming up to the idea of targeting wgpu-rs...it would require WebGPU support in browsers, but fine with targeting only the latest, presuming it would be supported eventually. The other dichotomy is gfx-hal/rendy, from https://www.reddit.com/r/rust_gamedev/comments/bn71it/gfxhal02_is_released/:
Is this project a demanding engine or a simpler engine/framework? |
iceiix
changed the title
Investigate rendering backends, such as gfx-rs or wgpu
Investigate rendering backends, such as gfx-rs or wgpu-rs
May 29, 2019
This comment has been minimized.
This comment has been minimized.
|
https://github.com/Gordon-F/crossplatform_gfx_hal_example https://www.reddit.com/r/rust_gamedev/comments/bv7w2f/wgpurs_now_uses_rendy_to_manage_memory_and/ Looks like wgpu-rs is again a good choice, as for "4. wgpu-rs for the lowest safe level", |
iceiix commentedNov 27, 2018
•
edited
Currently, steven uses OpenGL 3.2 core profile, through
SDL2 (#35)and gl_generator + khronos_api with a custom but lightweight wrapper, steven_gl: https://github.com/iceiix/steven/tree/updates/gl + https://github.com/iceiix/steven/blob/updates/src/gl/mod.rs. Is there a better way to do this? (3D graphics)May help with graphical glitches such as https://github.com/iceiix/steven/issues/25, and/or cross-platform compatibility