mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
84 lines
2.9 KiB
C++
84 lines
2.9 KiB
C++
#ifndef MAGIC_HPP
|
|
#define MAGIC_HPP
|
|
|
|
#include "core/buffer.hpp"
|
|
#include "core/commandbuffer.hpp"
|
|
#include "core/descriptorpool.hpp"
|
|
#include "core/descriptorset.hpp"
|
|
#include "core/image.hpp"
|
|
#include "core/pipeline.hpp"
|
|
#include "core/shadermodule.hpp"
|
|
#include "device.hpp"
|
|
|
|
namespace Vulkan::Shaderchains {
|
|
|
|
///
|
|
/// Shader chain magic.
|
|
///
|
|
/// Takes textures similar to gamma shader chain, produces intermediary
|
|
/// results in groups of 3, 2, 2.
|
|
///
|
|
class Magic {
|
|
public:
|
|
///
|
|
/// Initialize the shaderchain.
|
|
///
|
|
/// @param device The Vulkan device to create the resources on.
|
|
/// @param pool The descriptor pool to use for descriptor sets.
|
|
/// @param temporalImgs The temporal images to use for processing.
|
|
/// @param inImgs1 The first set of input images to process.
|
|
/// @param inImg2 The second input image to process.
|
|
/// @param inImg3 The third input image to process, next step up the resolution.
|
|
/// @param optImg An optional additional input from the previous pass.
|
|
///
|
|
/// @throws ls::vulkan_error if resource creation fails.
|
|
///
|
|
Magic(const Device& device, const Core::DescriptorPool& pool,
|
|
const std::array<Core::Image, 4>& temporalImgs,
|
|
const std::array<Core::Image, 4>& inImgs1,
|
|
const Core::Image& inImg2,
|
|
const Core::Image& inImg3,
|
|
const std::optional<Core::Image>& optImg);
|
|
|
|
///
|
|
/// Dispatch the shaderchain.
|
|
///
|
|
/// @param buf The command buffer to use for dispatching.
|
|
///
|
|
/// @throws std::logic_error if the command buffer is not recording.
|
|
///
|
|
void Dispatch(const Core::CommandBuffer& buf);
|
|
|
|
/// Get the first set of output images
|
|
[[nodiscard]] const auto& getOutImages1() const { return this->outImgs1; }
|
|
/// Get the second set of output images
|
|
[[nodiscard]] const auto& getOutImages2() const { return this->outImgs2; }
|
|
/// Get the third set of output images
|
|
[[nodiscard]] const auto& getOutImages3() const { return this->outImgs3; }
|
|
|
|
/// Trivially copyable, moveable and destructible
|
|
Magic(const Magic&) noexcept = default;
|
|
Magic& operator=(const Magic&) noexcept = default;
|
|
Magic(Magic&&) noexcept = default;
|
|
Magic& operator=(Magic&&) noexcept = default;
|
|
~Magic() = default;
|
|
private:
|
|
Core::ShaderModule shaderModule;
|
|
Core::Pipeline pipeline;
|
|
Core::DescriptorSet descriptorSet;
|
|
Core::Buffer buffer;
|
|
|
|
std::vector<Core::Image> temporalImgs{4};
|
|
std::vector<Core::Image> inImgs1{4};
|
|
Core::Image inImg2;
|
|
Core::Image inImg3;
|
|
std::optional<Core::Image> optImg;
|
|
|
|
std::vector<Core::Image> outImgs1{3};
|
|
std::vector<Core::Image> outImgs2{3};
|
|
std::vector<Core::Image> outImgs3{3};
|
|
};
|
|
|
|
}
|
|
|
|
#endif // MAGIC_HPP
|