SPDRenderModule
class SPDRenderModule : public cauldron::RenderModuleSPDRenderModule 负责处理 SPD 的多项任务。
SPDRenderModule 负责:创建 UI 部分,使用 FidelityFX SPD 效果组件允许用户在 SPD 选项之间切换,对立方体纹理的所有面执行降采样。
依赖项: FfxSpdContext, FfxSpdContextDescription
继承自: public cauldron::RenderModule
公共接口
构造函数
SPDRenderModule
inline SPDRenderModule()带默认行为的构造函数。
属性: inline
来源: samples/spd/spdrendermodule.h (第 76 行, 第 5 列)
析构函数
~SPDRenderModule
virtual ~SPDRenderModule()拆解 FFX API 上下文并释放资源。
属性: virtual
来源: samples/spd/spdrendermodule.h (第 81 行, 第 13 列)
公共函数
初始化
virtual void Init(const json &initData) override初始化 FFX API 上下文,加载降采样资源,并为 SPD 设置 UI 部分。
参数
| 名称 | 类型 | 默认 |
|---|---|---|
initData | const json & | “ |
属性: virtual
来源: samples/spd/spdrendermodule.h (第 86 行, 第 10 列)
执行
virtual void Execute(double deltaTime, cauldron::CommandList *pCmdList) override设置本帧 FFX API 所需的降采样纹理和参数,然后调用 FFX Dispatch。
参数
| 名称 | 类型 | 默认 |
|---|---|---|
deltaTime | double | “ |
pCmdList | cauldron::CommandList * | “ |
属性: virtual
来源: samples/spd/spdrendermodule.h (第 91 行, 第 10 列)
OnResize
virtual void OnResize(const cauldron::ResolutionInfo &resInfo) override当分辨率更改时,由框架调用。
参数
| 名称 | 类型 | 默认 |
|---|---|---|
resInfo | const cauldron::ResolutionInfo & | “ |
属性: virtual
来源: samples/spd/spdrendermodule.h (第 96 行, 第 10 列)
私有接口
私有函数
TextureLoadComplete
void TextureLoadComplete(const std::vector<const cauldron::Texture *> &textureList, void *)纹理加载的回调,以便我们完成参数绑定并将模块标记为“就绪”。
参数
| 名称 | 类型 | 默认 |
|---|---|---|
textureList | const std::vector<const cauldron::Texture *> & | “ |
| “ | void * | “ |
来源: samples/spd/spdrendermodule.h (第 103 行, 第 10 列)
InitFfxContext
void InitFfxContext()来源: samples/spd/spdrendermodule.h (第 105 行, 第 10 列)
DestroyFfxContext
void DestroyFfxContext()来源: samples/spd/spdrendermodule.h (第 106 行, 第 10 列)
ExecutePSDownsample
void ExecutePSDownsample(double deltaTime, cauldron::CommandList *pCmdList)通过连续的像素着色器调用执行传统的基于栅格化的分层降采样。
参数
| 名称 | 类型 | 默认 |
|---|---|---|
deltaTime | double | “ |
pCmdList | cauldron::CommandList * | “ |
来源: samples/spd/spdrendermodule.h (第 111 行, 第 10 列)
ExecuteCSDownsample
void ExecuteCSDownsample(double deltaTime, cauldron::CommandList *pCmdList)通过连续的计算着色器调用执行传统的基于计算的分层降采样。
参数
| 名称 | 类型 | 默认 |
|---|---|---|
deltaTime | double | “ |
pCmdList | cauldron::CommandList * | “ |
来源: samples/spd/spdrendermodule.h (第 116 行, 第 10 列)
ExecuteSPDDownsample
void ExecuteSPDDownsample(double deltaTime, cauldron::CommandList *pCmdList)通过一次 dispatch 调用执行基于 FidelityFX SPD 的降采样。
参数
| 名称 | 类型 | 默认 |
|---|---|---|
deltaTime | double | “ |
pCmdList | cauldron::CommandList * | “ |
来源: samples/spd/spdrendermodule.h (第 121 行, 第 10 列)
ExecuteVerificationQuads
void ExecuteVerificationQuads(double deltaTime, cauldron::CommandList *pCmdList)将 mipmap 四边形渲染到场景以进行验证。
参数
| 名称 | 类型 | 默认 |
|---|---|---|
deltaTime | double | “ |
pCmdList | cauldron::CommandList * | “ |
来源: samples/spd/spdrendermodule.h (第 126 行, 第 10 列)
UpdateSPDContext
void UpdateSPDContext(bool enabled)在 UI 级别进行功能更改时,销毁和/或重新创建 FidelityFX SPD 上下文。
参数
| 名称 | 类型 | 默认 |
|---|---|---|
enabled | bool | “ |
来源: samples/spd/spdrendermodule.h (第 131 行, 第 10 列)
InitTraditionalDSPipeline
void InitTraditionalDSPipeline(bool computeDownsample)构建比较降采样所需的所有 GPU 资源(签名、管线、参数绑定)。
参数
| 名称 | 类型 | 默认 |
|---|---|---|
computeDownsample | bool | “ |
来源: samples/spd/spdrendermodule.h (第 136 行, 第 10 列)
InitVerificationPipeline
void InitVerificationPipeline()构建输出 SPD 验证 mip 所需的所有 GPU 资源(签名、管线、参数绑定)。
来源: samples/spd/spdrendermodule.h (第 141 行, 第 10 列)
私有成员
PipelineSet m_PipelineSets
PipelineSet m_PipelineSets属性: private
来源: samples/spd/spdrendermodule.h (第 150 行, 第 17 列)
PipelineSet m_VerificationSet
PipelineSet m_VerificationSet = = {}属性: private
来源: samples/spd/spdrendermodule.h (第 151 行, 第 17 列)
int32_t m_DownsamplerUsed
int32_t m_DownsamplerUsed = = 2属性: private
来源: samples/spd/spdrendermodule.h (第 153 行, 第 17 列)
int32_t m_SPDLoadLinear
int32_t m_SPDLoadLinear = = 0属性: private
来源: samples/spd/spdrendermodule.h (第 154 行, 第 17 列)
int32_t m_SPDWaveInterop
int32_t m_SPDWaveInterop = = 0属性: private
来源: samples/spd/spdrendermodule.h (第 155 行, 第 17 列)
int32_t m_SPDMath
int32_t m_SPDMath = = 0属性: private
来源: samples/spd/spdrendermodule.h (第 156 行, 第 17 列)
uint32_t m_ViewSlice
uint32_t m_ViewSlice = = 0属性: private
来源: samples/spd/spdrendermodule.h (第 157 行, 第 17 列)
std::vector<const cauldron::RasterView *> m_RasterViews
std::vector<const cauldron::RasterView *> m_RasterViews = = {}属性: private
来源: samples/spd/spdrendermodule.h (第 160 行, 第 19 列)
const cauldron::Texture * m_pCubeTexture
const cauldron::Texture * m_pCubeTexture = = nullptr属性: private
来源: samples/spd/spdrendermodule.h (第 163 行, 第 36 列)
cauldron::SamplerDesc m_LinearSamplerDesc
cauldron::SamplerDesc m_LinearSamplerDesc属性: private
来源: samples/spd/spdrendermodule.h (第 164 行, 第 37 列)
const cauldron::Texture * m_pColorTarget
const cauldron::Texture * m_pColorTarget = = nullptr属性: private
来源: samples/spd/spdrendermodule.h (第 165 行, 第 36 列)
const cauldron::RasterView * m_pColorRasterView
const cauldron::RasterView * m_pColorRasterView = = nullptr属性: private
来源: samples/spd/spdrendermodule.h (第 166 行, 第 36 列)
FfxSpdContextDescription m_InitializationParameters
FfxSpdContextDescription m_InitializationParameters = = {}属性: private
来源: samples/spd/spdrendermodule.h (第 169 行, 第 30 列)
FfxSpdContext m_Context
FfxSpdContext m_Context属性: private
来源: samples/spd/spdrendermodule.h (第 170 行, 第 30 列)
bool m_ContextCreated
bool m_ContextCreated = = false属性: private
来源: samples/spd/spdrendermodule.h (第 171 行, 第 30 列)
来源: samples/spd/spdrendermodule.h (第 70 行, 第 1 列)