Skip to content

Commit

Permalink
Merge pull request #668 from hunterk/master
Browse files Browse the repository at this point in the history
make LCD retention compensation optional
  • Loading branch information
LibretroAdmin authored Dec 25, 2024
2 parents 1e8b8ad + c6b618e commit 0ed28f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions subframe-bfi/shaders/crt-beam-simulator.slang
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ layout(push_constant) uniform Push
uint FrameCount;
uint TotalSubFrames;
uint CurrentSubFrame;
float GAIN_VS_BLUR, GAMMA, FPS_DIVISOR;
float GAIN_VS_BLUR, GAMMA, FPS_DIVISOR, LCD_ANTI_RETENTION_TOGGLE;
} params;

//------------------ Constants migrated to runtime params --------------------//
Expand All @@ -119,6 +119,9 @@ layout(push_constant) uniform Push
#define FPS_DIVISOR (1. / params.FPS_DIVISOR)
//^^ Slow down or speed up the simulation

#pragma parameter LCD_ANTI_RETENTION_TOGGLE "LCD Anti-Retention On/Off" 1.0 0.0 1.0 1.0
bool LCD_ANTI_RETENTION = bool(params.LCD_ANTI_RETENTION_TOGGLE);

//----------------------------------------------------------------------------//

//-----------------------Shadertoy Compatibility Macros-----------------------//
Expand Down Expand Up @@ -180,7 +183,8 @@ layout(std140, set = 0, binding = 0) uniform UBO
// - Scientific Reason: https://forums.blurbusters.com/viewtopic.php?t=7539 BFI interaction with LCD voltage polarity inversion
// - Known Side effect: You've decoupled the CRT simulators' own VSYNC from the real displays' VSYNC. But magically, there's no tearing artifacts :-)
// - Not needed for OLEDs, safe to turn off, but should be ON by default to be foolproof.
#define LCD_ANTI_RETENTION true
//#define LCD_ANTI_RETENTION true
//^^moved to runtime parameter
#define LCD_INVERSION_COMPENSATION_SLEW 0.001

// CRT SCAN DIRECTION. Can be useful to counteract an OS rotation of your display
Expand Down

0 comments on commit 0ed28f4

Please sign in to comment.