mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 15:51:30 +11:00
add some parameters to work better with console-borders
This commit is contained in:
parent
7fd320b967
commit
7b250e6e2a
|
@ -8,6 +8,8 @@ layout(push_constant) uniform Push
|
|||
vec4 OriginalHistorySize1;
|
||||
float baseline_alpha;
|
||||
float response_time;
|
||||
float console_border_enable;
|
||||
float video_scale;
|
||||
} registers;
|
||||
|
||||
layout(std140, set = 0, binding = 0) uniform UBO
|
||||
|
@ -27,6 +29,12 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
|||
// Higher values result in longer color transition periods - [0, 1]
|
||||
#pragma parameter response_time "LCD Response Time" 0.333 0.0 0.777 0.111
|
||||
|
||||
// Change scaling to enable use in console-border shaders
|
||||
#pragma parameter console_border_enable "Console-Border Enable" 0.0 0.0 1.0 1.0
|
||||
|
||||
// Set video scale when used in console-border shaders
|
||||
#pragma parameter video_scale "Video Scale" 3.0 3.0 5.0 1.0
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Gameboy Classic Shader v0.2.2 //
|
||||
|
@ -65,21 +73,24 @@ layout(location = 3) out vec2 one_texel;
|
|||
|
||||
|
||||
// Largest integer scale of input video that will fit in the current output (y axis would typically be limiting on widescreens)
|
||||
#define video_scale floor(registers.OutputSize.y * registers.SourceSize.w)
|
||||
//#define video_scale floor(registers.OutputSize.y * registers.SourceSize.w) <- moved to parameter
|
||||
|
||||
// Size of the scaled video
|
||||
#define scaled_video_out (registers.SourceSize.xy * vec2(video_scale))
|
||||
//#define scaled_video_out (registers.SourceSize.xy * vec2(video_scale)) <- moved to parameter
|
||||
|
||||
//it's... half a pixel
|
||||
#define half_pixel (vec2(0.5) * registers.OutputSize.zw)
|
||||
|
||||
void main()
|
||||
{
|
||||
float video_scale_factor = floor(registers.OutputSize.y * registers.SourceSize.w);
|
||||
if (registers.console_border_enable > 0.5) video_scale_factor = registers.video_scale;
|
||||
vec2 scaled_video_out = (registers.SourceSize.xy * vec2(video_scale_factor));
|
||||
// Remaps position to integer scaled output
|
||||
gl_Position = global.MVP * Position / vec4( vec2(registers.OutputSize.xy / scaled_video_out), 1.0, 1.0 );
|
||||
vTexCoord = TexCoord + half_pixel;
|
||||
dot_size = registers.SourceSize.zw;
|
||||
one_texel = 1.0 / (registers.SourceSize.xy * video_scale);
|
||||
one_texel = 1.0 / (registers.SourceSize.xy * video_scale_factor);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in a new issue