GPU/HW: Shader compile fix

This commit is contained in:
Stenzek 2024-01-20 02:14:36 +10:00
parent 7c340609ed
commit 687e212dfe
No known key found for this signature in database
2 changed files with 10 additions and 7 deletions

View file

@ -774,16 +774,18 @@ float4 SampleFromVRAM(uint4 texpage, float2 coords)
// From https://alex.vlachos.com/graphics/Alex_Vlachos_Advanced_VR_Rendering_GDC2015.pdf
// and https://www.shadertoy.com/view/MslGR8 (5th one starting from the bottom)
// NOTE: `frag_coord` is in pixels (i.e. not normalized UV).
float3 ApplyDebanding(float2 frag_coord) {
float3 ApplyDebanding(float2 frag_coord)
{
#if DEBANDING
// Iestyn's RGB dither (7 asm instructions) from Portal 2 X360, slightly modified for VR.
float3 dither = float3(dot(vec2(171.0, 231.0), frag_coord));
dither.rgb = fract(dither.rgb / float3(103.0, 71.0, 97.0));
float ditherc = dot(vec2(171.0, 231.0), frag_coord);
float3 dither = float3(ditherc, ditherc, ditherc);
dither = fract(dither / float3(103.0, 71.0, 97.0));
// Subtract 0.5 to avoid slightly brightening the whole viewport.
return (dither.rgb - 0.5) / 255.0;
return (dither - 0.5) / 255.0;
#else
return float3(0.0);
return float3(0.0, 0.0, 0.0);
#endif
}
)";

View file

@ -22,6 +22,7 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(SettingsWindow* dialog, QWi
Settings::DEFAULT_GPU_DOWNSAMPLE_MODE);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.gpuDownsampleScale, "GPU", "DownsampleScale", 1);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.trueColor, "GPU", "TrueColor", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.debanding, "GPU", "Debanding", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.scaledDithering, "GPU", "ScaledDithering", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.disableInterlacing, "GPU", "DisableInterlacing", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.forceNTSCTimings, "GPU", "ForceNTSCTimings", false);