Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSpecs aware Pipeline #317
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Aug 29, 2017
Member
Woops. The recent rustfmt merge probably messed this up. Do you mind fixing it?
|
Woops. The recent rustfmt merge probably messed this up. Do you mind fixing it? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I will |
omni-viral
requested review from
ebkalderon,
Xaeroxe and
torkleyy
Aug 29, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Aug 29, 2017
Member
Got some compile errors :/
error[E0243]: wrong number of type arguments: expected 1, found 0
--> src/ecs/rendering/systems.rs:73:45
|
73 | impl<'a, 'b> SystemExt<'a, (&'b EventsLoop, PipelineBuilder, Option<DisplayConfig>)>
| ^^^^^^^^^^^^^^^ expected 1 type argument
error[E0243]: wrong number of type arguments: expected 1, found 0
--> src/ecs/rendering/systems.rs:22:11
|
22 | pipe: Pipeline,
| ^^^^^^^^ expected 1 type argument
error[E0243]: wrong number of type arguments: expected 1, found 0
--> src/ecs/rendering/systems.rs:78:50
|
78 | (events, pipe, config): (&'b EventsLoop, PipelineBuilder, Option<DisplayConfig>),
| ^^^^^^^^^^^^^^^ expected 1 type argument
error[E0243]: wrong number of type arguments: expected 1, found 0
--> src/app.rs:242:15
|
242 | pipe: PipelineBuilder,
| ^^^^^^^^^^^^^^^ expected 1 type argument
Can you fix these please?
|
Got some compile errors :/
Can you fix these please? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Amethyst is not compiling. I've worked only in renderer crate yet. |
| +} | ||
| + | ||
| + | ||
| + |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Aug 31, 2017
Member
Could you please reduce the number of subsequent empty lines to 1? I can see why some people use two of them, but 4?
torkleyy
Aug 31, 2017
Member
Could you please reduce the number of subsequent empty lines to 1? I can see why some people use two of them, but 4?
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Aug 31, 2017
Member
Can we update amethyst to use this new PR properly prior to merging? I like it when Travis is happy.
|
Can we update amethyst to use this new PR properly prior to merging? I like it when Travis is happy. |
Xaeroxe
removed their request for review
Aug 31, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Aug 31, 2017
Member
@Xaeroxe of course. Supporting new feature in RenderSystem and other parts of main crate will be step two. But will be done prior merging.
|
@Xaeroxe of course. Supporting new feature in |
torkleyy
added
project: rendering
status: working
type: feature
labels
Sep 1, 2017
omni-viral
changed the title from
[draft] Polymorphic pipeline
to
[WIP] Specs aware Pipeline
Sep 8, 2017
Xaeroxe
approved these changes
Sep 8, 2017
I love it! This looks to have better performance and be more robust. Thanks!
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Sep 8, 2017
Member
Things to resolve before I can r+ this:
- Resolve merge conflicts
- Update amethyst to use this correctly.
|
Things to resolve before I can r+ this:
|
| + | ||
| +impl Component for Light { | ||
| + type Storage = DenseVecStorage<Self>; | ||
| +} |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| @@ -150,3 +152,7 @@ where | ||
| }) | ||
| } | ||
| } | ||
| + | ||
| +impl Component for Mesh { | ||
| + type Storage = VecStorage<Self>; |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Sep 9, 2017
Member
It's just the same MeshComponent uses now.
I haven't dive deep into "what Storage to use?" yet.
omni-viral
Sep 9, 2017
•
Member
It's just the same MeshComponent uses now.
I haven't dive deep into "what Storage to use?" yet.
| -pub trait PassCompiler { | ||
| - fn compile(&self, effect: NewEffect) -> Result<Effect>; | ||
| +pub trait PassData<'a> { | ||
| + type Data: SystemData<'a> + Send; |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Aceeri
Sep 8, 2017
Member
Are these "parent" traits to SystemData for extensibility? Or is it just restricting the types more?
Aceeri
Sep 8, 2017
Member
Are these "parent" traits to SystemData for extensibility? Or is it just restricting the types more?
omni-viral
requested a review
from
Xaeroxe
Sep 9, 2017
Xaeroxe
approved these changes
Sep 9, 2017
Looks great! I'm excited to see it in action!
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
This pr breaks pr #334 ,making is unusable. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Sep 15, 2017
Member
@jojolepro This PR is going to have to be rebased anyways, given that #334 is closer to completion let's merge it first.
|
@jojolepro This PR is going to have to be rebased anyways, given that #334 is closer to completion let's merge it first. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Sep 16, 2017
Collaborator
#334 Got closed as it would be useless to make it just to see it replaced soon after.
Hype for the new pipeline!
|
#334 Got closed as it would be useless to make it just to see it replaced soon after. |
omni-viral
changed the title from
[WIP] Specs aware Pipeline
to
Specs aware Pipeline
Sep 16, 2017
| + for RenderSystem<P> | ||
| + where B: PipelineBuild<Pipeline=P>, | ||
| + P: Pipeline, | ||
| +{ | ||
| /// Create new `RenderSystem` |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Sep 16, 2017
Member
Can't you remove the P bound here, and just do for RenderSystem<B::Pipeline> where B: PipelineBuild?
Rhuagh
Sep 16, 2017
Member
Can't you remove the P bound here, and just do for RenderSystem<B::Pipeline> where B: PipelineBuild?
omni-viral
requested a review
from
Xaeroxe
Sep 16, 2017
jojolepro
reviewed
Sep 16, 2017
As this is absolutely massive and I don't want to spend a week reading the code and checking every single thing I'm unsure of, I put in comments my questions, mostly about naming. Hope this helps.
| [dev-dependencies] | ||
| -genmesh = "0.4" | ||
| +genmesh = "0.4" |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Sep 16, 2017
Collaborator
Should there be a new line on the last line? Git put a red symbol.
jojolepro
Sep 16, 2017
Collaborator
Should there be a new line on the last line? Git put a red symbol.
| @@ -103,7 +107,10 @@ fn main() { | ||
| _ => (), | ||
| }); | ||
| - renderer.draw(&scene, &pipe, delta); | ||
| + let data = List::new().push(List::new().push( |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Sep 16, 2017
Collaborator
A list in a list? Mind explaining why you need to have them like this?
jojolepro
Sep 16, 2017
Collaborator
A list in a list? Mind explaining why you need to have them like this?
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Sep 16, 2017
Member
It is List of List because Passes are in List in Stages which are in List in Pipeline. The data for Passes is arranged the same way.
Although examples from amethyst_renderer crate aren't refactored for latest changes in Pipeline.
omni-viral
Sep 16, 2017
Member
It is List of List because Passes are in List in Stages which are in List in Pipeline. The data for Passes is arranged the same way.
Although examples from amethyst_renderer crate aren't refactored for latest changes in Pipeline.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| @@ -70,7 +76,10 @@ fn main() { | ||
| _ => (), | ||
| }); | ||
| - renderer.draw(&scene, &pipe, delta); | ||
| + let data = List::new().push(List::new().push( |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| @@ -76,7 +82,44 @@ struct PointLight2 { | ||
| unsafe impl Pod for PointLight2 {} |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Sep 19, 2017
Member
Well. If you're curious. This type us POD representation with padding of PointLight to pass into shader.
omni-viral
Sep 19, 2017
•
Member
Well. If you're curious. This type us POD representation with padding of PointLight to pass into shader.
| -pub use pipe::{Pipeline, PipelineBuilder, Stage, StageBuilder, Target}; | ||
| -pub use scene::{Model, Scene}; | ||
| +pub use pipe::{Pipeline, PipelineBuilder, Stage, StageBuilder, Target, TheStage, ThePipeline}; | ||
| +//pub use scene::{Model, Scene}; |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| - world.register::<LightComponent>(); | ||
| - world.register::<MaterialComponent>(); | ||
| - world.register::<MeshComponent>(); | ||
| + world.register::<Light>(); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Sep 16, 2017
Collaborator
Any reason to remove the "Component" part of the Component? It made it pretty easy to know the data we are manipulating.
jojolepro
Sep 16, 2017
Collaborator
Any reason to remove the "Component" part of the Component? It made it pretty easy to know the data we are manipulating.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Sep 16, 2017
Collaborator
Simplicity vs expressiveness basically. Just make sure that we are consistent across the engine with that to avoid confusion.
jojolepro
Sep 16, 2017
•
Collaborator
Simplicity vs expressiveness basically. Just make sure that we are consistent across the engine with that to avoid confusion.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Sep 16, 2017
Member
I have a plan to remove (Mesh/Material/Light)Component wrapping. But it is not in the scope of this PR. I'll remove those changes
omni-viral
Sep 16, 2017
Member
I have a plan to remove (Mesh/Material/Light)Component wrapping. But it is not in the scope of this PR. I'll remove those changes
added a commit
to omni-viral/amethyst
that referenced
this pull request
Sep 16, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Sep 16, 2017
Collaborator
(Please note that I didn't do a throughout check of the code)
There, have my seal of approval!
https://media.giphy.com/media/uTv1bQNRPFYTS/giphy.gif
|
(Please note that I didn't do a throughout check of the code) |
Xaeroxe
requested changes
Sep 17, 2017
Documentation is a little bare in some places on 2nd review, otherwise this looks great, thanks!
Side note: if some of these generic bounds from the impl sections were instead added to the structure itself a lot of doc comments wouldn't be necessary.
| @@ -37,9 +37,9 @@ num_cpus = "1.2" | ||
| genmesh = "0.4" | ||
| imagefmt = "4.0" | ||
| shred = "0.4" | ||
| -specs = "0.9.5" | ||
| -rayon = "0.8" | ||
| +rayon = "0.7" |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| @@ -17,14 +23,17 @@ static FRAG_SRC: &[u8] = include_bytes!("shaders/fragment/flat.glsl"); | ||
| /// Draw mesh without lighting | ||
| #[derive(Clone, Debug, PartialEq)] | ||
| -pub struct DrawFlat<V> { | ||
| +pub struct DrawFlat<V, M, N, T> { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Sep 17, 2017
Member
It would be nice to have a little documentation as to what all of these generic parameters are supposed to be
Xaeroxe
Sep 17, 2017
Member
It would be nice to have a little documentation as to what all of these generic parameters are supposed to be
| @@ -20,18 +26,18 @@ static FRAG_SRC: &[u8] = include_bytes!("shaders/fragment/pbm.glsl"); | ||
| /// Draw mesh without lighting | ||
| #[derive(Clone, Debug, PartialEq)] | ||
| -pub struct DrawPbm<V> { | ||
| +pub struct DrawPbm<V, A, M, N, T, L> { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| @@ -20,17 +26,17 @@ static FRAG_SRC: &[u8] = include_bytes!("shaders/fragment/shaded.glsl"); | ||
| /// Draw mesh without lighting | ||
| #[derive(Clone, Debug, PartialEq)] | ||
| -pub struct DrawShaded<V> { | ||
| +pub struct DrawShaded<V, A, M, N, T, L> { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| - effect, | ||
| - inner: self.0, | ||
| - }) | ||
| + unsafe fn get(&self) -> (&mut Encoder, &mut Effect) { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Sep 17, 2017
Member
I know this isn't part of the public API but just for the sake of future maintainers can we document why this is unsafe and what conditions need to be guaranteed by the developer before they call this?
Xaeroxe
Sep 17, 2017
Member
I know this isn't part of the public API but just for the sake of future maintainers can we document why this is unsafe and what conditions need to be guaranteed by the developer before they call this?
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Sep 17, 2017
Member
@Xaeroxe I follow the idea to have minimum bounds possible. Therefore I almost never introduce bounds on struct definition.
|
@Xaeroxe I follow the idea to have minimum bounds possible. Therefore I almost never introduce bounds on struct definition. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Sep 17, 2017
Member
That makes sense, can we still add doc comments for what those parameters are supposed to be?
|
That makes sense, can we still add doc comments for what those parameters are supposed to be? |
| @@ -0,0 +1,10 @@ | ||
| +( | ||
| + dimensions: None, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Sep 17, 2017
Member
I've copied it from other examples. Should I fix formatting there too?
omni-viral
Sep 17, 2017
Member
I've copied it from other examples. Should I fix formatting there too?
| + let config = DisplayConfig::load(&path); | ||
| + let mut game = Application::build(Example)? | ||
| + .with_renderer( | ||
| + ThePipeline::build().with_stage( |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Sep 17, 2017
Member
I gave it the name just because Pipeline is occupied by trait
If you have better idea you're welcome to share
omni-viral
Sep 17, 2017
•
Member
I gave it the name just because Pipeline is occupied by trait
If you have better idea you're welcome to share
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Sep 18, 2017
Member
I guess my question is why do we have a trait for this? Under what circumstances would someone want to use a pipeline other than ours?
Xaeroxe
Sep 18, 2017
Member
I guess my question is why do we have a trait for this? Under what circumstances would someone want to use a pipeline other than ours?
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Sep 18, 2017
Member
We have a trait to simplify bounds on type parameters.
Either it is P where P: Pipeline or Pipeline<S> where S: Stages.
Well. Before refactoring the second variant was much more sophisticated...
omni-viral
Sep 18, 2017
Member
We have a trait to simplify bounds on type parameters.
Either it is P where P: Pipeline or Pipeline<S> where S: Stages.
Well. Before refactoring the second variant was much more sophisticated...
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Sep 19, 2017
Member
And I think that PIpeline<S> where S: Stages looks unclear rather than P: Pipeline.
omni-viral
Sep 19, 2017
Member
And I think that PIpeline<S> where S: Stages looks unclear rather than P: Pipeline.
omni-viral
referenced this pull request
Sep 19, 2017
Closed
Crashes on Intel HD cpu driver (cannot reproduce) #344
omni-viral
added some commits
Sep 19, 2017
Xaeroxe
approved these changes
Sep 19, 2017
LGTM! Thanks! I've run this locally and it seems to work pretty well. Good work!
bors r+
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
|
Xaeroxe
added
status: ready
and removed
status: working
labels
Sep 19, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
bors r+ |
bot
added a commit
that referenced
this pull request
Sep 19, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Timed out |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Sigh.. overriding. |
omni-viral commentedAug 29, 2017
•
edited
Edited 1 time
-
omni-viral
edited Sep 8, 2017 (most recent)
Polymorphic
PipelineWhat does polymorphic
Pipelinedo?Just the same as the old
Pipelinedid, appliesPasses.What is the difference?
Passgets type parameter.What is it for?
Passwith type parameter can receive different data to draw on frame.One pass can get each entity with
MeshandMaterial, allLights and single camera and draw shaded meshes.Another can get only
Mesh,Materialpairs prepare everything to be drawn with deferred shading technique by next pass that gets called for eachLight.Special pass can draw animated 2d sprites from spritesheets. It requires no mesh but texture and additional data to pick sprite from spritesheet.
Integration with
specsThis
Pipelinedefines inputDatathat implementsspecs::SystemDataand may be fetched byRenderSystem.Complications
In polymorphic
PipelinePassis not object-safe trait and implementers can't be stored inBoxed trait objects. Therefore heterogeneous sequences are used.Heterogeneous sequences require a little bit more effort to work with. But
hetseqprovides all functionality we need.