Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

egui gfx backend #295

Merged
merged 48 commits into from
Jul 4, 2022
Merged

egui gfx backend #295

merged 48 commits into from
Jul 4, 2022

Conversation

guusw
Copy link
Member

@guusw guusw commented Jun 30, 2022

  • Add egui rendering backend & standalone test
  • A bit of restructuring on how bindings are generated.
  • Setup bindings to gfx headers using mostly opaque types
  • Add a create with bindgen scripts for gfx headers

@codecov
Copy link

codecov bot commented Jun 30, 2022

Codecov Report

Merging #295 (8cf61fb) into devel (06bf653) will decrease coverage by 0.18%.
The diff coverage is 57.06%.

❗ Current head 8cf61fb differs from pull request most recent head a63213e. Consider uploading reports for the commit a63213e to get more accurate results

@@            Coverage Diff             @@
##            devel     #295      +/-   ##
==========================================
- Coverage   76.50%   76.32%   -0.19%     
==========================================
  Files         146      149       +3     
  Lines       25333    25440     +107     
==========================================
+ Hits        19380    19416      +36     
- Misses       5953     6024      +71     
Impacted Files Coverage Δ
src/gfx/context.hpp 100.00% <ø> (ø)
src/gfx/egui/egui_render_pass.hpp 0.00% <0.00%> (ø)
src/gfx/linalg.hpp 100.00% <ø> (ø)
src/gfx/mesh.hpp 100.00% <ø> (ø)
src/gfx/params.hpp 80.00% <ø> (ø)
src/gfx/renderer_types.hpp 94.28% <ø> (-2.15%) ⬇️
src/gfx/shader/block.hpp 84.61% <0.00%> (-15.39%) ⬇️
src/gfx/shader/blocks.cpp 93.75% <0.00%> (-6.25%) ⬇️
src/gfx/shader/generator.hpp 50.00% <ø> (ø)
src/gfx/shader/types.hpp 100.00% <ø> (ø)
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 06bf653...a63213e. Read the comment docs.

@@ -176,7 +181,7 @@ struct ContextMainOutput {
swapchainDesc.format = swapchainFormat;
swapchainDesc.width = newSize.x;
swapchainDesc.height = newSize.y;
swapchainDesc.presentMode = WGPUPresentMode_Fifo;
swapchainDesc.presentMode = WGPUPresentMode_Immediate;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't Fifo better?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it still switches to that automatically on some platforms that enforce it. but we want to control our own frame-rate so we can target 120 or 240 for example for better UI response times

cmake/Rust.cmake Outdated Show resolved Hide resolved
rust/src/shardsc.rs Outdated Show resolved Hide resolved
src/gfx/egui/egui_types.cpp Outdated Show resolved Hide resolved
src/gfx/rust/build/.gitignore Outdated Show resolved Hide resolved
src/gfx/rust/build/Cargo.toml Outdated Show resolved Hide resolved
@@ -431,7 +448,7 @@ void Context::requestDevice() {
deviceDesc.nextInChain = &deviceExtras.chain;
#endif

getLogger()->debug("Requesting wgpu device");
SPDLOG_LOGGER_DEBUG(getLogger(), "Requesting wgpu device");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still wondering why you didn't use existing macros here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to send the graphics logs to it's own logger so I can filter them out / tag them / etc.

src/gfx/egui/src/standalone_test.rs Show resolved Hide resolved
src/gfx/egui/src/standalone_test.rs Show resolved Hide resolved
Copy link
Member

@sinkingsugar sinkingsugar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small things but ok

TARGET_SDKROOT=`xcrun --sdk $1 --show-sdk-path`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this script? I need to run this all the time on Mac? If so annoying.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it's only for iOS.

There's some issues because the build process runs through Xcode and sets the SDKROOT environment variables.
It was similar to this issue TimNN/cargo-lipo#41 (unrelated repo)

Additionally bindgen needs some additional clang parameters to find the correct include files for iOS (similar to https://github.com/gfx-rs/wgpu-native/blob/91e14b8ffda0a5ec1d87fd27b7b9e8e62495720d/build.rs#L99)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you document it? We need some iOS instructions at least.

@@ -27,7 +29,10 @@ static inline std::shared_ptr<spdlog::logger> &getLogger() {
#ifdef WEBGPU_NATIVE
static WGPUBackendType getDefaultWgpuBackendType() {
#if GFX_WINDOWS
return WGPUBackendType_D3D12;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe revert this? Anyway let's keep a closer look I guess. Maybe need to test both in CI too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI actually runs very slowly on D3D12 so I think it's worth keeping this default for now.
The windows tests still run on D3D12 (warp)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why runs slow? Cos of some mistakes they did like you said last time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, one of those open issues about fixing D3D12. Copying data to buffers is currently very slow

src/gfx/egui/src/standalone_test.rs Show resolved Hide resolved
guusw added 23 commits July 4, 2022 12:45
# Conflicts:
#	src/gfx/egui/test.cpp
# Conflicts:
#	src/gfx/egui/egui_interop.cpp
#	src/gfx/egui/test.cpp
# Conflicts:
#	src/gfx/egui/Cargo.toml
#	src/gfx/egui/egui_interop.cpp
…ts for gfx bindings

# Conflicts:
#	src/gfx/egui/renderer.cpp
#	src/gfx/egui/test.cpp
@guusw guusw merged commit 0082f57 into devel Jul 4, 2022
@Kryptos-FR Kryptos-FR deleted the egui-gfx-backend1 branch July 4, 2022 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants