-
Notifications
You must be signed in to change notification settings - Fork 545
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
Lower level GPU abstraction #1102
Comments
We already have these 3 levels of resource type abstraction:
So the transition would be to make gfx_core operate on |
This is really difficult with regards to Vulkan/D3D12 as we would have to provide a very thin layer above those two APIs exposing concepts like resource barriers and explicit memory control. There was a talk by Chajdas concerning this some time ago (http://gpuopen.com/wp-content/uploads/2016/03/d3d12_vulkan_lessons_learned.pdf), which states that such a low level wrapper might be the best way for implementation. I assume the new architecture would be to implement |
@msiglreith thanks for the info! You seem to not only understand the goal clearly, but also already having the first bits of the implementation. That's pretty impressive and exciting to see 👍 |
Initial groundwork for a low level api ## Motivation The next gen APIs (Vulkan and D3D12) offer an low level interface of the GPU in comparison to older APIs like OpenGL or D3D11. To avoid overhead due to high level abstraction we want to investigate the implementation of a thin wrapper above the mentioned low level APIs to address #1102. ## Goals This PR creates a new low level core API `corell` and two backend implementations for the low level core. corell is heavily based on the vulkan API and shares a lot of concepts like `Instance`, `Surface`, etc., but tries to also take d3d12 into account. In future steps further abstractions could be considered to reduce the amount of setup code. Planned coverage for this PR: - [x] Instance/Context - [x] Surface - [x] Swapchain - [x] PhysicalDevice Note: Also includes some dummy types for other objects. `format` and `memory` are mainly copied from `core`. Hoping for early feedback if this is the intended way to go with regards to #1102. cc @MaikKlein for quick checking ash based vulkan implementation if you have time 😄
Small status update for New factory interface (haven't worked out the factory methods for RenderPass and Signature so far): fn create_shader_library(&mut self, code: &[u8]) -> Result<R::ShaderLib, shade::CreateShaderError>;
fn create_graphics_pipelines<'a>(&mut self, &[(&GraphicsShaderSet<R>, &R::PipelineSignature, &R::SubPass, &pso::GraphicsPipelineDesc)])
-> Vec<Result<R::PipelineStateObject, pso::CreationError>>;
fn create_compute_pipelines(&mut self) -> Vec<Result<R::PipelineStateObject, pso::CreationError>>; I'm still a bit unsure about how to handle |
Conceptually, this is implemented 🎉 . Separate issues are filed for missing features. |
We need to provide a level of GPU abstraction that doesn't have any overhead over using some API bindings directly. That means no resource lifetime management and preferably no heap allocation.
If we try to implement such a layer from scratch, we'd end up re-using most of the existing code from gfx_core and the backends. Thus, I believe we should steer the gfx_core towards this no-overhead goal, reaching it before we stabilize the API.
One effect of this transition would be - clearer separation between gfx_render and gfx_core. Another - opened use cases for applications demanding no overhead, like webrender. These applications may have limited use cases, allowing them to manage resource lifetimes more efficiently than us.
The text was updated successfully, but these errors were encountered: