vulkan renderer - #2165
Conversation
1. This moves around a lot of logic from backend/allocator/vulkan into backend/vulkan to generalize for use in the renderer. 2. It also expands the modules in backend/vulkan significantly to provide more useful abstractions around vulkan objects and their initialization logic. 3. The vulkan renderer then itself deals mostly with specialized drawing related functionality as well as implementating the various renderer-trait semantics by creating the right vulkan objects with the right set of flags. 4. Most testing so far has been done with examples/vulkan.rs. The render itself still lacks a lot of functionality needed to run a full compositor.
|
https://github.com/Pheoxy/smithay/tree/add-vulkan-renderer-support-cosmic-e3d461a This is my fork branch where I'm working on figuring out Vulkan myself. It's a bit dirty but it was never intended to be a PR branch. |
| pub fn queue(&self) -> &Queue { | ||
| &self.0.queue | ||
| } |
There was a problem hiding this comment.
https://docs.vulkan.org/refpages/latest/refpages/source/vkQueueSubmit.html
Host access to queue must be externally synchronized if it was not created with VK_DEVICE_QUEUE_CREATE_INTERNALLY_SYNCHRONIZED_BIT_KHR
Maybe this should return a &Mutex<vk::Queue>, which would enforce the necessary synchronization.
| unsafe { | ||
| self.renderer | ||
| .device | ||
| .vk() | ||
| .queue_submit( | ||
| *self.renderer.device.queue(), | ||
| &[SubmitInfo::default() | ||
| .command_buffers(&[buf]) | ||
| .signal_semaphores(&[self.renderer.timeline.vk]) | ||
| .push_next(&mut timeline_info)], | ||
| Fence::null(), | ||
| ) | ||
| .map_err(Error::SubmitError)?; | ||
| } | ||
|
|
||
| self.renderer | ||
| .cmd_pool | ||
| .store_pending_buffer(buf, next_seq_no[0], descriptor); |
There was a problem hiding this comment.
It seems like the best practice is generally to call vkQueueSubmit only once per frame. For instance in https://gpuopen.com/learn/rdna-performance-guide:
Ideally, submissions would only happen when syncing queues or at the end of a frame.
So we probably want to store a vk::CommandBufer in VulkanFrame and submit in VulkanFrame::finish?
| { | ||
| return Err(Error::MismatchedDrmDevice); | ||
| } | ||
| Some(node) |
There was a problem hiding this comment.
I noticed a typo here:
current
let node = DrmNode::from_file(fd).map_err(|_| Error::MismatchedDrmDevice)?;
if !(phd.render_node().ok().flatten().is_some_and(|node| node == node)
|| phd.primary_node().ok().flatten().is_some_and(|node| node == node))it should be
let node = DrmNode::from_file(fd).map_err(|_| Error::MismatchedDrmDevice)?;
if !(phd.render_node().ok().flatten().is_some_and(|n| n == node)
|| phd.primary_node().ok().flatten().is_some_and(|n| n == node))
Description
Very early draft of a vulkan renderer.
backend/vulkan to generalize for use in the renderer.
provide more useful abstractions around vulkan objects and their
initialization logic.
related functionality as well as implementating the various
renderer-trait semantics by creating the right vulkan objects with
the right set of flags.
itself still lacks a lot of functionality needed to run a full
compositor.
Checklist