hard coded path
This commit is contained in:
parent
9fd56d0dd7
commit
14e4aba88f
|
@ -49,6 +49,11 @@ set(sources
|
|||
AnimatedTexture.h
|
||||
dpiawarescaling.manifest)
|
||||
|
||||
set(sources_offscreen
|
||||
./offscreen/main.cpp
|
||||
./offscreen/helper.hpp
|
||||
./offscreen/Vulkan_FSR2.hpp)
|
||||
|
||||
set(fsr1_shaders_src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../ffx-fsr2-api/shaders/ffx_core.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../ffx-fsr2-api/shaders/ffx_common_types.h
|
||||
|
@ -124,6 +129,7 @@ set(sample_shaders_src
|
|||
set(APP_ICON_GPUOPEN "${CMAKE_CURRENT_SOURCE_DIR}/../common/GpuOpenIcon.rc")
|
||||
|
||||
source_group("sources" FILES ${sources})
|
||||
source_group("sources_offscreen" FILES ${sources_offscreen})
|
||||
source_group("spatial_shaders" FILES ${fsr1_shaders_src})
|
||||
source_group("fsr2_shaders" FILES ${fsr2_shaders_src})
|
||||
source_group("particle_shaders" FILES ${particle_shaders_src})
|
||||
|
@ -142,4 +148,13 @@ target_include_directories(FSR2_Sample_VK PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../
|
|||
target_link_directories(FSR2_Sample_VK PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../libs)
|
||||
|
||||
set_target_properties(FSR2_Sample_VK PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" DEBUG_POSTFIX "d")
|
||||
|
||||
add_executable(FSR2_OffScreen_VK ${sources_offscreen} ${fsr2_src} ${fsr1_shaders_src} ${fsr2_shaders_src} ${particle_shaders_src} ${spd_shaders_src} ${common} ${APP_ICON_GPUOPEN})
|
||||
target_compile_definitions(FSR2_OffScreen_VK PRIVATE $<$<CONFIG:RelWithDebInfo>:FSR2_DEBUG_SHADERS=1>)
|
||||
target_link_libraries(FSR2_OffScreen_VK LINK_PUBLIC Cauldron_VK Vulkan::Vulkan ffx_fsr2_api_x64 ffx_fsr2_api_vk_x64) # ffx_fsr2_api_x64
|
||||
target_include_directories(FSR2_OffScreen_VK PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/offscreen/include ${CMAKE_CURRENT_SOURCE_DIR}/../ffx-fsr2-api ${CMAKE_CURRENT_SOURCE_DIR}/../../libs)
|
||||
target_link_directories(FSR2_OffScreen_VK PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../libs)
|
||||
|
||||
set_target_properties(FSR2_OffScreen_VK PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" DEBUG_POSTFIX "d")
|
||||
|
||||
set_source_files_properties(${Shaders_src} PROPERTIES VS_TOOL_OVERRIDE "Text")
|
||||
|
|
1100
src/VK/offscreen/Vulkan_FSR2.hpp
Normal file
1100
src/VK/offscreen/Vulkan_FSR2.hpp
Normal file
File diff suppressed because it is too large
Load Diff
96
src/VK/offscreen/helper.hpp
Normal file
96
src/VK/offscreen/helper.hpp
Normal file
|
@ -0,0 +1,96 @@
|
|||
#pragma once
|
||||
#define TINYEXR_IMPLEMENTATION
|
||||
#include <tinyexr.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
std::vector<float> read_image_exr(const std::string& file_path, int& w, int& h,int channel) {
|
||||
float* data = nullptr;
|
||||
const char* err = nullptr;
|
||||
int ret = LoadEXR(&data, &w, &h, file_path.c_str(), &err);
|
||||
if (ret != TINYEXR_SUCCESS) {
|
||||
if (err) {
|
||||
std::cout << "EXR reading error: " << err << "\n";
|
||||
FreeEXRErrorMessage(err);
|
||||
}
|
||||
}
|
||||
std::vector<float> data_rgba{ data ,data+(w*h)*channel}; // auto free
|
||||
return data_rgba;
|
||||
}
|
||||
|
||||
void write_exr(const std::string& _file_path, std::vector<float> &data, int w, int h, int _channels=4,
|
||||
bool use_half = false) {
|
||||
if (data.empty())
|
||||
return;
|
||||
std::string file_path = _file_path;
|
||||
|
||||
EXRHeader header;
|
||||
InitEXRHeader(&header);
|
||||
|
||||
EXRImage image;
|
||||
InitEXRImage(&image);
|
||||
|
||||
image.num_channels = _channels;
|
||||
|
||||
int pixel_n = w * h;
|
||||
std::vector<float> images[4];
|
||||
images[0].resize(pixel_n);
|
||||
images[1].resize(pixel_n);
|
||||
images[2].resize(pixel_n);
|
||||
images[3].resize(pixel_n);
|
||||
|
||||
for (int i = 0; i < pixel_n; i++) {
|
||||
images[0][i] = data[4 * i + 0];
|
||||
images[1][i] = data[4 * i + 1];
|
||||
images[2][i] = data[4 * i + 2];
|
||||
images[3][i] = data[4 * i + 3];
|
||||
}
|
||||
|
||||
float* image_ptr[4];
|
||||
image_ptr[0] = images[3].data(); // A
|
||||
image_ptr[1] = images[2].data(); // B
|
||||
image_ptr[2] = images[1].data(); // G
|
||||
image_ptr[3] = images[0].data(); // R
|
||||
|
||||
|
||||
image.images = (uint8_t**)image_ptr;
|
||||
image.width = w;
|
||||
image.height = h;
|
||||
|
||||
header.num_channels = 4;
|
||||
auto channels = std::make_unique<EXRChannelInfo[]>(header.num_channels);
|
||||
header.channels = channels.get();
|
||||
// Must be (A)BGR order, since most of EXR viewers expect this channel order
|
||||
strncpy_s(header.channels[0].name, "A", 255);
|
||||
header.channels[0].name[strlen("A")] = '\0';
|
||||
strncpy_s(header.channels[1].name, "B", 255);
|
||||
header.channels[1].name[strlen("B")] = '\0';
|
||||
strncpy_s(header.channels[2].name, "G", 255);
|
||||
header.channels[2].name[strlen("G")] = '\0';
|
||||
strncpy_s(header.channels[3].name, "R", 255);
|
||||
header.channels[3].name[strlen("R")] = '\0';
|
||||
|
||||
auto pixel_types = std::make_unique<int[]>(header.num_channels);
|
||||
header.pixel_types = pixel_types.get();
|
||||
auto requested_pixel_types = std::make_unique<int[]>(header.num_channels);
|
||||
header.requested_pixel_types = requested_pixel_types.get();
|
||||
for (int i = 0; i < header.num_channels; i++) {
|
||||
header.pixel_types[i] = TINYEXR_PIXELTYPE_FLOAT; // pixel type of input image
|
||||
header.requested_pixel_types[i] =
|
||||
use_half ? // pixel type of output image to be stored in EXR file
|
||||
TINYEXR_PIXELTYPE_HALF :
|
||||
TINYEXR_PIXELTYPE_FLOAT;
|
||||
}
|
||||
|
||||
header.compression_type = TINYEXR_COMPRESSIONTYPE_ZIP;
|
||||
|
||||
const char* err = nullptr;
|
||||
int ret = SaveEXRImageToFile(&image, &header, file_path.c_str(), &err);
|
||||
if (ret != TINYEXR_SUCCESS) {
|
||||
if (err) {
|
||||
std::cout << "EXR writing error: " << err << std::endl;
|
||||
FreeEXRErrorMessage(err);
|
||||
}
|
||||
return;
|
||||
};
|
||||
}
|
7763
src/VK/offscreen/include/stb_image.h
Normal file
7763
src/VK/offscreen/include/stb_image.h
Normal file
File diff suppressed because it is too large
Load Diff
2
src/VK/offscreen/include/tinyexr.cc
Normal file
2
src/VK/offscreen/include/tinyexr.cc
Normal file
|
@ -0,0 +1,2 @@
|
|||
#define TINYEXR_IMPLEMENTATION
|
||||
#include "tinyexr.h"
|
13586
src/VK/offscreen/include/tinyexr.h
Normal file
13586
src/VK/offscreen/include/tinyexr.h
Normal file
File diff suppressed because it is too large
Load Diff
15
src/VK/offscreen/main.cpp
Normal file
15
src/VK/offscreen/main.cpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include "Vulkan_FSR2.hpp"
|
||||
|
||||
int main() {
|
||||
|
||||
std::vector<std::string> file_list = {"1045.exr","1046.exr","1047.exr","1048.exr","1049.exr"};
|
||||
std::string input_path = "D:/stuff/ue_stuffs/showdown_out/test2/Input/";
|
||||
std::string motion_depth_path = "D:/stuff/ue_stuffs/showdown_out/test2/RawMotionDepth/";
|
||||
std::string out_path = "D:/workwork/sssr/FSR2output/";
|
||||
|
||||
Vulkan_FSR2 FSR2;
|
||||
FSR2.run(file_list, input_path, motion_depth_path, out_path);
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue
Block a user