16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-09-02 02:39:19 +02:00

Some renaming

This commit is contained in:
2025-04-15 01:32:56 +02:00
parent 12d6a1578d
commit a39d972126
864 changed files with 29 additions and 34 deletions

View File

@@ -0,0 +1,110 @@
# This file is part of the FidelityFX SDK.
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
if(NOT ${FFX_FSR2_API_VK})
return()
endif()
set(FFX_SC_VK_BASE_ARGS
-compiler=glslang -e main --target-env vulkan1.1 -S comp -Os -DFFX_GLSL=1)
file(GLOB SHADERS
"${CMAKE_CURRENT_SOURCE_DIR}/../shaders/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/../shaders/*.glsl")
set(PASS_SHADERS
${CMAKE_CURRENT_SOURCE_DIR}/../shaders/ffx_fsr2_tcr_autogen_pass.glsl
${CMAKE_CURRENT_SOURCE_DIR}/../shaders/ffx_fsr2_autogen_reactive_pass.glsl
${CMAKE_CURRENT_SOURCE_DIR}/../shaders/ffx_fsr2_accumulate_pass.glsl
${CMAKE_CURRENT_SOURCE_DIR}/../shaders/ffx_fsr2_compute_luminance_pyramid_pass.glsl
${CMAKE_CURRENT_SOURCE_DIR}/../shaders/ffx_fsr2_depth_clip_pass.glsl
${CMAKE_CURRENT_SOURCE_DIR}/../shaders/ffx_fsr2_lock_pass.glsl
${CMAKE_CURRENT_SOURCE_DIR}/../shaders/ffx_fsr2_reconstruct_previous_depth_pass.glsl
${CMAKE_CURRENT_SOURCE_DIR}/../shaders/ffx_fsr2_rcas_pass.glsl)
file(GLOB_RECURSE VK
"${CMAKE_CURRENT_SOURCE_DIR}/../ffx_assert.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
if (FSR2_BUILD_AS_DLL)
add_library(ffx_fsr2_api_vk_${FSR2_PLATFORM_NAME} SHARED ${VK})
target_link_libraries(ffx_fsr2_api_vk_${FSR2_PLATFORM_NAME} LINK_PUBLIC Vulkan::Vulkan)
else()
add_library(ffx_fsr2_api_vk_${FSR2_PLATFORM_NAME} STATIC ${VK})
endif()
find_package(Vulkan REQUIRED)
target_include_directories(ffx_fsr2_api_vk_${FSR2_PLATFORM_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/../shaders/vk)
target_include_directories(ffx_fsr2_api_vk_${FSR2_PLATFORM_NAME} PUBLIC ${Vulkan_INCLUDE_DIR})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../shaders/vk)
if (FSR2_AUTO_COMPILE_SHADERS)
set(FFX_SC_DEPENDENT_TARGET ffx_fsr2_api_vk_${FSR2_PLATFORM_NAME})
else()
set(FFX_SC_DEPENDENT_TARGET ffx_fsr2_api_vk_shaders_${FSR2_PLATFORM_NAME})
add_custom_target(${FFX_SC_DEPENDENT_TARGET})
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20.0")
cmake_policy(SET CMP0116 OLD)
endif()
get_filename_component(PASS_SHADER_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../shaders/vk ABSOLUTE)
foreach(PASS_SHADER ${PASS_SHADERS})
get_filename_component(PASS_SHADER_FILENAME ${PASS_SHADER} NAME_WE)
get_filename_component(PASS_SHADER_TARGET ${PASS_SHADER} NAME_WLE)
set(PERMUTATION_HEADER ${PASS_SHADER_OUTPUT_PATH}/${PASS_SHADER_TARGET}_permutations.h)
# combine base and permutation args
if (${PASS_SHADER_FILENAME} STREQUAL "ffx_fsr2_compute_luminance_pyramid_pass")
# skip 16-bit permutations for the compute luminance pyramid pass
set(FFX_SC_ARGS ${FFX_SC_BASE_ARGS} ${FFX_SC_VK_BASE_ARGS} ${FFX_SC_PERMUTATION_ARGS} -DFFX_HALF=0)
else()
set(FFX_SC_ARGS ${FFX_SC_BASE_ARGS} ${FFX_SC_VK_BASE_ARGS} ${FFX_SC_PERMUTATION_ARGS} -DFFX_HALF={0,1})
endif()
if(USE_DEPFILE)
add_custom_command(
OUTPUT ${PERMUTATION_HEADER}
COMMAND ${FFX_SC_EXECUTABLE} ${FFX_SC_ARGS} -name=${PASS_SHADER_FILENAME} -I${CMAKE_CURRENT_SOURCE_DIR}/shaders -output=${PASS_SHADER_OUTPUT_PATH} ${PASS_SHADER}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS ${PASS_SHADER}
DEPFILE ${PERMUTATION_HEADER}.d
)
list(APPEND PERMUTATION_OUTPUTS ${PERMUTATION_HEADER})
else()
add_custom_command(
OUTPUT ${PERMUTATION_HEADER}
COMMAND ${FFX_SC_EXECUTABLE} ${FFX_SC_ARGS} -name=${PASS_SHADER_FILENAME} -I${CMAKE_CURRENT_SOURCE_DIR}/shaders -output=${PASS_SHADER_OUTPUT_PATH} ${PASS_SHADER}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS ${PASS_SHADER}
)
list(APPEND PERMUTATION_OUTPUTS ${PERMUTATION_HEADER})
endif()
endforeach(PASS_SHADER)
add_custom_target(shader_permutations_vk DEPENDS ${PERMUTATION_OUTPUTS})
add_dependencies(${FFX_SC_DEPENDENT_TARGET} shader_permutations_vk)
source_group("source" FILES ${VK})
source_group("shaders" FILES ${SHADERS})

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// @defgroup VK
#pragma once
#include <vulkan/vulkan.h>
#include "../ffx_fsr2_interface.h"
#if defined(__cplusplus)
extern "C" {
#endif // #if defined(__cplusplus)
/// Query how much memory is required for the Vulkan backend's scratch buffer.
///
/// @returns
/// The size (in bytes) of the required scratch memory buffer for the VK backend.
FFX_API size_t ffxFsr2GetScratchMemorySizeVK(VkPhysicalDevice physicalDevice);
/// Populate an interface with pointers for the VK backend.
///
/// @param [out] fsr2Interface A pointer to a <c><i>FfxFsr2Interface</i></c> structure to populate with pointers.
/// @param [in] device A Vulkan device.
/// @param [in] scratchBuffer A pointer to a buffer of memory which can be used by the DirectX(R)12 backend.
/// @param [in] scratchBufferSize The size (in bytes) of the buffer pointed to by <c><i>scratchBuffer</i></c>.
/// @param [in] physicalDevice The Vulkan physical device that FSR 2.0 will be executed on.
/// @param [in] getDeviceProcAddr A function pointer to vkGetDeviceProcAddr which is used to obtain all the other Vulkan functions.
///
/// @retval
/// FFX_OK The operation completed successfully.
/// @retval
/// FFX_ERROR_CODE_INVALID_POINTER The <c><i>interface</i></c> pointer was <c><i>NULL</i></c>.
///
/// @ingroup FSR2 VK
FFX_API FfxErrorCode ffxFsr2GetInterfaceVK(
FfxFsr2Interface* outInterface,
void* scratchBuffer,
size_t scratchBufferSize,
VkPhysicalDevice physicalDevice,
PFN_vkGetDeviceProcAddr getDeviceProcAddr);
/// Create a <c><i>FfxFsr2Device</i></c> from a <c><i>VkDevice</i></c>.
///
/// @param [in] device A pointer to the Vulkan logical device.
///
/// @returns
/// An abstract FidelityFX device.
///
/// @ingroup FSR2 VK
FFX_API FfxDevice ffxGetDeviceVK(VkDevice device);
/// Create a <c><i>FfxCommandList</i></c> from a <c><i>VkCommandBuffer</i></c>.
///
/// @param [in] cmdBuf A pointer to the Vulkan command buffer.
///
/// @returns
/// An abstract FidelityFX command list.
///
/// @ingroup FSR2 VK
FFX_API FfxCommandList ffxGetCommandListVK(VkCommandBuffer cmdBuf);
/// Create a <c><i>FfxResource</i></c> from a <c><i>VkImage</i></c>.
///
/// @param [in] context A pointer to a <c><i>FfxFsr2Context</i></c> structure.
/// @param [in] imgVk A Vulkan image resource.
/// @param [in] imageView An image view of the given image resource.
/// @param [in] width The width of the image resource.
/// @param [in] height The height of the image resource.
/// @param [in] imgFormat The format of the image resource.
/// @param [in] name (optional) A name string to identify the resource in debug mode.
/// @param [in] state The state the resource is currently in.
///
/// @returns
/// An abstract FidelityFX resources.
///
/// @ingroup FSR2 VK
FFX_API FfxResource ffxGetTextureResourceVK(FfxFsr2Context* context,
VkImage imgVk,
VkImageView imageView,
uint32_t width,
uint32_t height,
VkFormat imgFormat,
const wchar_t* name = nullptr,
FfxResourceStates state = FFX_RESOURCE_STATE_COMPUTE_READ);
/// Create a <c><i>FfxResource</i></c> from a <c><i>VkBuffer</i></c>.
///
/// @param [in] context A pointer to a <c><i>FfxFsr2Context</i></c> structure.
/// @param [in] bufVk A Vulkan buffer resource.
/// @param [in] size The size of the buffer resource.
/// @param [in] name (optional) A name string to identify the resource in debug mode.
/// @param [in] state The state the resource is currently in.
///
/// @returns
/// An abstract FidelityFX resources.
///
/// @ingroup FSR2 VK
FFX_API FfxResource ffxGetBufferResourceVK(FfxFsr2Context* context,
VkBuffer bufVk,
uint32_t size,
const wchar_t* name = nullptr,
FfxResourceStates state = FFX_RESOURCE_STATE_COMPUTE_READ);
/// Convert a <c><i>FfxResource</i></c> value to a <c><i>VkImage</i></c>.
///
/// @param [in] context A pointer to a <c><i>FfxFsr2Context</i></c> structure.
/// @param [in] resId A resourceID.
///
/// @returns
/// A <c><i>VkImage</i></c>.
///
/// @ingroup FSR2 VK
FFX_API VkImage ffxGetVkImage(FfxFsr2Context* context, uint32_t resId);
/// Convert a <c><i>FfxResource</i></c> value to a <c><i>VkImageView</i></c>.
///
/// @param [in] context A pointer to a <c><i>FfxFsr2Context</i></c> structure.
/// @param [in] resId A resourceID.
///
/// @returns
/// A <c><i>VkImage</i></c>.
///
/// @ingroup FSR2 VK
FFX_API VkImageView ffxGetVkImageView(FfxFsr2Context* context, uint32_t resId);
/// Convert a <c><i>FfxResource</i></c> value to a <c><i>VkImageLayout</i></c>.
///
/// @param [in] context A pointer to a <c><i>FfxFsr2Context</i></c> structure.
/// @param [in] resId A resourceID.
///
/// @returns
/// A <c><i>VkImage</i></c>.
///
/// @ingroup FSR2 VK
FFX_API VkImageLayout ffxGetVkImageLayout(FfxFsr2Context* context, uint32_t resId);
#if defined(__cplusplus)
}
#endif // #if defined(__cplusplus)

View File

@@ -0,0 +1,166 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include "ffx_fsr2_shaders_vk.h"
#include "vk/ffx_fsr2_tcr_autogen_pass_permutations.h"
#include "vk/ffx_fsr2_autogen_reactive_pass_permutations.h"
#include "vk/ffx_fsr2_accumulate_pass_permutations.h"
#include "vk/ffx_fsr2_compute_luminance_pyramid_pass_permutations.h"
#include "vk/ffx_fsr2_depth_clip_pass_permutations.h"
#include "vk/ffx_fsr2_lock_pass_permutations.h"
#include "vk/ffx_fsr2_reconstruct_previous_depth_pass_permutations.h"
#include "vk/ffx_fsr2_rcas_pass_permutations.h"
#if defined(POPULATE_PERMUTATION_KEY)
#undef POPULATE_PERMUTATION_KEY
#endif // #if defined(POPULATE_PERMUTATION_KEY)
#define POPULATE_PERMUTATION_KEY(options, key) \
key.index = 0; \
key.FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_REPROJECT_USE_LANCZOS_TYPE); \
key.FFX_FSR2_OPTION_HDR_COLOR_INPUT = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_HDR_COLOR_INPUT); \
key.FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_LOW_RES_MOTION_VECTORS); \
key.FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_JITTER_MOTION_VECTORS); \
key.FFX_FSR2_OPTION_INVERTED_DEPTH = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_DEPTH_INVERTED); \
key.FFX_FSR2_OPTION_APPLY_SHARPENING = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_ENABLE_SHARPENING); \
key.FFX_HALF = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_ALLOW_FP16);
#if defined(POPULATE_SHADER_BLOB)
#undef POPULATE_SHADER_BLOB
#endif // #if defined(POPULATE_SHADER_BLOB)
#define POPULATE_SHADER_BLOB(info, index) { info[index].blobData, info[index].blobSize, info[index].numStorageImageResources, info[index].numSampledImageResources, info[index].numUniformBufferResources, info[index].storageImageResourceNames, info[index].storageImageResourceBindings, info[index].sampledImageResourceNames, info[index].sampledImageResourceBindings, info[index].uniformBufferResourceNames, info[index].uniformBufferResourceBindings }
Fsr2ShaderBlobVK fsr2GetDepthClipPassPermutationBlobByIndex(uint32_t permutationOptions) {
ffx_fsr2_depth_clip_pass_PermutationKey key;
POPULATE_PERMUTATION_KEY(permutationOptions, key);
const int32_t tableIndex = g_ffx_fsr2_depth_clip_pass_IndirectionTable[key.index];
return POPULATE_SHADER_BLOB(g_ffx_fsr2_depth_clip_pass_PermutationInfo, tableIndex);
}
Fsr2ShaderBlobVK fsr2GetReconstructPreviousDepthPassPermutationBlobByIndex(uint32_t permutationOptions) {
ffx_fsr2_reconstruct_previous_depth_pass_PermutationKey key;
POPULATE_PERMUTATION_KEY(permutationOptions, key);
const int32_t tableIndex = g_ffx_fsr2_reconstruct_previous_depth_pass_IndirectionTable[key.index];
return POPULATE_SHADER_BLOB(g_ffx_fsr2_reconstruct_previous_depth_pass_PermutationInfo, tableIndex);
}
Fsr2ShaderBlobVK fsr2GetLockPassPermutationBlobByIndex(uint32_t permutationOptions) {
ffx_fsr2_lock_pass_PermutationKey key;
POPULATE_PERMUTATION_KEY(permutationOptions, key);
const int32_t tableIndex = g_ffx_fsr2_lock_pass_IndirectionTable[key.index];
return POPULATE_SHADER_BLOB(g_ffx_fsr2_lock_pass_PermutationInfo, tableIndex);
}
Fsr2ShaderBlobVK fsr2GetAccumulatePassPermutationBlobByIndex(uint32_t permutationOptions) {
ffx_fsr2_accumulate_pass_PermutationKey key;
POPULATE_PERMUTATION_KEY(permutationOptions, key);
const int32_t tableIndex = g_ffx_fsr2_accumulate_pass_IndirectionTable[key.index];
return POPULATE_SHADER_BLOB(g_ffx_fsr2_accumulate_pass_PermutationInfo, tableIndex);
}
Fsr2ShaderBlobVK fsr2GetRCASPassPermutationBlobByIndex(uint32_t permutationOptions) {
ffx_fsr2_rcas_pass_PermutationKey key;
POPULATE_PERMUTATION_KEY(permutationOptions, key);
const int32_t tableIndex = g_ffx_fsr2_rcas_pass_IndirectionTable[key.index];
return POPULATE_SHADER_BLOB(g_ffx_fsr2_rcas_pass_PermutationInfo, tableIndex);
}
Fsr2ShaderBlobVK fsr2GetComputeLuminancePyramidPassPermutationBlobByIndex(uint32_t permutationOptions) {
ffx_fsr2_compute_luminance_pyramid_pass_PermutationKey key;
key.index = 0;
key.FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE = FFX_CONTAINS_FLAG(permutationOptions, FSR2_SHADER_PERMUTATION_REPROJECT_USE_LANCZOS_TYPE);
key.FFX_FSR2_OPTION_HDR_COLOR_INPUT = FFX_CONTAINS_FLAG(permutationOptions, FSR2_SHADER_PERMUTATION_HDR_COLOR_INPUT);
key.FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS = FFX_CONTAINS_FLAG(permutationOptions, FSR2_SHADER_PERMUTATION_LOW_RES_MOTION_VECTORS);
key.FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS = FFX_CONTAINS_FLAG(permutationOptions, FSR2_SHADER_PERMUTATION_JITTER_MOTION_VECTORS);
key.FFX_FSR2_OPTION_INVERTED_DEPTH = FFX_CONTAINS_FLAG(permutationOptions, FSR2_SHADER_PERMUTATION_DEPTH_INVERTED);
key.FFX_FSR2_OPTION_APPLY_SHARPENING = FFX_CONTAINS_FLAG(permutationOptions, FSR2_SHADER_PERMUTATION_ENABLE_SHARPENING);
const int32_t tableIndex = g_ffx_fsr2_compute_luminance_pyramid_pass_IndirectionTable[key.index];
return POPULATE_SHADER_BLOB(g_ffx_fsr2_compute_luminance_pyramid_pass_PermutationInfo, tableIndex);
}
Fsr2ShaderBlobVK fsr2GetAutogenReactivePassPermutationBlobByIndex(uint32_t permutationOptions) {
ffx_fsr2_autogen_reactive_pass_PermutationKey key;
POPULATE_PERMUTATION_KEY(permutationOptions, key);
const int32_t tableIndex = g_ffx_fsr2_autogen_reactive_pass_IndirectionTable[key.index];
return POPULATE_SHADER_BLOB(g_ffx_fsr2_autogen_reactive_pass_PermutationInfo, tableIndex);
}
Fsr2ShaderBlobVK fsr2GetTcrAutogeneratePassPermutationBlobByIndex(uint32_t permutationOptions) {
ffx_fsr2_tcr_autogen_pass_PermutationKey key;
POPULATE_PERMUTATION_KEY(permutationOptions, key);
const int32_t tableIndex = g_ffx_fsr2_tcr_autogen_pass_IndirectionTable[key.index];
return POPULATE_SHADER_BLOB(g_ffx_fsr2_tcr_autogen_pass_PermutationInfo, tableIndex);
}
Fsr2ShaderBlobVK fsr2GetPermutationBlobByIndexVK(FfxFsr2Pass passId, uint32_t permutationOptions)
{
switch (passId) {
case FFX_FSR2_PASS_DEPTH_CLIP:
return fsr2GetDepthClipPassPermutationBlobByIndex(permutationOptions);
case FFX_FSR2_PASS_RECONSTRUCT_PREVIOUS_DEPTH:
return fsr2GetReconstructPreviousDepthPassPermutationBlobByIndex(permutationOptions);
case FFX_FSR2_PASS_LOCK:
return fsr2GetLockPassPermutationBlobByIndex(permutationOptions);
case FFX_FSR2_PASS_ACCUMULATE:
case FFX_FSR2_PASS_ACCUMULATE_SHARPEN:
return fsr2GetAccumulatePassPermutationBlobByIndex(permutationOptions);
case FFX_FSR2_PASS_RCAS:
return fsr2GetRCASPassPermutationBlobByIndex(permutationOptions);
case FFX_FSR2_PASS_COMPUTE_LUMINANCE_PYRAMID:
return fsr2GetComputeLuminancePyramidPassPermutationBlobByIndex(permutationOptions);
case FFX_FSR2_PASS_GENERATE_REACTIVE:
return fsr2GetAutogenReactivePassPermutationBlobByIndex(permutationOptions);
case FFX_FSR2_PASS_TCR_AUTOGENERATE:
return fsr2GetTcrAutogeneratePassPermutationBlobByIndex(permutationOptions);
default:
FFX_ASSERT_FAIL("Should never reach here.");
break;
}
// return an empty blob
Fsr2ShaderBlobVK emptyBlob = {};
return emptyBlob;
}

View File

@@ -0,0 +1,65 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#pragma once
#include <stdint.h>
#include "../../ffx_fsr2_interface.h"
#if defined(__cplusplus)
extern "C" {
#endif // #if defined(__cplusplus)
// A single shader blob and a description of its resources.
typedef struct Fsr2ShaderBlobVK {
const uint8_t* data; // A pointer to the blob
uint32_t size; // Size in bytes.
uint32_t storageImageCount; // Number of storage images.
uint32_t sampledImageCount; // Number of sampled images.
uint32_t uniformBufferCount; // Number of uniform buffers.
const char** boundStorageImageNames;
const uint32_t* boundStorageImageBindings; // Pointer to an array of bound UAV resources.
const char** boundSampledImageNames;
const uint32_t* boundSampledImageBindings; // Pointer to an array of bound SRV resources.
const char** boundUniformBufferNames;
const uint32_t* boundUniformBufferBindings; // Pointer to an array of bound ConstantBuffers.
} Fsr2ShaderBlobVK;
// The different options which contribute to permutations.
typedef enum Fs2ShaderPermutationOptionsVK {
FSR2_SHADER_PERMUTATION_REPROJECT_USE_LANCZOS_TYPE = (1 << 0), // FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE
FSR2_SHADER_PERMUTATION_HDR_COLOR_INPUT = (1 << 1), // FFX_FSR2_OPTION_HDR_COLOR_INPUT
FSR2_SHADER_PERMUTATION_LOW_RES_MOTION_VECTORS = (1 << 2), // FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS
FSR2_SHADER_PERMUTATION_JITTER_MOTION_VECTORS = (1 << 3), // FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
FSR2_SHADER_PERMUTATION_DEPTH_INVERTED = (1 << 4), // FFX_FSR2_OPTION_INVERTED_DEPTH
FSR2_SHADER_PERMUTATION_ENABLE_SHARPENING = (1 << 5), // FFX_FSR2_OPTION_APPLY_SHARPENING
FSR2_SHADER_PERMUTATION_FORCE_WAVE64 = (1 << 6), // doesn't map to a define, selects different table
FSR2_SHADER_PERMUTATION_ALLOW_FP16 = (1 << 7), // FFX_USE_16BIT
} Fs2ShaderPermutationOptionsVK;
// Get a VK shader blob for the specified pass and permutation index.
Fsr2ShaderBlobVK fsr2GetPermutationBlobByIndexVK(FfxFsr2Pass passId, uint32_t permutationOptions);
#if defined(__cplusplus)
}
#endif // #if defined(__cplusplus)