#include <algorithm>
#include <cmath>
#include <string.h>
#include <cfloat>
#include "ffx_fsr2.h"
#define FFX_CPU
#include "shaders/ffx_core.h"
#include "shaders/ffx_fsr1.h"
#include "shaders/ffx_spd.h"
#include "shaders/ffx_fsr2_callbacks_hlsl.h"
#include "ffx_fsr2_maximum_bias.h"
#ifdef __clang__
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifndef _countof
#define _countof(array) …
#endif
#ifndef _MSC_VER
#include <wchar.h>
#define wcscpy_s …
#endif
static const uint32_t FSR2_MAX_QUEUED_FRAMES = …;
#include "ffx_fsr2_private.h"
ResourceBinding;
static const ResourceBinding srvResourceBindingTable[] = …;
static const ResourceBinding uavResourceBindingTable[] = …;
static const ResourceBinding cbResourceBindingTable[] = …;
Fsr2RootSignatureLayout;
FfxRcasConstants;
Fsr2SpdConstants;
Fsr2GenerateReactiveConstants;
Fsr2GenerateReactiveConstants2;
Fsr2SecondaryUnion;
Fsr2ResourceDescription;
FfxConstantBuffer globalFsr2ConstantBuffers[4] = …;
static float lanczos2(float value)
{ … }
static float halton(int32_t index, int32_t base)
{ … }
static void fsr2DebugCheckDispatch(FfxFsr2Context_Private* context, const FfxFsr2DispatchDescription* params)
{ … }
static FfxErrorCode patchResourceBindings(FfxPipelineState* inoutPipeline)
{ … }
static FfxErrorCode createPipelineStates(FfxFsr2Context_Private* context)
{ … }
static FfxErrorCode generateReactiveMaskInternal(FfxFsr2Context_Private* contextPrivate, const FfxFsr2DispatchDescription* params);
static FfxErrorCode fsr2Create(FfxFsr2Context_Private* context, const FfxFsr2ContextDescription* contextDescription)
{ … }
static void fsr2SafeReleasePipeline(FfxFsr2Context_Private* context, FfxPipelineState* pipeline)
{ … }
static void fsr2SafeReleaseResource(FfxFsr2Context_Private* context, FfxResourceInternal resource)
{ … }
static void fsr2SafeReleaseDevice(FfxFsr2Context_Private* context, FfxDevice* device)
{ … }
static FfxErrorCode fsr2Release(FfxFsr2Context_Private* context)
{ … }
static void setupDeviceDepthToViewSpaceDepthParams(FfxFsr2Context_Private* context, const FfxFsr2DispatchDescription* params)
{ … }
static void scheduleDispatch(FfxFsr2Context_Private* context, const FfxFsr2DispatchDescription* params, const FfxPipelineState* pipeline, uint32_t dispatchX, uint32_t dispatchY)
{ … }
static FfxErrorCode fsr2Dispatch(FfxFsr2Context_Private* context, const FfxFsr2DispatchDescription* params)
{ … }
FfxErrorCode ffxFsr2ContextCreate(FfxFsr2Context* context, const FfxFsr2ContextDescription* contextDescription)
{ … }
FfxErrorCode ffxFsr2ContextDestroy(FfxFsr2Context* context)
{ … }
FfxErrorCode ffxFsr2ContextDispatch(FfxFsr2Context* context, const FfxFsr2DispatchDescription* dispatchParams)
{ … }
float ffxFsr2GetUpscaleRatioFromQualityMode(FfxFsr2QualityMode qualityMode)
{ … }
FfxErrorCode ffxFsr2GetRenderResolutionFromQualityMode(
uint32_t* renderWidth,
uint32_t* renderHeight,
uint32_t displayWidth,
uint32_t displayHeight,
FfxFsr2QualityMode qualityMode)
{ … }
FfxErrorCode ffxFsr2ContextEnqueueRefreshPipelineRequest(FfxFsr2Context* context)
{ … }
int32_t ffxFsr2GetJitterPhaseCount(int32_t renderWidth, int32_t displayWidth)
{ … }
FfxErrorCode ffxFsr2GetJitterOffset(float* outX, float* outY, int32_t index, int32_t phaseCount)
{ … }
FFX_API bool ffxFsr2ResourceIsNull(FfxResource resource)
{ … }
FfxErrorCode ffxFsr2ContextGenerateReactiveMask(FfxFsr2Context* context, const FfxFsr2GenerateReactiveDescription* params)
{ … }
static FfxErrorCode generateReactiveMaskInternal(FfxFsr2Context_Private* contextPrivate, const FfxFsr2DispatchDescription* params)
{ … }