Files
Xenia-Canary/src/xenia/gpu/shaders/fxaa.hlsli
Triang3l fe3f0f26e4 [UI] Image post-processing and full presentation/window rework
[GPU] Add FXAA post-processing
[UI] Add FidelityFX FSR and CAS post-processing
[UI] Add blue noise dithering from 10bpc to 8bpc
[GPU] Apply the DC PWL gamma ramp closer to the spec, supporting fully white color
[UI] Allow the GPU CP thread to present on the host directly, bypassing the UI thread OS paint event
[UI] Allow variable refresh rate (or tearing)
[UI] Present the newest frame (restart) on DXGI
[UI] Replace GraphicsContext with a far more advanced Presenter with more coherent surface connection and UI overlay state management
[UI] Connect presentation to windows via the Surface class, not native window handles
[Vulkan] Switch to simpler Vulkan setup with no instance/device separation due to interdependencies and to pass fewer objects around
[Vulkan] Lower the minimum required Vulkan version to 1.0
[UI/GPU] Various cleanup, mainly ComPtr usage
[UI] Support per-monitor DPI awareness v2 on Windows
[UI] DPI-scale Dear ImGui
[UI] Replace the remaining non-detachable window delegates with unified window event and input listeners
[UI] Allow listeners to safely destroy or close the window, and to register/unregister listeners without use-after-free and the ABA problem
[UI] Explicit Z ordering of input listeners and UI overlays, top-down for input, bottom-up for drawing
[UI] Add explicit window lifecycle phases
[UI] Replace Window virtual functions with explicit desired state, its application, actual state, its feedback
[UI] GTK: Apply the initial size to the drawing area
[UI] Limit internal UI frame rate to that of the monitor
[UI] Hide the cursor using a timer instead of polling due to no repeated UI thread paints with GPU CP thread presentation, and only within the window
2022-01-29 13:22:03 +03:00

49 lines
1.8 KiB
HLSL

// Inputs:
// - FXAA_QUALITY__PRESET
// - FXAA_QUALITY__SUBPIX
// - FXAA_QUALITY__EDGE_THRESHOLD
// - FXAA_QUALITY__EDGE_THRESHOLD_MIN
// "use of potentially uninitialized variable" in FxaaPixelShader due to the
// early exit with a `return` in the beginning of the function, caused by a bug
// in FXC (the warning is common for early exiting in HLSL in general).
#pragma warning(disable: 4000)
cbuffer XeApplyGammaRampConstants : register(b0) {
uint2 xe_fxaa_size;
float2 xe_fxaa_size_inv;
};
RWTexture2D<unorm float4> xe_fxaa_dest : register(u0);
Texture2D<float4> xe_fxaa_source : register(t0);
SamplerState xe_sampler_linear_clamp : register(s0);
#define FXAA_PC 1
#define FXAA_HLSL_5 1
#include "../../../../third_party/fxaa/FXAA3_11.h"
[numthreads(8, 8, 1)]
void main(uint3 xe_thread_id : SV_DispatchThreadID) {
[branch] if (any(xe_thread_id.xy >= xe_fxaa_size)) {
return;
}
FxaaTex fxaa_texture;
fxaa_texture.smpl = xe_sampler_linear_clamp;
fxaa_texture.tex = xe_fxaa_source;
// Force alpha to 1 to simplify calculations, won't need it anymore anyway.
xe_fxaa_dest[xe_thread_id.xy] =
float4(
FxaaPixelShader(
(float2(xe_thread_id.xy) + 0.5) * xe_fxaa_size_inv,
(float2(xe_thread_id.xy).xyxy + float2(0.0, 1.0).xxyy) *
xe_fxaa_size_inv.xyxy,
fxaa_texture, fxaa_texture, fxaa_texture, xe_fxaa_size_inv,
float2(-0.5, 0.5).xxyy * xe_fxaa_size_inv.xyxy,
float2(-2.0, 2.0).xxyy * xe_fxaa_size_inv.xyxy,
float2(8.0, -4.0).xxyy * xe_fxaa_size_inv.xyxy,
FXAA_QUALITY__SUBPIX, FXAA_QUALITY__EDGE_THRESHOLD,
FXAA_QUALITY__EDGE_THRESHOLD_MIN, 8.0, 0.125, 0.05,
float4(1.0, -1.0, 0.25, -0.25)).rgb,
1.0);
}