-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
What if Ash #12
What if Ash #12
Conversation
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.
This is awesome! Looking forward to using it. 👍
factory/src/config.rs
Outdated
} | ||
|
||
#[allow(unused)] | ||
fn fmt_version(version: &u32, fmt: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> { |
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.
You can use std::fmt::Formatter
now in 1.30 😄
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.
Finally.
Can I omit extern crate <name>;
now?
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 don't think so that will probably come in the next few releases as we inch closer to 2018 edition
extensions: Vec<ExtensionProperties>, | ||
} | ||
|
||
/// The `Factory<D>` type represents the overall creation type for `rendy`. |
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.
You can remove the generic on the Factory type I believe
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.
👍
@@ -0,0 +1,38 @@ | |||
|
|||
# `gfx-mesh` |
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.
😄
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.
Whoops.
hal = ["gfx-hal", "rendy-memory/hal", "rendy-resource/hal", "rendy-command/hal"] | ||
vulkan = ["ash", "rendy-memory/vulkan", "rendy-resource/vulkan", "rendy-command/vulkan"] | ||
[dev-dependencies] | ||
ash = { path = "../../ash/ash" } |
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.
Could you say what version of ash? I'm assuming off of the code that is in the WIP builder branch of ash?
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.
It's MatusT
's fork, generator
branch, with my patch.
It must be in main repo generator
branch soon (before merge).
If needed I can put it into my own fork for now.
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.
Yeah, I think that would be useful so I can try and build this locally as well 👍
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 I say wow? Awesome job Viral! I'm still not 100% convinced about removing hal considering we already had so much of the abstraction in place, but I'm sure you have a good plan for it.
} | ||
} | ||
|
||
pub unsafe trait HeapsConfigure { |
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.
This name seems a bit off to me. Shouldn't it be something like HeapsConfig
or HeapsConfiguration
?
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.
It's not a configuration, it's a configurer. I would opt for something like ConfigureHeaps
or HeapsConfigurer
.
}?; | ||
trace!("Instance created"); | ||
|
||
let surface = Surface::new(&entry, &instance) |
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.
Should we really provide a surface by default? I may be wrong here, but in VR for example, although you do almost always end up with a window somehow, it might now be desirable to have. Rather you would just use whatever you get from the compositor.
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.
No, we shouldn't. We'll add it to configuration.
.application_name(&CString::new(config.app_name)?) | ||
.application_version(config.app_version) | ||
.build(), | ||
).enabled_extension_names(&extensions_to_enable(&extensions)?) |
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.
Is this just enabling all extensions unconditionally? I think a better solution would be to have a set of required extensions that rendy always requires and then allow the user to pass in what extensions they need.
physical.handle, | ||
&DeviceCreateInfo::builder() | ||
.queue_create_infos(&create_queues) | ||
.enabled_extension_names(&extensions_to_enable(&physical.extensions).unwrap()) |
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.
We need a callback here to enable more extensions. OpenVR (and probably more XR compositors) require to be able to enable specific extensions based off of a physical device.
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.
Definitely. I'll add a TODO
factory/src/factory.rs
Outdated
.cloned() | ||
.filter_map(|name| { | ||
let cstr_name = CStr::from_ptr(name); | ||
trace!("Look for {:?}", cstr_name); |
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 clarify what you're looking for here so the logs aren't too confusing to someone that doesn't really know graphics programming? 😅
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.
That's my debugging stuff 😅
#[derivative(Debug(bound = "T: Debug", format_with = "super::memory_ptr_fmt"))] | ||
memory: *const Memory<T>, | ||
pub struct ArenaBlock { | ||
// #[derivative(Debug(format_with = "::memory::memory_ptr_fmt"))] |
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.
Commented code
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.
Derivative seems broken somehow. I'll uncomment once it works again.
index: u32, | ||
#[derivative(Debug(bound = "T: Debug", format_with = "super::memory_ptr_fmt"))] | ||
memory: *const Memory<T>, | ||
// #[derivative(Debug(format_with = "super::memory_ptr_fmt"))] |
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.
Commented code
match block { | ||
BlockFlavor::Dedicated(block) => self.dedicated.free(device, block), | ||
BlockFlavor::Arena(block) => self.arena.as_mut().unwrap().free(device, block), | ||
BlockFlavor::Dynamic(block) => self.dynamic.as_mut().unwrap().free(device, block), | ||
// BlockFlavor::Chunk(block) => self.chunk.free(device, block), |
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.
How come you removed this line when you still have Chunk
commented out on the various config structs?
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.
Should remove it everywhere.
len, | ||
}) | ||
}).collect::<Result<_, Error>>()?, | ||
ibuf: match self.indices { |
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 think this match
can be replaced with a simple .map()
|
||
/// Error type returned by `Mesh::bind` in case of mesh's vertex buffers are incompatible with requested vertex formats. | ||
#[derive(Clone, Copy, Debug)] | ||
pub struct Incompatible; |
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.
Shouldn't we have a failure error enum here like for the other crates?
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.
Definitely
What's the reasoning behind "Abandon hal for now."? |
"Arenas are not empty during allocator disposal. Arenas: {:#?}", | ||
self.arenas | ||
); | ||
if !self.arenas.is_empty() { |
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.
Add debug_assert maybe? So it crashes on debug mode, but only logs on release?
@kvark without reinventing the wheel (abstraction layer over Instead of providing own abstractions I believe it is better to implement |
To the reader: please note that "dropping hal" does not mean that hal will not have anything to do with rendy. Viral is focusing on ash right now as it is closer to Vulkan so easier to use for him, but when all of this is done rendy is made in such a way that it will be "easy" to implement the hal backend. It's just to not have to implement two backends at once. |
@Moxinilian thank you for clarification. I don't see the story the same way. gfx-hal is already pretty much Vulkan, just a bit rustier (borrowing, move semantics, and references instead of pointers and opaque handles). You could just have used gfx-hal and have access to all platforms, while benefiting gfx-rs community with your feedback. Truth is that @omni-viral found gfx-hal inconvenient for their needs, hence the departure. I don't see it temporary. The expressed solution (in https://github.com/rustgd/rendy/pull/12#issuecomment-434338491) is basically - solve it on the Ash level, so that Amethyst wouldn't care about gfx-rs APIs. Tight Ash (and Vulkano) integration is certainly one of our goals, but it's not going to be the most performant path at the end of the day, so we'd like Rust projects which really need performance (like Amethyst and WebRender) to work with gfx-hal directly. |
There is enough motivation within the Amethyst team to make sure hal will be supported by rendy, most notably in the perspective of WebGL (and eventually WebGPU). From what has been discussed on Discord, it seems like first class hal is planned in the future. If I misunderstood, then this is going to be a much larger issue considering Amethyst's next step after mobile support will be web technologies, in which gfx-hal would help in a significant way. |
@Moxinilian FYI, this is a very poor communication on the Amethyst side. Your team discussed something on discord (which we don't even have any visibility into, since we use Gitter) and decided to drop gfx-hal without any heads up to our team, without even bothering to explain this in PR description... We hope that in the future, if there is any news of that scale, we'd know about it from you. |
Yes, I agree. If I recall correctly, an issue is being written to be posted on the gfx issue tracker regarding the reasons for such a decision. I still believe that supporting hal from the ground up would have been better, but I am not involved enough in rendering to have a meaningful opinion. |
We handled this very poorly, and apologize to the entire gfx-hal team. It was inexcusable, and we will take steps internally to ensure it doesn't happen again. We would like to re-open a dialog on this with the gfx-hal team, if they are ok with it. |
@kvark Sorry I didn't explained in detail why I abandoned hal in this PR. I also sad for that I didn't state my opinion clearly in gfx-rs/gfx#2206 😭 Correct me if I'm wrong. Sorry. It's hard for me to express sophisticated stuff in language I barely know. It took me 15 minutes to write this comment 😅 |
This PR accumulates lots of commits I made for last weekend.
Overview:
init
example loads Vulkan by instantiatingFactory
.window
example useswsi
sub-crate to create render target for window.simple
example (WIP) draws simple mesh.This change is