2022-06-15 02:09:51 +02:00
|
|
|
#pragma once
|
2024-04-13 18:06:14 +02:00
|
|
|
#include "vulkan/vulkan_hpp_wrapper.hpp"
|
2022-06-15 02:09:51 +02:00
|
|
|
#include "slang_shader.hpp"
|
|
|
|
#include "vulkan_context.hpp"
|
|
|
|
#include "vulkan_pipeline_image.hpp"
|
|
|
|
|
|
|
|
namespace Vulkan
|
|
|
|
{
|
|
|
|
|
|
|
|
class SlangPipeline
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SlangPipeline();
|
|
|
|
void init(Context *context_, SlangShader *shader_);
|
|
|
|
~SlangPipeline();
|
|
|
|
|
|
|
|
bool generate_pipeline(bool lastpass = false);
|
|
|
|
bool generate_frame_resources(vk::DescriptorPool pool);
|
|
|
|
void update_framebuffer(vk::CommandBuffer, int frame_num, bool mipmap);
|
|
|
|
|
|
|
|
Context *context;
|
|
|
|
vk::Device device;
|
|
|
|
vk::Format format;
|
|
|
|
SlangShader *shader;
|
|
|
|
vk::UniqueRenderPass render_pass;
|
|
|
|
vk::UniqueDescriptorSetLayout descriptor_set_layout;
|
|
|
|
vk::UniquePipelineLayout pipeline_layout;
|
|
|
|
vk::UniquePipeline pipeline;
|
|
|
|
vk::UniqueSemaphore semaphore;
|
|
|
|
vk::UniqueSampler sampler;
|
|
|
|
|
2023-01-23 22:02:56 +01:00
|
|
|
struct
|
2022-06-15 02:09:51 +02:00
|
|
|
{
|
|
|
|
vk::UniqueDescriptorSet descriptor_set;
|
|
|
|
PipelineImage image;
|
2023-01-25 00:33:46 +01:00
|
|
|
vk::UniqueFence fence;
|
2023-01-25 21:03:21 +01:00
|
|
|
} frame[3];
|
2022-06-15 02:09:51 +02:00
|
|
|
|
|
|
|
vk::Buffer uniform_buffer;
|
|
|
|
vma::Allocation uniform_buffer_allocation;
|
|
|
|
std::vector<uint8_t> push_constants;
|
|
|
|
|
|
|
|
int source_width;
|
|
|
|
int source_height;
|
|
|
|
int destination_width;
|
|
|
|
int destination_height;
|
|
|
|
};
|
|
|
|
|
|
|
|
vk::SamplerAddressMode wrap_mode_from_string(std::string s);
|
|
|
|
|
|
|
|
} // namespace Vulkan
|