feat: add FXAA post-process anti-aliasing, combinable with MSAA

This commit is contained in:
Kelsi 2026-03-12 16:43:48 -07:00
parent 819a690c33
commit 6e95709b68
5 changed files with 495 additions and 2 deletions

View file

@ -271,6 +271,10 @@ public:
float getShadowDistance() const { return shadowDistance_; }
void setMsaaSamples(VkSampleCountFlagBits samples);
// FXAA post-process anti-aliasing (combinable with MSAA)
void setFXAAEnabled(bool enabled);
bool isFXAAEnabled() const { return fxaa_.enabled; }
// FSR (FidelityFX Super Resolution) upscaling
void setFSREnabled(bool enabled);
bool isFSREnabled() const { return fsr_.enabled; }
@ -398,6 +402,31 @@ private:
void destroyFSRResources();
void renderFSRUpscale();
// FXAA post-process state
struct FXAAState {
bool enabled = false;
bool needsRecreate = false;
// Off-screen scene target (same resolution as swapchain — no scaling)
AllocatedImage sceneColor{}; // 1x resolved color target
AllocatedImage sceneDepth{}; // Depth (matches MSAA sample count)
AllocatedImage sceneMsaaColor{}; // MSAA color target (when MSAA > 1x)
AllocatedImage sceneDepthResolve{}; // Depth resolve (MSAA + depth resolve)
VkFramebuffer sceneFramebuffer = VK_NULL_HANDLE;
VkSampler sceneSampler = VK_NULL_HANDLE;
// FXAA fullscreen pipeline
VkPipeline pipeline = VK_NULL_HANDLE;
VkPipelineLayout pipelineLayout = VK_NULL_HANDLE;
VkDescriptorSetLayout descSetLayout = VK_NULL_HANDLE;
VkDescriptorPool descPool = VK_NULL_HANDLE;
VkDescriptorSet descSet = VK_NULL_HANDLE;
};
FXAAState fxaa_;
bool initFXAAResources();
void destroyFXAAResources();
void renderFXAAPass();
// FSR 2.2 temporal upscaling state
struct FSR2State {
bool enabled = false;