-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jakob
committed
Feb 11, 2025
1 parent
f73daad
commit 996e57e
Showing
11 changed files
with
373 additions
and
306 deletions.
There are no files selected for viewing
This file contains 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
187 changes: 72 additions & 115 deletions
187
include/merian-nodes/connectors/managed_vk_image_out.hpp
This file contains 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 |
---|---|---|
@@ -1,122 +1,79 @@ | ||
#pragma once | ||
|
||
#include "merian-nodes/graph/connector_output.hpp" | ||
#include "merian-nodes/resources/managed_vk_image_resource.hpp" | ||
#ifndef MANAGED_VK_IMAGE_OUT_HPP | ||
#define MANAGED_VK_IMAGE_OUT_HPP | ||
#include "vk_image_out.hpp" | ||
|
||
namespace merian_nodes { | ||
|
||
class ManagedVkImageOut; | ||
using ManagedVkImageOutHandle = std::shared_ptr<ManagedVkImageOut>; | ||
|
||
// Output a Vulkan image that is allocated and managed by the graph. | ||
// Note that it only supplies a descriptor if stage_flags contains at least one bit. | ||
class ManagedVkImageOut : public TypedOutputConnector<ImageHandle> { | ||
public: | ||
ManagedVkImageOut(const std::string& name, | ||
const vk::AccessFlags2& access_flags, | ||
const vk::PipelineStageFlags2& pipeline_stages, | ||
const vk::ImageLayout& required_layout, | ||
const vk::ShaderStageFlags& stage_flags, | ||
const vk::ImageCreateInfo& create_info, | ||
const bool persistent = false); | ||
|
||
virtual std::optional<vk::DescriptorSetLayoutBinding> get_descriptor_info() const override; | ||
|
||
virtual void get_descriptor_update(const uint32_t binding, | ||
const GraphResourceHandle& resource, | ||
const DescriptorSetHandle& update, | ||
const ResourceAllocatorHandle& allocator) override; | ||
|
||
virtual ConnectorStatusFlags | ||
on_pre_process(GraphRun& run, | ||
const CommandBufferHandle& cmd, | ||
const GraphResourceHandle& resource, | ||
const NodeHandle& node, | ||
std::vector<vk::ImageMemoryBarrier2>& image_barriers, | ||
std::vector<vk::BufferMemoryBarrier2>& buffer_barriers) override; | ||
|
||
virtual ConnectorStatusFlags | ||
on_post_process(GraphRun& run, | ||
const CommandBufferHandle& cmd, | ||
const GraphResourceHandle& resource, | ||
const NodeHandle& node, | ||
std::vector<vk::ImageMemoryBarrier2>& image_barriers, | ||
std::vector<vk::BufferMemoryBarrier2>& buffer_barriers) override; | ||
|
||
virtual GraphResourceHandle | ||
create_resource(const std::vector<std::tuple<NodeHandle, InputConnectorHandle>>& inputs, | ||
const ResourceAllocatorHandle& allocator, | ||
const ResourceAllocatorHandle& aliasing_allocator, | ||
const uint32_t resoruce_index, | ||
const uint32_t ring_size) override; | ||
|
||
virtual ImageHandle resource(const GraphResourceHandle& resource) override; | ||
|
||
public: | ||
static ManagedVkImageOutHandle compute_write(const std::string& name, | ||
const vk::Format format, | ||
const vk::Extent3D extent, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle compute_fragment_write(const std::string& name, | ||
const vk::Format format, | ||
const vk::Extent3D extent, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle compute_write(const std::string& name, | ||
const vk::Format format, | ||
const uint32_t width, | ||
const uint32_t height, | ||
const uint32_t depth = 1, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle compute_fragment_write(const std::string& name, | ||
const vk::Format format, | ||
const uint32_t width, | ||
const uint32_t height, | ||
const uint32_t depth = 1, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle | ||
compute_read_write_transfer_dst(const std::string& name, | ||
const vk::Format format, | ||
const vk::Extent3D extent, | ||
const vk::ImageLayout layout = vk::ImageLayout::eGeneral, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle | ||
compute_read_write_transfer_dst(const std::string& name, | ||
const vk::Format format, | ||
const uint32_t width, | ||
const uint32_t height, | ||
const uint32_t depth = 1, | ||
const vk::ImageLayout layout = vk::ImageLayout::eGeneral, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle compute_read_write(const std::string& name, | ||
const vk::Format format, | ||
const vk::Extent3D extent, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle transfer_write(const std::string& name, | ||
const vk::Format format, | ||
const vk::Extent3D extent, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle transfer_write(const std::string& name, | ||
const vk::Format format, | ||
const uint32_t width, | ||
const uint32_t height, | ||
const uint32_t depth = 1, | ||
const bool persistent = false); | ||
|
||
public: | ||
const vk::AccessFlags2 access_flags; | ||
const vk::PipelineStageFlags2 pipeline_stages; | ||
const vk::ImageLayout required_layout; | ||
const vk::ShaderStageFlags stage_flags; | ||
const vk::ImageCreateInfo create_info; | ||
const bool persistent; | ||
class ManagedVkImageOut : public VkImageOut { | ||
public: | ||
ManagedVkImageOut(const std::string& name, | ||
const vk::AccessFlags2& access_flags, | ||
const vk::PipelineStageFlags2& pipeline_stages, | ||
const vk::ImageLayout& required_layout, | ||
const vk::ShaderStageFlags& stage_flags, | ||
const vk::ImageCreateInfo& create_info, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle compute_write(const std::string& name, | ||
const vk::Format format, | ||
const vk::Extent3D extent, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle compute_fragment_write(const std::string& name, | ||
const vk::Format format, | ||
const vk::Extent3D extent, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle compute_write(const std::string& name, | ||
const vk::Format format, | ||
const uint32_t width, | ||
const uint32_t height, | ||
const uint32_t depth = 1, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle compute_fragment_write(const std::string& name, | ||
const vk::Format format, | ||
const uint32_t width, | ||
const uint32_t height, | ||
const uint32_t depth = 1, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle | ||
compute_read_write_transfer_dst(const std::string& name, | ||
const vk::Format format, | ||
const vk::Extent3D extent, | ||
const vk::ImageLayout layout = vk::ImageLayout::eGeneral, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle | ||
compute_read_write_transfer_dst(const std::string& name, | ||
const vk::Format format, | ||
const uint32_t width, | ||
const uint32_t height, | ||
const uint32_t depth = 1, | ||
const vk::ImageLayout layout = vk::ImageLayout::eGeneral, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle compute_read_write(const std::string& name, | ||
const vk::Format format, | ||
const vk::Extent3D extent, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle transfer_write(const std::string& name, | ||
const vk::Format format, | ||
const vk::Extent3D extent, | ||
const bool persistent = false); | ||
|
||
static ManagedVkImageOutHandle transfer_write(const std::string& name, | ||
const vk::Format format, | ||
const uint32_t width, | ||
const uint32_t height, | ||
const uint32_t depth = 1, | ||
const bool persistent = false); | ||
}; | ||
} // namespace merian-nodes | ||
|
||
|
||
} // namespace merian_nodes | ||
#endif //MANAGED_VK_IMAGE_OUT_HPP |
22 changes: 22 additions & 0 deletions
22
include/merian-nodes/connectors/unmanaged_vk_image_out.hpp
This file contains 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,22 @@ | ||
#ifndef UNMANAGED_VK_IMAGE_OUT_HPP | ||
#define UNMANAGED_VK_IMAGE_OUT_HPP | ||
|
||
#include "vk_image_out.hpp" | ||
|
||
namespace merian_nodes { | ||
|
||
class UnmanagedVkImageOut; | ||
using UnmanagedVkImageOutHandle = std::shared_ptr<UnmanagedVkImageOut>; | ||
|
||
class UnmanagedVkImageOut : public VkImageOut { | ||
public: | ||
UnmanagedVkImageOut(const std::string& name, const uint32_t array_size); | ||
|
||
static UnmanagedVkImageOutHandle create(const std::string& name, const uint32_t array_size); | ||
}; | ||
|
||
} // namespace merain_nodes | ||
|
||
|
||
|
||
#endif //UNMANAGED_VK_IMAGE_OUT_HPP |
This file contains 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,63 @@ | ||
#pragma once | ||
|
||
#include "merian-nodes/graph/connector_output.hpp" | ||
#include "merian-nodes/resources/managed_vk_image_resource.hpp" | ||
|
||
namespace merian_nodes { | ||
|
||
class ManagedVkImageOut; | ||
using ManagedVkImageOutHandle = std::shared_ptr<ManagedVkImageOut>; | ||
|
||
// Output a Vulkan image that is allocated and managed by the graph. | ||
// Note that it only supplies a descriptor if stage_flags contains at least one bit. | ||
class VkImageOut : public TypedOutputConnector<ImageHandle> { | ||
public: | ||
VkImageOut(const std::string& name, | ||
const vk::AccessFlags2& access_flags, | ||
const vk::PipelineStageFlags2& pipeline_stages, | ||
const vk::ImageLayout& required_layout, | ||
const vk::ShaderStageFlags& stage_flags, | ||
const vk::ImageCreateInfo& create_info, | ||
const bool persistent = false); | ||
|
||
virtual std::optional<vk::DescriptorSetLayoutBinding> get_descriptor_info() const override; | ||
|
||
virtual void get_descriptor_update(const uint32_t binding, | ||
const GraphResourceHandle& resource, | ||
const DescriptorSetHandle& update, | ||
const ResourceAllocatorHandle& allocator) override; | ||
|
||
virtual ConnectorStatusFlags | ||
on_pre_process(GraphRun& run, | ||
const CommandBufferHandle& cmd, | ||
const GraphResourceHandle& resource, | ||
const NodeHandle& node, | ||
std::vector<vk::ImageMemoryBarrier2>& image_barriers, | ||
std::vector<vk::BufferMemoryBarrier2>& buffer_barriers) override; | ||
|
||
virtual ConnectorStatusFlags | ||
on_post_process(GraphRun& run, | ||
const CommandBufferHandle& cmd, | ||
const GraphResourceHandle& resource, | ||
const NodeHandle& node, | ||
std::vector<vk::ImageMemoryBarrier2>& image_barriers, | ||
std::vector<vk::BufferMemoryBarrier2>& buffer_barriers) override; | ||
|
||
virtual GraphResourceHandle | ||
create_resource(const std::vector<std::tuple<NodeHandle, InputConnectorHandle>>& inputs, | ||
const ResourceAllocatorHandle& allocator, | ||
const ResourceAllocatorHandle& aliasing_allocator, | ||
const uint32_t resoruce_index, | ||
const uint32_t ring_size) override; | ||
|
||
virtual ImageHandle resource(const GraphResourceHandle& resource) override; | ||
|
||
const vk::AccessFlags2 access_flags; | ||
const vk::PipelineStageFlags2 pipeline_stages; | ||
const vk::ImageLayout required_layout; | ||
const vk::ShaderStageFlags stage_flags; | ||
const vk::ImageCreateInfo create_info; | ||
const bool persistent; | ||
}; | ||
|
||
} // namespace merian_nodes |
This file contains 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 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.