mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
parent
01379439f4
commit
92c7f98a12
4 changed files with 23 additions and 7 deletions
|
|
@ -14,14 +14,18 @@ using namespace LSFG;
|
||||||
Context::Context(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
Context::Context(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
||||||
uint32_t width, uint32_t height, int in0, int in1,
|
uint32_t width, uint32_t height, int in0, int in1,
|
||||||
const std::vector<int>& outN) {
|
const std::vector<int>& outN) {
|
||||||
|
const VkFormat format = getenv("LSFG_HDR") == nullptr
|
||||||
|
? VK_FORMAT_R8G8B8A8_UNORM
|
||||||
|
: VK_FORMAT_R16G16B16A16_SFLOAT;
|
||||||
|
|
||||||
// import images
|
// import images
|
||||||
this->inImg_0 = Core::Image(device, { width, height },
|
this->inImg_0 = Core::Image(device, { width, height },
|
||||||
VK_FORMAT_R8G8B8A8_UNORM,
|
format,
|
||||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
in0);
|
in0);
|
||||||
this->inImg_1 = Core::Image(device, { width, height },
|
this->inImg_1 = Core::Image(device, { width, height },
|
||||||
VK_FORMAT_R8G8B8A8_UNORM,
|
format,
|
||||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
in1);
|
in1);
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,12 @@ Merge::Merge(const Core::Device& device, Pool::ShaderPool& shaderpool,
|
||||||
|
|
||||||
auto extent = this->inImg1.getExtent();
|
auto extent = this->inImg1.getExtent();
|
||||||
|
|
||||||
|
const VkFormat format = getenv("LSFG_HDR") == nullptr
|
||||||
|
? VK_FORMAT_R8G8B8A8_UNORM
|
||||||
|
: VK_FORMAT_R16G16B16A16_SFLOAT;
|
||||||
for (size_t i = 0; i < genc; i++)
|
for (size_t i = 0; i < genc; i++)
|
||||||
this->outImgs.emplace_back(device,
|
this->outImgs.emplace_back(device,
|
||||||
extent,
|
extent, format,
|
||||||
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_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
outFds.at(i));
|
outFds.at(i));
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#include "core/buffer.hpp"
|
#include "core/buffer.hpp"
|
||||||
#include "lsfg.hpp"
|
#include "lsfg.hpp"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
using namespace LSFG;
|
using namespace LSFG;
|
||||||
|
|
@ -188,6 +189,8 @@ void Globals::initializeGlobals(const Core::Device& device) {
|
||||||
// initialize global constant buffer
|
// initialize global constant buffer
|
||||||
fgBuffer = {
|
fgBuffer = {
|
||||||
.inputOffset = { 0, 29 },
|
.inputOffset = { 0, 29 },
|
||||||
|
.advancedColorKind = getenv("LSFG_HDR") == nullptr ? 0U : 2U,
|
||||||
|
.hdrSupport = getenv("LSFG_HDR") != nullptr,
|
||||||
.resolutionInvScale = 1.0F,
|
.resolutionInvScale = 1.0F,
|
||||||
.timestamp = 0.5F,
|
.timestamp = 0.5F,
|
||||||
.uiThreshold = 0.1F,
|
.uiThreshold = 0.1F,
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,18 @@ LsContext::LsContext(const Hooks::DeviceInfo& info, VkSwapchainKHR swapchain,
|
||||||
VkExtent2D extent, const std::vector<VkImage>& swapchainImages)
|
VkExtent2D extent, const std::vector<VkImage>& swapchainImages)
|
||||||
: swapchain(swapchain), swapchainImages(swapchainImages),
|
: swapchain(swapchain), swapchainImages(swapchainImages),
|
||||||
extent(extent) {
|
extent(extent) {
|
||||||
|
|
||||||
|
// we could take the format from the swapchain,
|
||||||
|
// but honestly this is safer.
|
||||||
|
const VkFormat format = getenv("LSFG_HDR") == nullptr
|
||||||
|
? VK_FORMAT_R8G8B8A8_UNORM
|
||||||
|
: VK_FORMAT_R16G16B16A16_SFLOAT;
|
||||||
|
|
||||||
// prepare textures for lsfg
|
// prepare textures for lsfg
|
||||||
int frame_0_fd{};
|
int frame_0_fd{};
|
||||||
this->frame_0 = Mini::Image(
|
this->frame_0 = Mini::Image(
|
||||||
info.device, info.physicalDevice,
|
info.device, info.physicalDevice,
|
||||||
extent, VK_FORMAT_R8G8B8A8_UNORM,
|
extent, format,
|
||||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
&frame_0_fd);
|
&frame_0_fd);
|
||||||
|
|
@ -26,7 +33,7 @@ LsContext::LsContext(const Hooks::DeviceInfo& info, VkSwapchainKHR swapchain,
|
||||||
int frame_1_fd{};
|
int frame_1_fd{};
|
||||||
this->frame_1 = Mini::Image(
|
this->frame_1 = Mini::Image(
|
||||||
info.device, info.physicalDevice,
|
info.device, info.physicalDevice,
|
||||||
extent, VK_FORMAT_R8G8B8A8_UNORM,
|
extent, format,
|
||||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
&frame_1_fd);
|
&frame_1_fd);
|
||||||
|
|
@ -37,7 +44,7 @@ LsContext::LsContext(const Hooks::DeviceInfo& info, VkSwapchainKHR swapchain,
|
||||||
for (size_t i = 0; i < info.frameGen; ++i) {
|
for (size_t i = 0; i < info.frameGen; ++i) {
|
||||||
this->out_n.emplace_back(
|
this->out_n.emplace_back(
|
||||||
info.device, info.physicalDevice,
|
info.device, info.physicalDevice,
|
||||||
extent, VK_FORMAT_R8G8B8A8_UNORM,
|
extent, format,
|
||||||
VK_IMAGE_USAGE_TRANSFER_SRC_BIT,
|
VK_IMAGE_USAGE_TRANSFER_SRC_BIT,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
&out_n_fds.at(i));
|
&out_n_fds.at(i));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue