Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/amd-fsr2/ffx_fsr2_private.h
9903 views
1
// This file is part of the FidelityFX SDK.
2
//
3
// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
// The above copyright notice and this permission notice shall be included in
12
// all copies or substantial portions of the Software.
13
//
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
// THE SOFTWARE.
21
22
#pragma once
23
24
// Constants for FSR2 DX12 dispatches. Must be kept in sync with cbFSR2 in ffx_fsr2_callbacks_hlsl.h
25
typedef struct Fsr2Constants {
26
27
int32_t renderSize[2];
28
int32_t maxRenderSize[2];
29
int32_t displaySize[2];
30
int32_t inputColorResourceDimensions[2];
31
int32_t lumaMipDimensions[2];
32
int32_t lumaMipLevelToUse;
33
int32_t frameIndex;
34
35
float deviceToViewDepth[4];
36
float jitterOffset[2];
37
float motionVectorScale[2];
38
float downscaleFactor[2];
39
float motionVectorJitterCancellation[2];
40
float preExposure;
41
float previousFramePreExposure;
42
float tanHalfFOV;
43
float jitterPhaseCount;
44
float deltaTime;
45
float dynamicResChangeFactor;
46
float viewSpaceToMetersFactor;
47
48
float pad;
49
float reprojectionMatrix[16];
50
} Fsr2Constants;
51
52
struct FfxFsr2ContextDescription;
53
struct FfxDeviceCapabilities;
54
struct FfxPipelineState;
55
struct FfxResource;
56
57
// FfxFsr2Context_Private
58
// The private implementation of the FSR2 context.
59
typedef struct FfxFsr2Context_Private {
60
61
FfxFsr2ContextDescription contextDescription;
62
Fsr2Constants constants;
63
FfxDevice device;
64
FfxDeviceCapabilities deviceCapabilities;
65
FfxPipelineState pipelineDepthClip;
66
FfxPipelineState pipelineReconstructPreviousDepth;
67
FfxPipelineState pipelineLock;
68
FfxPipelineState pipelineAccumulate;
69
FfxPipelineState pipelineAccumulateSharpen;
70
FfxPipelineState pipelineRCAS;
71
FfxPipelineState pipelineComputeLuminancePyramid;
72
FfxPipelineState pipelineGenerateReactive;
73
FfxPipelineState pipelineTcrAutogenerate;
74
75
// 2 arrays of resources, as e.g. FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_STATUS will use different resources when bound as SRV vs when bound as UAV
76
FfxResourceInternal srvResources[FFX_FSR2_RESOURCE_IDENTIFIER_COUNT];
77
FfxResourceInternal uavResources[FFX_FSR2_RESOURCE_IDENTIFIER_COUNT];
78
79
bool firstExecution;
80
bool refreshPipelineStates;
81
uint32_t resourceFrameIndex;
82
float previousJitterOffset[2];
83
int32_t jitterPhaseCountRemaining;
84
} FfxFsr2Context_Private;
85
86