You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
#pragma once
|
|
#include "UpscalerGraphicsDevice.h"
|
|
|
|
#include "ffx-fsr2-api/ffx_fsr2.h"
|
|
|
|
#include <d3d11.h>
|
|
#include "UnityPluginAPI/IUnityGraphics.h"
|
|
#include "UnityPluginAPI/IUnityGraphicsD3D11.h"
|
|
|
|
struct FSR2Feature
|
|
{
|
|
FfxFsr2Context fsr2Context;
|
|
bool isValid;
|
|
|
|
uint32_t upscaleSizeWidth;
|
|
uint32_t upscaleSizeHeight;
|
|
uint32_t flags;
|
|
|
|
uint64_t dispatchFrameValue;
|
|
|
|
FSR3TextureTable textureTable;
|
|
};
|
|
|
|
class FSR2Upscaler_DX11 : public UpscalerGraphicsDevice<FSR2Feature>
|
|
{
|
|
public:
|
|
FSR2Upscaler_DX11(IUnityGraphicsD3D11* graphicsDevice) :
|
|
m_GraphicsDevice(graphicsDevice), m_DX11Device(nullptr), m_Fsr2Interface()
|
|
{
|
|
}
|
|
|
|
bool Init() override;
|
|
|
|
protected:
|
|
bool IsValidFeature(FSR2Feature& feature);
|
|
|
|
bool InitFeature(FSR2Feature& feature, const FSR3CommandInitializationData* initData);
|
|
void SetTexture(FSR3Texture textureType, UnityTextureID textureID, uint32_t width, uint32_t height, FSR3TextureDesc* outTextureDesc);
|
|
void Execute(FSR2Feature& feature, const FSR3CommandExecutionData* execData);
|
|
|
|
void AwaitEndOfFrame(uint64_t frameValue);
|
|
void DestroyContext(FSR2Feature& feature);
|
|
|
|
void DoShutdown();
|
|
|
|
private:
|
|
IUnityGraphicsD3D11* m_GraphicsDevice;
|
|
FfxDevice m_DX11Device;
|
|
FfxFsr2Interface m_Fsr2Interface;
|
|
};
|