-
Notifications
You must be signed in to change notification settings - Fork 14
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
egui gfx backend #295
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
3c14a85
Change using crate::* crate::shardsc::* where applicable
guusw 9c50d72
Remove unused
guusw bc505cc
Disable vsync
guusw be3baa3
Add shader Compound append. Viewport shader global. Disable debug by …
guusw 2c63b95
Fix GeneratorContext::getTexture generating an error on non-existing …
guusw 969ef1d
Override backend from GFX_BACKEND env. Use vulkan backend on windows.
guusw 468b6f5
Return correct OS scaling factor from Window::getDrawScale
guusw 57c82d1
Add resizable_item_pool from DynamicWGPUBufferPool
guusw fa36483
Add custom init for resizable_item_pool
guusw 0a49154
Add getters for Texture. Add TextureFormatFlags::None
guusw 0dfa810
Add egui gfx integration & standalone test
guusw 1c8d340
Show FPS in test & small cleanup
guusw 6639202
Apply screen rect & draw scale
guusw b54802d
Add rust EXCLUDE_DEPENDS
guusw d3e86d4
Add rust_interop header for bindgen
guusw 7e780bc
Integrate egui rendering into UI shard
guusw 9948080
Fix missing header
guusw f166b09
Point shardsc.rs to generated bindings
guusw 0261636
Fix generated binding allowlists
guusw 869d4fe
Reorder functions. Add Window::getVirtualDrawableSize
guusw b8363ed
Use automatic c++ gfx bindings where posible. Bundle rust build scrip…
guusw 5b47d35
Fixes for gcc bindings
guusw 57cb6c4
Add missing build script crate
guusw 47a7ad6
Remove empty header
guusw 1100018
Remove unused
guusw 8d79464
Fix egui shader flags default value
guusw 020c418
Fix BUILD_STANDALONE_EGUI_TEST flag usage
guusw 8dd7241
Remove direct usage of webgpu headers
guusw 65baa45
Fixes for emscripten bindgen
guusw 282378a
Use --sysroot=
guusw f7284bc
Fix missing header
guusw 297fb96
Allow unstable thiscall on x86 windows
guusw df28f7e
Force windows CI to run D3D12. Fix ios bindgen sysroot
guusw 4f57a25
Force test_gfx to run under D3D12 on CI
guusw c0aa23f
Also enable feature(abi_thiscall) on the shards rust project
guusw dbff1f5
Pass correct sysroot to bindgen but keep host SDKROOT
guusw af45dd0
Minor fixes & formatting
guusw 6a05c14
Explicitly add bindgen system c++ include path
guusw 7895a21
Force GFX_BACKEND=D3D12 when running samples
guusw 1dce379
Only set BINDGEN_EXTRA_CLANG_ARGS if required
guusw a56c5dd
Assert on renderer createBindGroup
guusw 2cd3652
Fix texture sub-region updates
guusw d16349f
Add line info to context.cpp logs
guusw 75cf827
Don't create texture layout based on material
guusw 604f5fe
Detect recreation of swapchain
guusw 612ac4c
Give bind groups a label
guusw 53d7b04
Add some comments about the workings of osx_rust_build.sh
guusw a63213e
Run rustfmt
guusw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ jobs: | |
- name: Run samples | ||
shell: msys2 {0} | ||
run: | | ||
export GFX_BACKEND=D3D12 | ||
cd docs/samples | ||
for i in $(find shards -name '*.edn'); | ||
do | ||
|
@@ -135,7 +136,7 @@ jobs: | |
git config --global user.name "Fragcolor bot" | ||
git config --global user.email "[email protected]" | ||
mkdocs gh-deploy --force --message "Publish documentation from {sha} | ||
|
||
Using MkDocs {version}." | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
#!/bin/bash | ||
# Script to work around some issues when calling `cargo build`/`cargo rustc` from Xcode for iOS | ||
# | ||
# The SDKROOT needs to be set to the HOST SDKROOT so that build scripts are able to build | ||
# if not, it results in linker errors similar to this issue https://github.com/TimNN/cargo-lipo/issues/41 | ||
# | ||
# Additionally, bindgen needs to be passed the sysroot for the target platform to be able to find the system headers | ||
|
||
set -ex | ||
SDKROOT=`xcrun --sdk macosx --show-sdk-path` $@ | ||
TARGET_SDKROOT=`xcrun --sdk $1 --show-sdk-path` | ||
shift | ||
export SDKROOT=`xcrun --sdk macosx --show-sdk-path` | ||
export BINDGEN_EXTRA_CLANG_ARGS="-isysroot $TARGET_SDKROOT -isystem $TARGET_SDKROOT/usr/include/c++/v1 $BINDGEN_EXTRA_CLANG_ARGS" | ||
$@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,48 @@ | ||
/* SPDX-License-Identifier: BSD-3-Clause */ | ||
/* Copyright © 2020 Fragcolor Pte. Ltd. */ | ||
|
||
#[cfg(feature = "run_bindgen")] | ||
extern crate bindgen; | ||
extern crate gfx_build; | ||
use std::env; | ||
use std::path::PathBuf; | ||
|
||
#[cfg(feature = "run_bindgen")] | ||
fn bindgen_it() { | ||
fn generate_shardsc() { | ||
use std::env::var; | ||
|
||
let shards_dir = var("SHARDS_DIR").unwrap_or("../".to_string()); | ||
let shards_dir = var("SHARDS_DIR").unwrap_or("..".to_string()); | ||
let shards_include_dir = format!("{}/include", shards_dir); | ||
let src_extra_dir = format!("{}/src/extra", shards_dir); | ||
let gfx_path = format!("{}/src/gfx", shards_dir); | ||
|
||
println!("cargo:rustc-link-search={}/build", shards_dir); | ||
// Tell cargo to invalidate the built crate whenever the wrapper changes | ||
println!("cargo:rerun-if-changed={}/include/shards.h", shards_dir); | ||
let main_header_path = format!("{}/rust_interop.hpp", src_extra_dir); | ||
|
||
let header_path = shards_dir + "/include/shards.h"; | ||
// Tell cargo to regenerate the bindings whenever the headers change | ||
println!("cargo:rerun-if-changed={}/shards.h", shards_include_dir); | ||
println!("cargo:rerun-if-changed={}", main_header_path); | ||
|
||
let bindings = bindgen::Builder::default() | ||
.header(header_path) | ||
let builder = gfx_build::setup_bindgen_for_gfx(gfx_path.as_str(), bindgen::Builder::default()); | ||
let bindings = builder | ||
.header(main_header_path) | ||
.clang_arg("-DSH_NO_ANON") | ||
.clang_arg("-DSH_USE_ENUMS") | ||
.allowlist_type("SH.*") | ||
.allowlist_var("SH.*") | ||
.allowlist_function("SH.*") | ||
.clang_arg(format!("-I{}", shards_include_dir)) | ||
.clang_arg(format!("-I{}/src", shards_dir)) | ||
.derive_default(true) | ||
.use_core() | ||
.generate() | ||
.expect("Unable to generate bindings"); | ||
|
||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); | ||
bindings | ||
.write_to_file("src/shardsc.rs") | ||
.write_to_file(out_path.join("shardsc.rs")) | ||
.expect("Couldn't write bindings!"); | ||
|
||
println!("Done processing shards.h"); | ||
} | ||
|
||
#[cfg(not(feature = "run_bindgen"))] | ||
fn bindgen_it() {} | ||
|
||
fn main() { | ||
bindgen_it(); | ||
generate_shardsc(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.