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

Introduce wgpu based re_renderer (experimental!) #175

Merged
merged 19 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 37 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ opt-level = 2
debug = true

[patch.crates-io]
# 2022-10-06 - wgpu on web
eframe = { git = "https://github.com/emilk/egui", rev = "3ec170cc1e2309345df04b5e2a083b3b452c012f" }
egui = { git = "https://github.com/emilk/egui", rev = "3ec170cc1e2309345df04b5e2a083b3b452c012f" }
egui_extras = { git = "https://github.com/emilk/egui", rev = "3ec170cc1e2309345df04b5e2a083b3b452c012f" }
egui_glow = { git = "https://github.com/emilk/egui", rev = "3ec170cc1e2309345df04b5e2a083b3b452c012f" }
egui-wgpu = { git = "https://github.com/emilk/egui", rev = "3ec170cc1e2309345df04b5e2a083b3b452c012f" }
# 2022-10-07 - wgpu update
eframe = { git = "https://github.com/emilk/egui", rev = "f61044cef7ae0d127f8608ac0c8c129aca00a0f2" }
egui = { git = "https://github.com/emilk/egui", rev = "f61044cef7ae0d127f8608ac0c8c129aca00a0f2" }
egui_extras = { git = "https://github.com/emilk/egui", rev = "f61044cef7ae0d127f8608ac0c8c129aca00a0f2" }
egui_glow = { git = "https://github.com/emilk/egui", rev = "f61044cef7ae0d127f8608ac0c8c129aca00a0f2" }
egui-wgpu = { git = "https://github.com/emilk/egui", rev = "f61044cef7ae0d127f8608ac0c8c129aca00a0f2" }

# Because gltf hasn't published a new version: https://github.com/gltf-rs/gltf/issues/357
gltf = { git = "https://github.com/rerun-io/gltf", rev = "3c14ded73755d1ce9e47010edb06db63cb7e2cca" }
16 changes: 16 additions & 0 deletions crates/re_renderer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "re_renderer"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
publish = false

[dependencies]


[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
wgpu = { version="0.14", default-features = false }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wgpu = { version="0.14", default-features = false, features = ["webgl"] }
3 changes: 3 additions & 0 deletions crates/re_renderer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The Rerun renderer

A [wgpu](https://github.com/gfx-rs/wgpu/) based renderer for all your visualization needs.
32 changes: 32 additions & 0 deletions crates/re_renderer/shader/test_triangle.wgsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

struct VertexOut {
@location(0) color: vec4<f32>,
@builtin(position) position: vec4<f32>,
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
};

var<private> v_positions: array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(0.0, 1.0),
vec2<f32>(1.0, -1.0),
vec2<f32>(-1.0, -1.0),
);

var<private> v_colors: array<vec4<f32>, 3> = array<vec4<f32>, 3>(
vec4<f32>(1.0, 0.0, 0.0, 1.0),
vec4<f32>(0.0, 1.0, 0.0, 1.0),
vec4<f32>(0.0, 0.0, 1.0, 1.0),
);

@vertex
fn vs_main(@builtin(vertex_index) v_idx: u32) -> VertexOut {
var out: VertexOut;

out.position = vec4<f32>(v_positions[v_idx], 0.0, 1.0);
out.color = v_colors[v_idx];

return out;
}

@fragment
fn fs_main(in: VertexOut) -> @location(0) vec4<f32> {
return in.color;
}
Loading