-
Notifications
You must be signed in to change notification settings - Fork 2
PoC renderer #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
Draft
sp0lsh
wants to merge
69
commits into
Pillware:main
Choose a base branch
from
sp0lsh:feat/poc-render
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
PoC renderer #14
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
fc6fc48
fix: mac renderer start
sp0lsh 3c6d256
fix: launcher, create new project
sp0lsh 64bcc21
fix: template res names
sp0lsh e4832ac
feat: renderer design
sp0lsh 8ee28c4
docs
sp0lsh 8164662
m1: black window
sp0lsh 455f7ca
feat: m3, render bunch of pills
sp0lsh 73553f1
feat: M3, refactor culling
sp0lsh 212bee5
feat: M3, group draw calls by meterial and mesh
sp0lsh 5bbbc97
feat: M4 bring back the material
sp0lsh c0b57bc
feat: M4 update time measure
sp0lsh f943910
fix: build warning
sp0lsh ffbf786
feat: inlining pipeline
sp0lsh 2d159e5
feat: M4 prebuilt PSO
sp0lsh 9cb7de5
feat: timers
sp0lsh c36fd74
feat: marix update 15ms -> 0.5ms with SIMD
sp0lsh fb6de9e
feat: M5 per frame ring buffer to avoid dynamic uniforms per frame al…
sp0lsh c5a1dfc
feat: mac retina preferred window setup
sp0lsh 8f29d33
feat: stop log spam
sp0lsh 2a3ca06
feat: egui, show resolution
sp0lsh 344b94e
feat: demo project
sp0lsh 0252abb
feat: remove double sorting queue
sp0lsh b40a988
feat: comments vs rendering talk
sp0lsh 813a29b
feat: instance batching +5-10 fps
sp0lsh 3cca425
feat: add counters
sp0lsh 0241ce5
feat: ignore due to file change each build
sp0lsh 959e969
feat: M6 render to offscreen RT and compose to framebuffer
sp0lsh eec95f3
feat: M6 HDR, tonnemap
sp0lsh 01832a7
feat: M6 overlay quad pass
sp0lsh 41f547f
feat: M6 overlay bookkeeping
sp0lsh 1f274af
feat: M6 texture overlay
sp0lsh f6b9d8c
feat: M6 depth overlay
sp0lsh 4cec7b8
feat: align bind groups with talk
sp0lsh 9c93c97
docs
sp0lsh c5760d0
draft renderer pass API
sp0lsh d9ea8be
feat: add renderer system init
sp0lsh e20962c
remove State logic nesting
sp0lsh 177b8cb
feat: renderer factory method, pipeline v2
sp0lsh 59f54e4
feat: pass interface
sp0lsh c0b9955
fixme: mutability workadround until happy with passes
sp0lsh e4ab060
feat: pass example
sp0lsh d12dfc7
feat: simplify pass with no resource storage
sp0lsh 557dcad
feat: pass overlay logo
sp0lsh ef4998c
feat: pass overlay depth
sp0lsh 676cd3d
feat: move compose to a pass
sp0lsh 24a8cd5
fix: remove model matrix, per draw 144 -> 80 bytes
sp0lsh 325566f
feat: preallocate render() containers
sp0lsh 4a9568d
feat: use glam with SIMD for culling
sp0lsh e4076b1
feat: preallocate system dirty entities
sp0lsh 12d3c78
feat: resource pools with minimal handles and vector lookup
sp0lsh 4a619f5
wip: pass scene
sp0lsh 32e389d
wip: pass scene, local camera
sp0lsh 300de4e
wip: pass scene, pipeline
sp0lsh f2eaae8
wip: pass scene, materialfull
sp0lsh efdc248
feat: pbr basic
sp0lsh 394922d
feat: gltf basic (.glb)
sp0lsh 1eb2392
feat: gltf model sponza
sp0lsh 20acb09
move passes creation to engine
sp0lsh 40bb2f3
consolidated renderer in engine with wgpu rhi
sp0lsh 4a5e8b8
fix path
sp0lsh be47968
cleanup resource manager
sp0lsh 51a6a77
cleanup resource manager
sp0lsh 2dd2e91
feat: PassEgui
sp0lsh 8c54158
cleanup warnings
sp0lsh 594c6a3
feat: ibl, TODO: cleanup
sp0lsh c1d7636
feat: linear depth
sp0lsh b2aa66f
feat: depth of field pass, fixed depth projection
sp0lsh 4500973
feat: velocity buffer + per object motion blur
sp0lsh b324f33
feat: lastest demo
sp0lsh 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 hidden or 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 |
|---|---|---|
|
|
@@ -6,3 +6,5 @@ build/ | |
|
|
||
| crates/pill_standalone/Cargo.toml | ||
| examples/*/Cargo.toml | ||
|
|
||
| engine/Cargo.toml | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [build] | ||
| # Enable SIMD optimizations for math operations | ||
| # This will auto-vectorize cgmath operations when possible | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rebase on glam - we probably get auto-vectorization from the get-go |
||
| rustflags = ["-C", "target-cpu=native"] | ||
|
|
||
| # Alternative: More conservative SIMD flags | ||
| # rustflags = ["-C", "target-feature=+avx2,+fma"] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sometimes we might want avx512 etc |
||
|
|
||
| [target.x86_64-unknown-linux-gnu] | ||
| rustflags = ["-C", "target-cpu=native"] | ||
|
|
||
| [target.x86_64-apple-darwin] | ||
| rustflags = ["-C", "target-cpu=native"] | ||
|
|
||
| [target.x86_64-pc-windows-msvc] | ||
| rustflags = ["-C", "target-cpu=native"] | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| use core::fmt; | ||
| use core::hash::{Hash, Hasher}; | ||
| use core::marker::PhantomData; | ||
|
|
||
| #[repr(transparent)] | ||
| pub struct Handle<T> { | ||
| raw: u64, | ||
| _marker: PhantomData<T>, | ||
| } | ||
|
|
||
| impl<T> Handle<T> { | ||
| #[inline] | ||
| pub const fn from_parts(index: u32, generation: u32) -> Self { | ||
| Self { | ||
| raw: ((generation as u64) << 32) | (index as u64), | ||
| _marker: PhantomData, | ||
| } | ||
| } | ||
|
|
||
| #[inline] | ||
| pub const fn index(&self) -> u32 { self.raw as u32 } | ||
|
|
||
| #[inline] | ||
| pub const fn generation(&self) -> u32 { (self.raw >> 32) as u32 } | ||
|
|
||
| pub const INVALID: Self = Self { raw: u64::MAX, _marker: PhantomData }; | ||
|
|
||
| #[inline] | ||
| pub const fn is_valid(&self) -> bool { self.raw != u64::MAX } | ||
| } | ||
|
|
||
| impl<T> Copy for Handle<T> {} | ||
| impl<T> Clone for Handle<T> { fn clone(&self) -> Self { *self } } | ||
| impl<T> PartialEq for Handle<T> { fn eq(&self, other: &Self) -> bool { self.raw == other.raw } } | ||
| impl<T> Eq for Handle<T> {} | ||
| impl<T> Hash for Handle<T> { fn hash<H: Hasher>(&self, state: &mut H) { self.raw.hash(state) } } | ||
| impl<T> fmt::Debug for Handle<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Handle({:#x})", self.raw) } } | ||
|
|
||
| struct Entry<V> { | ||
| generation: u32, | ||
| resource: Option<V>, | ||
| } | ||
|
|
||
| pub struct ResourcePool<K, V> { | ||
| entries: Vec<Entry<V>>, | ||
| free_list: Vec<u32>, | ||
| _marker: PhantomData<K>, | ||
| } | ||
|
|
||
| impl<K, V> ResourcePool<K, V> { | ||
| pub fn new() -> Self { | ||
| Self { | ||
| entries: Vec::new(), | ||
| free_list: Vec::new(), | ||
| _marker: PhantomData, | ||
| } | ||
| } | ||
|
|
||
| #[inline] | ||
| pub fn insert(&mut self, resource: V) -> Handle<K> { | ||
| if let Some(idx) = self.free_list.pop() { | ||
| let e = &mut self.entries[idx as usize]; | ||
| e.generation = e.generation.wrapping_add(1); | ||
| e.resource = Some(resource); | ||
| Handle::from_parts(idx, e.generation) | ||
| } else { | ||
| let idx = self.entries.len() as u32; | ||
| self.entries.push(Entry { generation: 0, resource: Some(resource) }); | ||
| Handle::from_parts(idx, 0) | ||
| } | ||
| } | ||
|
|
||
| #[inline] | ||
| pub fn remove(&mut self, h: Handle<K>) -> Option<V> { | ||
| let idx = h.index() as usize; | ||
| if idx >= self.entries.len() { | ||
| return None; | ||
| } | ||
| let e = &mut self.entries[idx]; | ||
| if e.generation != h.generation() { | ||
| return None; | ||
| } | ||
| let res = e.resource.take(); | ||
| e.generation = e.generation.wrapping_add(1); | ||
| self.free_list.push(h.index()); | ||
| res | ||
| } | ||
|
|
||
| #[inline] | ||
| pub fn get(&self, h: Handle<K>) -> Option<&V> { | ||
| let idx = h.index() as usize; | ||
| if idx >= self.entries.len() { | ||
| return None; | ||
| } | ||
| let e = &self.entries[idx]; | ||
| if e.generation != h.generation() { | ||
| return None; | ||
| } | ||
| e.resource.as_ref() | ||
| } | ||
|
|
||
| #[inline] | ||
| pub fn get_mut(&mut self, h: Handle<K>) -> Option<&mut V> { | ||
| let idx = h.index() as usize; | ||
| if idx >= self.entries.len() { | ||
| return None; | ||
| } | ||
| let e = &mut self.entries[idx]; | ||
| if e.generation != h.generation() { | ||
| return None; | ||
| } | ||
| e.resource.as_mut() | ||
| } | ||
| } | ||
|
|
||
|
|
This file contains hidden or 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 hidden or 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.
I know why you are doing that, though this is probably not the best solution 😓
The launcher will constantly update the paths in
engine/Cargoand show this file as changed. Honestly did not find a good solution for that except callinggit add engine/pill_*when staging files.