2.1.2 vulkan issue

This commit is contained in:
cdozdil
2024-03-16 02:35:24 +03:00
parent 8a8adffcf7
commit d313406e0d
11 changed files with 77 additions and 75 deletions
+1 -1
View File
@@ -82,7 +82,7 @@
<IncludePath>$(SolutionDir)external\vulkan\include;$(SolutionDir)external\nvngx_dlss_sdk;$(SolutionDir)external\xess\inc\xess;$(SolutionDir)external\simpleini;$(SolutionDir)external\unordered_dense\include;$(SolutionDir)external\spdlog\include;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)CyberXess\cas\lib;$(SolutionDir)CyberXess\fsr2\lib;$(SolutionDir)CyberXess\fsr2_212\lib;$(SolutionDir)CyberXess\vulkan;$(SolutionDir)external\xess\lib;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath)</LibraryPath>
<TargetName>nvngx</TargetName>
<OutDir>..\..\..\Games\Nioh 2 The Complete Edition</OutDir>
<OutDir>E:\Games\No Man%27s Sky\Binaries</OutDir>
<IntDir>.\x64\Debug</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -109,17 +109,17 @@ void FSR2FeatureDx11on12::ReleaseSharedResources()
spdlog::debug("FSR2FeatureDx11on12::ReleaseSharedResources start!");
SAFE_RELEASE(dx11Color.SharedTexture)
SAFE_RELEASE(dx11Mv.SharedTexture)
SAFE_RELEASE(dx11Out.SharedTexture)
SAFE_RELEASE(dx11Depth.SharedTexture)
SAFE_RELEASE(dx11Tm.SharedTexture)
SAFE_RELEASE(dx11Exp.SharedTexture)
SAFE_RELEASE(dx11Color.Dx12Resource)
SAFE_RELEASE(dx11Mv.Dx12Resource)
SAFE_RELEASE(dx11Out.Dx12Resource)
SAFE_RELEASE(dx11Depth.Dx12Resource)
SAFE_RELEASE(dx11Tm.Dx12Resource)
SAFE_RELEASE(dx11Exp.Dx12Resource)
SAFE_RELEASE(dx11Mv.SharedTexture)
SAFE_RELEASE(dx11Out.SharedTexture)
SAFE_RELEASE(dx11Depth.SharedTexture)
SAFE_RELEASE(dx11Tm.SharedTexture)
SAFE_RELEASE(dx11Exp.SharedTexture)
SAFE_RELEASE(dx11Color.Dx12Resource)
SAFE_RELEASE(dx11Mv.Dx12Resource)
SAFE_RELEASE(dx11Out.Dx12Resource)
SAFE_RELEASE(dx11Depth.Dx12Resource)
SAFE_RELEASE(dx11Tm.Dx12Resource)
SAFE_RELEASE(dx11Exp.Dx12Resource)
}
void FSR2FeatureDx11on12::GetHardwareAdapter(IDXGIFactory1* InFactory, IDXGIAdapter** InAdapter, D3D_FEATURE_LEVEL InFeatureLevel, bool InRequestHighPerformanceAdapter)
@@ -358,31 +358,53 @@ bool FSR2FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, const N
// fence operation results
HRESULT fr;
ID3D11Fence* dx11fence_1;
fr = Dx11Device->CreateFence(0, D3D11_FENCE_FLAG_SHARED, IID_PPV_ARGS(&dx11fence_1));
if (fr != S_OK)
{
spdlog::error("FSR2FeatureDx11on12::Evaluate Can't create dx11fence_1 {0:x}", fr);
return false;
}
ID3D11Fence* dx11fence_1 = nullptr;
ID3D12Fence* dx12fence_1 = nullptr;
HANDLE dx11_sharedHandle;
fr = dx11fence_1->CreateSharedHandle(nullptr, GENERIC_ALL, nullptr, &dx11_sharedHandle);
if (fr != S_OK)
D3D11_QUERY_DESC pQueryDesc;
pQueryDesc.Query = D3D11_QUERY_EVENT;
pQueryDesc.MiscFlags = 0;
ID3D11Query* query0 = nullptr;
if (Config::Instance()->UseSafeSyncQueries.value_or(0) < 3)
{
spdlog::error("FSR2FeatureDx11on12::Evaluate Can't create sharedhandle for dx11fence_1 {0:x}", fr);
return false;
fr = Dx11Device->CreateFence(0, D3D11_FENCE_FLAG_SHARED, IID_PPV_ARGS(&dx11fence_1));
if (fr != S_OK)
{
spdlog::error("FSR2FeatureDx11on12::Evaluate Can't create dx11fence_1 {0:x}", fr);
return false;
}
fr = dx11fence_1->CreateSharedHandle(nullptr, GENERIC_ALL, nullptr, &dx11_sharedHandle);
if (fr != S_OK)
{
spdlog::error("FSR2FeatureDx11on12::Evaluate Can't create sharedhandle for dx11fence_1 {0:x}", fr);
return false;
}
fr = Dx12on11Device->OpenSharedHandle(dx11_sharedHandle, IID_PPV_ARGS(&dx12fence_1));
if (fr != S_OK)
{
spdlog::error("FSR2FeatureDx11on12::Evaluate Can't create open sharedhandle for dx12fence_1 {0:x}", fr);
return false;
}
}
ID3D12Fence* dx12fence_1;
fr = Dx12on11Device->OpenSharedHandle(dx11_sharedHandle, IID_PPV_ARGS(&dx12fence_1));
if (fr != S_OK)
else
{
spdlog::error("FSR2FeatureDx11on12::Evaluate Can't create open sharedhandle for dx12fence_1 {0:x}", fr);
return false;
result = Device->CreateQuery(&pQueryDesc, &query0);
if (result != S_OK || query0 == nullptr)
{
spdlog::error("FeatureContext::FSR2FeatureDx11on12 can't create query1!");
return false;
}
// Associate the query with the copy operation
DeviceContext->Begin(query0);
}
#pragma region Texture copies
@@ -27,11 +27,6 @@ inline static std::string ResultToString212(Fsr212::FfxErrorCode result)
}
}
inline void FfxLogCallback(const char* message)
{
spdlog::debug("FSR2Feature::LogCallback FSR Runtime: {0}", message);
}
class FSR2Feature212 : public virtual IFeature
{
private:
@@ -878,11 +878,6 @@ bool FSR2FeatureDx11on12_212::InitFSR2(const NVSDK_NGX_Parameter* InParameters)
spdlog::info("FSR2Feature::InitFSR2 contextDesc.initFlags (LowResMV) {0:b}", _contextDesc.flags);
}
#if _DEBUG
_contextDesc.flags |= FFX_FSR2_ENABLE_DEBUG_CHECKING;
_contextDesc.fpMessage = FfxLogCallback;
#endif
spdlog::debug("FSR2Feature::InitFSR2 ffxFsr2ContextCreate!");
auto ret = Fsr212::ffxFsr2ContextCreate212(&_context, &_contextDesc);
@@ -366,11 +366,6 @@ bool FSR2FeatureDx12_212::InitFSR2(const NVSDK_NGX_Parameter* InParameters)
spdlog::info("FSR2Feature::InitFSR2 contextDesc.initFlags (LowResMV) {0:b}", _contextDesc.flags);
}
#if _DEBUG
_contextDesc.flags |= FFX_FSR2_ENABLE_DEBUG_CHECKING;
_contextDesc.fpMessage = FfxLogCallback;
#endif
spdlog::debug("FSR2Feature::InitFSR2 ffxFsr2ContextCreate!");
auto ret = Fsr212::ffxFsr2ContextCreate212(&_context, &_contextDesc);
@@ -100,11 +100,6 @@ bool FSR2FeatureVk212::InitFSR2(const NVSDK_NGX_Parameter* InParameters)
spdlog::info("FSR2FeatureVk::InitFSR2 contextDesc.initFlags (LowResMV) {0:b}", _contextDesc.flags);
}
#if _DEBUG
_contextDesc.flags |= FFX_FSR2_ENABLE_DEBUG_CHECKING;
_contextDesc.fpMessage = FfxLogCallback;
#endif
spdlog::debug("FSR2FeatureVk::InitFSR2 ffxFsr2ContextCreate!");
auto ret = Fsr212::ffxFsr2ContextCreate212(&_context, &_contextDesc);
@@ -45,7 +45,7 @@ namespace FfxCas
/// @returns
/// The size (in bytes) of the required scratch memory buffer for the DX12 backend.
/// @ingroup DX12Backend
FFX_API size_t ffxGetScratchMemorySizeDX12Cas(size_t maxContexts);
size_t ffxGetScratchMemorySizeDX12Cas(size_t maxContexts);
/// Create a <c><i>FfxDevice</i></c> from a <c><i>ID3D12Device</i></c>.
///
@@ -55,7 +55,7 @@ namespace FfxCas
/// An abstract FidelityFX device.
///
/// @ingroup DX12Backend
FFX_API FfxDevice ffxGetDeviceDX12Cas(ID3D12Device* device);
FfxDevice ffxGetDeviceDX12Cas(ID3D12Device* device);
/// Populate an interface with pointers for the DX12 backend.
///
@@ -72,8 +72,7 @@ namespace FfxCas
/// FFX_ERROR_CODE_INVALID_POINTER The <c><i>interface</i></c> pointer was <c><i>NULL</i></c>.
///
/// @ingroup DX12Backend
FFX_API FfxErrorCode
ffxGetInterfaceDX12Cas(FfxInterface* backendInterface, FfxDevice device, void* scratchBuffer, size_t scratchBufferSize, size_t maxContexts);
FfxErrorCode ffxGetInterfaceDX12Cas(FfxInterface* backendInterface, FfxDevice device, void* scratchBuffer, size_t scratchBufferSize, size_t maxContexts);
/// Create a <c><i>FfxCommandList</i></c> from a <c><i>ID3D12CommandList</i></c>.
///
@@ -83,7 +82,7 @@ namespace FfxCas
/// An abstract FidelityFX command list.
///
/// @ingroup DX12Backend
FFX_API FfxCommandList ffxGetCommandListDX12Cas(ID3D12CommandList* cmdList);
FfxCommandList ffxGetCommandListDX12Cas(ID3D12CommandList* cmdList);
/// Fetch a <c><i>FfxResource</i></c> from a <c><i>GPUResource</i></c>.
///
@@ -96,7 +95,7 @@ namespace FfxCas
/// An abstract FidelityFX resources.
///
/// @ingroup DX12Backend
FFX_API FfxResource ffxGetResourceDX12Cas(ID3D12Resource* dx12Resource,
FfxResource ffxGetResourceDX12Cas(ID3D12Resource* dx12Resource,
FfxResourceDescription ffxResDescription,
wchar_t* ffxResName,
FfxResourceStates state = FFX_RESOURCE_STATE_COMPUTE_READ);
+3 -3
View File
@@ -172,7 +172,7 @@ namespace FfxCas
/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.
///
/// @ingroup ffxCas
FFX_API FfxErrorCode ffxCasContextCreate(FfxCasContext* pContext, const FfxCasContextDescription* pContextDescription);
FfxErrorCode ffxCasContextCreate(FfxCasContext* pContext, const FfxCasContextDescription* pContextDescription);
/// @param [out] pContext A pointer to a <c><i>FfxCasContext</i></c> structure to populate.
/// @param [in] pDispatchDescription A pointer to a <c><i>FfxCasDispatchDescription</i></c> structure.
@@ -185,7 +185,7 @@ namespace FfxCas
/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.
///
/// @ingroup ffxCas
FFX_API FfxErrorCode ffxCasContextDispatch(FfxCasContext* pContext, const FfxCasDispatchDescription* pDispatchDescription);
FfxErrorCode ffxCasContextDispatch(FfxCasContext* pContext, const FfxCasDispatchDescription* pDispatchDescription);
/// Destroy the FidelityFX CAS context.
///
@@ -197,7 +197,7 @@ namespace FfxCas
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> was <c><i>NULL</i></c>.
///
/// @ingroup ffxCas
FFX_API FfxErrorCode ffxCasContextDestroy(FfxCasContext* pContext);
FfxErrorCode ffxCasContextDestroy(FfxCasContext* pContext);
#if defined(__cplusplus)
}
@@ -33,7 +33,7 @@ namespace Fsr212
#endif // #if defined(__cplusplus)
// A single shader blob and a description of its resources.
typedef struct Fsr2ShaderBlobDX12 {
typedef struct Fsr2ShaderBlobDX12_212 {
const uint8_t* data; // A pointer to the blob
const uint32_t size; // Size in bytes.
@@ -46,10 +46,10 @@ namespace Fsr212
const uint32_t* boundSRVResources; // Pointer to an array of bound SRV resources.
const char** boundCBVResourceNames;
const uint32_t* boundCBVResources; // Pointer to an array of bound ConstantBuffers.
} Fsr2ShaderBlobDX12;
} Fsr2ShaderBlobDX12_212;
// The different options which contribute to permutations.
typedef enum Fs2ShaderPermutationOptionsDX12 {
typedef enum Fs2ShaderPermutationOptionsDX12_212 {
FSR2_SHADER_PERMUTATION_USE_LANCZOS_TYPE = (1 << 0), // FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE. Off means reference, On means LUT
FSR2_SHADER_PERMUTATION_HDR_COLOR_INPUT = (1 << 1), // FFX_FSR2_OPTION_HDR_COLOR_INPUT
@@ -59,10 +59,10 @@ namespace Fsr212
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
} Fs2ShaderPermutationOptionsDX12;
} Fs2ShaderPermutationOptionsDX12_212;
// Get a DX12 shader blob for the specified pass and permutation index.
Fsr2ShaderBlobDX12 fsr2GetPermutationBlobByIndex(FfxFsr2Pass passId, uint32_t permutationOptions);
Fsr2ShaderBlobDX12_212 fsr2GetPermutationBlobByIndex_212(FfxFsr2Pass passId, uint32_t permutationOptions);
#if defined(__cplusplus)
}
@@ -33,7 +33,7 @@ namespace Fsr212
#endif // #if defined(__cplusplus)
// A single shader blob and a description of its resources.
typedef struct Fsr2ShaderBlobVK {
typedef struct Fsr2ShaderBlobVK212 {
const uint8_t* data; // A pointer to the blob
const uint32_t size; // Size in bytes.
@@ -46,10 +46,10 @@ namespace Fsr212
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;
} Fsr2ShaderBlobVK212;
// The different options which contribute to permutations.
typedef enum Fs2ShaderPermutationOptionsVK {
typedef enum Fs2ShaderPermutationOptionsVK212 {
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
@@ -59,10 +59,10 @@ namespace Fsr212
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;
} Fs2ShaderPermutationOptionsVK212;
// Get a VK shader blob for the specified pass and permutation index.
Fsr2ShaderBlobVK fsr2GetPermutationBlobByIndex(FfxFsr2Pass passId, uint32_t permutationOptions);
Fsr2ShaderBlobVK212 fsr2GetPermutationBlobByIndex212(FfxFsr2Pass passId, uint32_t permutationOptions);
#if defined(__cplusplus)
}
+5 -4
View File
@@ -16,13 +16,14 @@ VulkanUpscaler=auto
; Might be needed for Intel Arc cards or different Dx11 drivers
;
; Valid values are;
; 0 - Safe syncing is off
; 0 - Safe syncing is off (fastest)
; 1 - Flush after Dx11 texture copies
; 2 - Sync after output copy
; 2 - Sync after output copy
; 3 - No fences, all sync done with queries (slowest)
;
; 0 is fastest, 2 is slowest
; 0 is fastest, 3 is slowest
;
; 0 - 2 - Default (auto) is 0
; 0 - 3 - Default (auto) is 0
UseSafeSyncQueries=auto
[XeSS]