mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
finaly fixes
This commit is contained in:
parent
42a692cd62
commit
5c7cc5a456
15 changed files with 196 additions and 93 deletions
|
|
@ -107,7 +107,7 @@ namespace Vulkan::Core {
|
|||
if (buffer.has_value()) this->add(type, *buffer); else this->add(type); return *this; }
|
||||
|
||||
/// Finish building the descriptor set update.
|
||||
void build() const;
|
||||
void build();
|
||||
private:
|
||||
const DescriptorSet* descriptorSet;
|
||||
const Device* device;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace Vulkan::Shaderchains {
|
|||
std::array<Core::Image, 4> temporalImgs,
|
||||
std::array<Core::Image, 4> inImgs1,
|
||||
Core::Image inImg2,
|
||||
std::optional<Core::Image>& optImg1,
|
||||
std::optional<Core::Image> optImg1,
|
||||
std::optional<Core::Image> optImg2,
|
||||
VkExtent2D outExtent);
|
||||
|
||||
|
|
|
|||
|
|
@ -77,10 +77,11 @@ namespace Vulkan::Utils {
|
|||
///
|
||||
/// @param device The Vulkan device.
|
||||
/// @param image The image to clear.
|
||||
/// @param white If true, the image will be cleared to white, otherwise to black.
|
||||
///
|
||||
/// @throws ls::vulkan_error If the Vulkan image cannot be cleared.
|
||||
///
|
||||
void clearWhiteImage(const Device& device, Core::Image& image);
|
||||
void clearImage(const Device& device, Core::Image& image, bool white = false);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "core/descriptorset.hpp"
|
||||
#include "utils.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace Vulkan::Core;
|
||||
|
||||
|
|
@ -92,17 +93,16 @@ DescriptorSetUpdateBuilder& DescriptorSetUpdateBuilder::add(VkDescriptorType typ
|
|||
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
|
||||
.dstSet = this->descriptorSet->handle(),
|
||||
.dstBinding = static_cast<uint32_t>(this->entries.size()),
|
||||
.descriptorCount = 0,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = type,
|
||||
.pImageInfo = nullptr,
|
||||
.pImageInfo = new VkDescriptorImageInfo {
|
||||
},
|
||||
.pBufferInfo = nullptr
|
||||
});
|
||||
return *this;
|
||||
}
|
||||
|
||||
void DescriptorSetUpdateBuilder::build() const {
|
||||
if (this->entries.empty()) return;
|
||||
|
||||
void DescriptorSetUpdateBuilder::build() {
|
||||
vkUpdateDescriptorSets(this->device->handle(),
|
||||
static_cast<uint32_t>(this->entries.size()),
|
||||
this->entries.data(), 0, nullptr);
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@
|
|||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
using namespace Vulkan;
|
||||
|
||||
const std::vector<const char*> requiredExtensions = {
|
||||
"VK_KHR_external_memory_fd"
|
||||
"VK_KHR_external_memory_fd",
|
||||
"VK_EXT_robustness2",
|
||||
};
|
||||
|
||||
Device::Device(const Instance& instance) {
|
||||
|
|
@ -53,8 +55,13 @@ Device::Device(const Instance& instance) {
|
|||
|
||||
// create logical device
|
||||
const float queuePriority{1.0F}; // highest priority
|
||||
VkPhysicalDeviceRobustness2FeaturesEXT robustness2{
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT,
|
||||
.nullDescriptor = VK_TRUE,
|
||||
};
|
||||
VkPhysicalDeviceVulkan13Features features13{
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES,
|
||||
.pNext = &robustness2,
|
||||
.synchronization2 = VK_TRUE
|
||||
};
|
||||
const VkPhysicalDeviceVulkan12Features features12{
|
||||
|
|
|
|||
120
src/main.cpp
120
src/main.cpp
|
|
@ -6,9 +6,18 @@
|
|||
#include "device.hpp"
|
||||
#include "instance.hpp"
|
||||
#include "shaderchains/alpha.hpp"
|
||||
#include "shaderchains/beta.hpp"
|
||||
#include "shaderchains/delta.hpp"
|
||||
#include "shaderchains/downsample.hpp"
|
||||
#include "shaderchains/epsilon.hpp"
|
||||
#include "shaderchains/extract.hpp"
|
||||
#include "shaderchains/gamma.hpp"
|
||||
#include "shaderchains/magic.hpp"
|
||||
#include "shaderchains/merge.hpp"
|
||||
#include "shaderchains/zeta.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
|
||||
#include <renderdoc_app.h>
|
||||
|
|
@ -42,7 +51,7 @@ int main() {
|
|||
|
||||
Globals::initializeGlobals(device);
|
||||
|
||||
// create initialization resources
|
||||
// create downsample shader chain
|
||||
Core::Image inputImage(
|
||||
device, { 2560, 1411 }, VK_FORMAT_R8G8B8A8_UNORM,
|
||||
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
||||
|
|
@ -50,14 +59,109 @@ int main() {
|
|||
);
|
||||
Utils::uploadImage(device, commandPool, inputImage, "rsc/images/source.dds");
|
||||
|
||||
// create the shaderchains
|
||||
Shaderchains::Downsample downsample(device, descriptorPool, inputImage);
|
||||
|
||||
// create alpha shader chains
|
||||
std::vector<Shaderchains::Alpha> alphas;
|
||||
alphas.reserve(7);
|
||||
for (size_t i = 0; i < 7; ++i)
|
||||
alphas.emplace_back(device, descriptorPool, downsample.getOutImages().at(i));
|
||||
|
||||
// create beta shader chain
|
||||
std::array<Core::Image, 8> betaTemporalImages;
|
||||
auto betaInExtent = alphas.at(0).getOutImages().at(0).getExtent();
|
||||
for (size_t i = 0; i < 8; ++i) {
|
||||
betaTemporalImages.at(i) = Core::Image(
|
||||
device, betaInExtent, VK_FORMAT_R8G8B8A8_UNORM,
|
||||
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT |
|
||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT
|
||||
);
|
||||
Utils::uploadImage(device, commandPool, betaTemporalImages.at(i),
|
||||
std::format("rsc/images/temporal_beta/{}.dds", i));
|
||||
}
|
||||
|
||||
Shaderchains::Beta beta(device, descriptorPool,
|
||||
betaTemporalImages,
|
||||
alphas.at(0).getOutImages()
|
||||
);
|
||||
|
||||
// create gamma to zeta shader chains
|
||||
std::vector<Shaderchains::Gamma> gammas;
|
||||
std::vector<Shaderchains::Magic> magics;
|
||||
std::vector<Shaderchains::Delta> deltas;
|
||||
std::vector<Shaderchains::Epsilon> epsilons;
|
||||
std::vector<Shaderchains::Zeta> zetas;
|
||||
std::vector<Shaderchains::Extract> extracts;
|
||||
std::array<std::array<Core::Image, 4>, 7> otherTemporalImages;
|
||||
for (size_t i = 0; i < 7; i++) {
|
||||
auto otherInExtent = alphas.at(6 - i).getOutImages().at(0).getExtent();
|
||||
for (size_t j = 0; j < 4; j++) {
|
||||
otherTemporalImages.at(i).at(j) = Core::Image(
|
||||
device, otherInExtent, VK_FORMAT_R8G8B8A8_UNORM,
|
||||
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT |
|
||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT
|
||||
);
|
||||
Utils::uploadImage(device, commandPool, otherTemporalImages.at(i).at(j),
|
||||
std::format("rsc/images/temporal_other/{}.{}.dds", i, j));
|
||||
}
|
||||
if (i < 4) {
|
||||
auto gammaOutExtent = alphas.at(6 - i - 1).getOutImages().at(0).getExtent();
|
||||
gammas.emplace_back(device, descriptorPool,
|
||||
otherTemporalImages.at(i),
|
||||
alphas.at(6 - i).getOutImages(),
|
||||
beta.getOutImages().at(std::min(static_cast<size_t>(5), 6 - i)), // smallest twice
|
||||
i == 0 ? std::nullopt : std::optional{gammas.at(i - 1).getOutImage2()},
|
||||
i == 0 ? std::nullopt : std::optional{gammas.at(i - 1).getOutImage1()},
|
||||
gammaOutExtent);
|
||||
} else {
|
||||
magics.emplace_back(device, descriptorPool,
|
||||
otherTemporalImages.at(i),
|
||||
alphas.at(6 - i).getOutImages(),
|
||||
i == 4 ? gammas.at(i - 1).getOutImage2() : extracts.at(i - 5).getOutImage(),
|
||||
i == 4 ? gammas.at(i - 1).getOutImage1() : zetas.at(i - 5).getOutImage(),
|
||||
i == 4 ? std::nullopt : std::optional{epsilons.at(i - 5).getOutImage()}
|
||||
);
|
||||
deltas.emplace_back(device, descriptorPool,
|
||||
magics.at(i - 4).getOutImages1(),
|
||||
i == 4 ? std::nullopt : std::optional{deltas.at(i - 5).getOutImage()}
|
||||
);
|
||||
epsilons.emplace_back(device, descriptorPool,
|
||||
magics.at(i - 4).getOutImages2(),
|
||||
beta.getOutImages().at(6 - i),
|
||||
i == 4 ? std::nullopt : std::optional{epsilons.at(i - 5).getOutImage()}
|
||||
);
|
||||
zetas.emplace_back(device, descriptorPool,
|
||||
magics.at(i - 4).getOutImages3(),
|
||||
i == 4 ? gammas.at(i - 1).getOutImage1() : zetas.at(i - 5).getOutImage(),
|
||||
beta.getOutImages().at(6 - i)
|
||||
);
|
||||
if (i < 6) {
|
||||
auto extractOutExtent = alphas.at(6 - i - 1).getOutImages().at(0).getExtent();
|
||||
extracts.emplace_back(device, descriptorPool,
|
||||
zetas.at(i - 4).getOutImage(),
|
||||
epsilons.at(i - 4).getOutImage(),
|
||||
extractOutExtent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create merge shader chain
|
||||
Core::Image inputImagePrev(
|
||||
device, { 2560, 1411 }, VK_FORMAT_R8G8B8A8_UNORM,
|
||||
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT
|
||||
);
|
||||
Utils::uploadImage(device, commandPool, inputImagePrev, "rsc/images/source_prev.dds");
|
||||
Shaderchains::Merge merge(device, descriptorPool,
|
||||
inputImagePrev,
|
||||
inputImage,
|
||||
zetas.at(2).getOutImage(),
|
||||
epsilons.at(2).getOutImage(),
|
||||
deltas.at(2).getOutImage()
|
||||
);
|
||||
|
||||
// start the rendering pipeline
|
||||
if (rdoc)
|
||||
rdoc->StartFrameCapture(nullptr, nullptr);
|
||||
|
|
@ -68,6 +172,18 @@ int main() {
|
|||
downsample.Dispatch(commandBuffer);
|
||||
for (size_t i = 0; i < 7; i++)
|
||||
alphas.at(6 - i).Dispatch(commandBuffer);
|
||||
beta.Dispatch(commandBuffer);
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
gammas.at(i).Dispatch(commandBuffer);
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
magics.at(i).Dispatch(commandBuffer);
|
||||
deltas.at(i).Dispatch(commandBuffer);
|
||||
epsilons.at(i).Dispatch(commandBuffer);
|
||||
zetas.at(i).Dispatch(commandBuffer);
|
||||
if (i < 2)
|
||||
extracts.at(i).Dispatch(commandBuffer);
|
||||
}
|
||||
merge.Dispatch(commandBuffer);
|
||||
|
||||
// finish the rendering pipeline
|
||||
commandBuffer.end();
|
||||
|
|
|
|||
|
|
@ -12,23 +12,19 @@ Beta::Beta(const Device& device, const Core::DescriptorPool& pool,
|
|||
Core::ShaderModule(device, "rsc/shaders/beta/0.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 8+4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/beta/1.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/beta/2.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/beta/3.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/beta/4.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
|
|
@ -71,25 +67,21 @@ Beta::Beta(const Device& device, const Core::DescriptorPool& pool,
|
|||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->temporalImgs)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImgs)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(1).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(2).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(3).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(4).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
|
|
|
|||
|
|
@ -12,20 +12,17 @@ Delta::Delta(const Device& device, const Core::DescriptorPool& pool,
|
|||
Core::ShaderModule(device, "rsc/shaders/delta/0.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/delta/1.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/delta/2.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/delta/3.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 3, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } })
|
||||
|
|
@ -58,7 +55,7 @@ Delta::Delta(const Device& device, const Core::DescriptorPool& pool,
|
|||
|
||||
this->outImg = Core::Image(device,
|
||||
extent,
|
||||
VK_FORMAT_R16G16B16A16_UNORM,
|
||||
VK_FORMAT_R16G16B16A16_SFLOAT,
|
||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
|
||||
|
|
@ -66,25 +63,23 @@ Delta::Delta(const Device& device, const Core::DescriptorPool& pool,
|
|||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImgs)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(1).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(2).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(3).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->optImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,20 +14,17 @@ Epsilon::Epsilon(const Device& device, const Core::DescriptorPool& pool,
|
|||
Core::ShaderModule(device, "rsc/shaders/epsilon/0.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 3, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/epsilon/1.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/epsilon/2.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/epsilon/3.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 6, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } })
|
||||
|
|
@ -57,7 +54,7 @@ Epsilon::Epsilon(const Device& device, const Core::DescriptorPool& pool,
|
|||
|
||||
this->outImg = Core::Image(device,
|
||||
extent,
|
||||
VK_FORMAT_R16G16B16A16_UNORM,
|
||||
VK_FORMAT_R16G16B16A16_SFLOAT,
|
||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
|
||||
|
|
@ -65,22 +62,20 @@ Epsilon::Epsilon(const Device& device, const Core::DescriptorPool& pool,
|
|||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(1).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(2).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(3).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->optImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg2)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Extract::Extract(const Device& device, const Core::DescriptorPool& pool,
|
|||
: inImg1(std::move(inImg1)),
|
||||
inImg2(std::move(inImg2)) {
|
||||
this->shaderModule = Core::ShaderModule(device, "rsc/shaders/extract.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 3, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } });
|
||||
|
|
@ -21,7 +21,8 @@ Extract::Extract(const Device& device, const Core::DescriptorPool& pool,
|
|||
this->whiteImg = Core::Image(device,
|
||||
outExtent,
|
||||
VK_FORMAT_R8G8B8A8_UNORM,
|
||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT
|
||||
| VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
this->outImg = Core::Image(device,
|
||||
outExtent,
|
||||
|
|
@ -31,6 +32,7 @@ Extract::Extract(const Device& device, const Core::DescriptorPool& pool,
|
|||
|
||||
this->descriptorSet.update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->whiteImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg2)
|
||||
|
|
@ -39,7 +41,7 @@ Extract::Extract(const Device& device, const Core::DescriptorPool& pool,
|
|||
.build();
|
||||
|
||||
// clear white image
|
||||
Utils::clearWhiteImage(device, this->whiteImg);
|
||||
Utils::clearImage(device, this->whiteImg, true);
|
||||
}
|
||||
|
||||
void Extract::Dispatch(const Core::CommandBuffer& buf) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Gamma::Gamma(const Device& device, const Core::DescriptorPool& pool,
|
|||
std::array<Core::Image, 4> temporalImgs,
|
||||
std::array<Core::Image, 4> inImgs1,
|
||||
Core::Image inImg2,
|
||||
std::optional<Core::Image>& optImg1,
|
||||
std::optional<Core::Image> optImg1, // NOLINT
|
||||
std::optional<Core::Image> optImg2,
|
||||
VkExtent2D outExtent)
|
||||
: temporalImgs(std::move(temporalImgs)),
|
||||
|
|
@ -16,34 +16,31 @@ Gamma::Gamma(const Device& device, const Core::DescriptorPool& pool,
|
|||
optImg2(std::move(optImg2)) {
|
||||
this->shaderModules = {{
|
||||
Core::ShaderModule(device, "rsc/shaders/gamma/0.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 8+4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 10, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 3, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/gamma/1.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 3, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/gamma/2.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/gamma/3.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/gamma/4.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 6, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 6, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/gamma/5.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 6, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } })
|
||||
}};
|
||||
for (size_t i = 0; i < 6; i++) {
|
||||
|
|
@ -78,12 +75,13 @@ Gamma::Gamma(const Device& device, const Core::DescriptorPool& pool,
|
|||
}
|
||||
this->whiteImg = Core::Image(device, outExtent,
|
||||
VK_FORMAT_R8G8B8A8_UNORM,
|
||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT
|
||||
| VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
|
||||
this->outImg1 = Core::Image(device,
|
||||
extent,
|
||||
VK_FORMAT_R16G16B16A16_UNORM,
|
||||
VK_FORMAT_R16G16B16A16_SFLOAT,
|
||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
this->outImg2 = Core::Image(device,
|
||||
|
|
@ -94,6 +92,7 @@ Gamma::Gamma(const Device& device, const Core::DescriptorPool& pool,
|
|||
|
||||
this->descriptorSets.at(0).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->temporalImgs)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->optImg1)
|
||||
|
|
@ -109,22 +108,20 @@ Gamma::Gamma(const Device& device, const Core::DescriptorPool& pool,
|
|||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1.at(1))
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1.at(2))
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(2).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(3).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(4).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->optImg2)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg2)
|
||||
|
|
@ -133,14 +130,17 @@ Gamma::Gamma(const Device& device, const Core::DescriptorPool& pool,
|
|||
.build();
|
||||
this->descriptorSets.at(5).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->whiteImg)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->outImg1)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImg2)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
|
||||
// clear white image
|
||||
Utils::clearWhiteImage(device, this->whiteImg);
|
||||
// clear white image and optImg1 if needed
|
||||
Utils::clearImage(device, this->whiteImg, true);
|
||||
if (!optImg1.has_value())
|
||||
Utils::clearImage(device, this->optImg1);
|
||||
}
|
||||
|
||||
void Gamma::Dispatch(const Core::CommandBuffer& buf) {
|
||||
|
|
@ -197,9 +197,6 @@ void Gamma::Dispatch(const Core::CommandBuffer& buf) {
|
|||
buf.dispatch(threadsX, threadsY, 1);
|
||||
|
||||
// fifth pass
|
||||
threadsX = (extent.width + 31) >> 5;
|
||||
threadsY = (extent.height + 31) >> 5;
|
||||
|
||||
Utils::BarrierBuilder(buf)
|
||||
.addW2R(this->tempImgs2)
|
||||
.addW2R(this->optImg2)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Magic::Magic(const Device& device, const Core::DescriptorPool& pool,
|
|||
inImg2(std::move(inImg2)), inImg3(std::move(inImg3)),
|
||||
optImg(std::move(optImg)) {
|
||||
this->shaderModule = Core::ShaderModule(device, "rsc/shaders/magic.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 4+4+2+1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 3+3+2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } });
|
||||
|
|
@ -48,6 +48,7 @@ Magic::Magic(const Device& device, const Core::DescriptorPool& pool,
|
|||
|
||||
this->descriptorSet.update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->temporalImgs)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg2)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Merge::Merge(const Device& device, const Core::DescriptorPool& pool,
|
|||
inImg4(std::move(inImg4)),
|
||||
inImg5(std::move(inImg5)) {
|
||||
this->shaderModule = Core::ShaderModule(device, "rsc/shaders/merge.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 5, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } });
|
||||
|
|
@ -34,6 +34,7 @@ Merge::Merge(const Device& device, const Core::DescriptorPool& pool,
|
|||
|
||||
this->descriptorSet.update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg2)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg3)
|
||||
|
|
|
|||
|
|
@ -14,20 +14,17 @@ Zeta::Zeta(const Device& device, const Core::DescriptorPool& pool,
|
|||
Core::ShaderModule(device, "rsc/shaders/zeta/0.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 3, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/zeta/1.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/zeta/2.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } }),
|
||||
{ 4, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE } }),
|
||||
Core::ShaderModule(device, "rsc/shaders/zeta/3.spv",
|
||||
{ { 1, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ { 2, VK_DESCRIPTOR_TYPE_SAMPLER },
|
||||
{ 6, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE },
|
||||
{ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER } })
|
||||
|
|
@ -57,7 +54,7 @@ Zeta::Zeta(const Device& device, const Core::DescriptorPool& pool,
|
|||
|
||||
this->outImg = Core::Image(device,
|
||||
extent,
|
||||
VK_FORMAT_R16G16B16A16_UNORM,
|
||||
VK_FORMAT_R16G16B16A16_SFLOAT,
|
||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
|
||||
|
|
@ -65,22 +62,20 @@ Zeta::Zeta(const Device& device, const Core::DescriptorPool& pool,
|
|||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(1).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(2).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs2)
|
||||
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, this->buffer)
|
||||
.build();
|
||||
this->descriptorSets.at(3).update(device)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampBorder)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLER, Globals::samplerClampEdge)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg2)
|
||||
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImg3)
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ void Utils::uploadImage(const Device& device, const Core::CommandPool& commandPo
|
|||
throw ls::vulkan_error(VK_TIMEOUT, "Upload operation timed out");
|
||||
}
|
||||
|
||||
void Utils::clearWhiteImage(const Device& device, Core::Image& image) {
|
||||
void Utils::clearImage(const Device& device, Core::Image& image, bool white) {
|
||||
Core::Fence fence(device);
|
||||
const Core::CommandPool cmdPool(device);
|
||||
Core::CommandBuffer cmdBuf(device, cmdPool);
|
||||
|
|
@ -158,7 +158,8 @@ void Utils::clearWhiteImage(const Device& device, Core::Image& image) {
|
|||
image.setLayout(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
vkCmdPipelineBarrier2(cmdBuf.handle(), &dependencyInfo);
|
||||
|
||||
const VkClearColorValue clearColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }};
|
||||
const float clearValue = white ? 1.0F : 0.0F;
|
||||
const VkClearColorValue clearColor = {{ clearValue, clearValue, clearValue, clearValue }};
|
||||
const VkImageSubresourceRange subresourceRange = {
|
||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
.levelCount = 1,
|
||||
|
|
@ -204,6 +205,6 @@ void Globals::uninitializeGlobals() noexcept {
|
|||
}
|
||||
|
||||
ls::vulkan_error::vulkan_error(VkResult result, const std::string& message)
|
||||
: std::runtime_error(std::format("{} (error {})", message, static_cast<uint32_t>(result))), result(result) {}
|
||||
: std::runtime_error(std::format("{} (error {})", message, static_cast<int32_t>(result))), result(result) {}
|
||||
|
||||
ls::vulkan_error::~vulkan_error() noexcept = default;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue