Add GBC color shader and presets

This commit is contained in:
Monroe88 2018-02-03 14:27:36 -06:00
parent e2a466c82e
commit 6d73c4f47a
5 changed files with 141 additions and 0 deletions

View file

@ -0,0 +1,6 @@
shaders = 1
shader0 = shaders/color/gbc-color.slang
filter_linear0 = false
scale_type_0 = source
scale0 = 1.0

View file

@ -0,0 +1,32 @@
shaders = "3"
shader0 = "../motionblur/shaders/motionblur-simple.slang"
filter_linear0 = "false"
scale_type0 = "source"
scale0 = "1.0"
shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang"
filter_linear1 = "false"
scale_type1 = "viewport"
scale1 = "1.0"
shader2 = "shaders/color/gbc-color.slang"
filter_linear2 = "false"
scale_type2 = "source"
scale2 = "1.0"
parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR"
RSUBPIX_R = "0.750000"
RSUBPIX_G = "0.000000"
RSUBPIX_B = "0.000000"
GSUBPIX_R = "0.000000"
GSUBPIX_G = "0.750000"
GSUBPIX_B = "0.000000"
BSUBPIX_R = "0.000000"
BSUBPIX_G = "0.000000"
BSUBPIX_B = "0.750000"
gain = "1.500000"
gamma = "2.200000"
blacklevel = "0.000000"
ambient = "0.000000"
BGR = "1.000000"

View file

@ -0,0 +1,27 @@
shaders = "2"
shader0 = "shaders/lcd-cgwg/lcd-grid-v2.slang"
filter_linear0 = "false"
scale_type0 = "viewport"
scale0 = "1.0"
shader1 = "shaders/color/gbc-color.slang"
filter_linear1 = "false"
scale_type1 = "source"
scale1 = "1.0"
parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR"
RSUBPIX_R = "0.750000"
RSUBPIX_G = "0.000000"
RSUBPIX_B = "0.000000"
GSUBPIX_R = "0.000000"
GSUBPIX_G = "0.750000"
GSUBPIX_B = "0.000000"
BSUBPIX_R = "0.000000"
BSUBPIX_G = "0.000000"
BSUBPIX_B = "0.750000"
gain = "1.500000"
gamma = "2.200000"
blacklevel = "0.000000"
ambient = "0.000000"
BGR = "1.000000"

View file

@ -0,0 +1,62 @@
#version 450
/*
GBC Color Correction Shader
A shader that replicates the LCD dynamics from a Game Boy Color
Color values are derived from Gambatte's color correction implementation.
Based on Color Mangler
Author: hunterk
License: Public domain
*/
layout(std140, set = 0, binding = 0) uniform UBO
{
mat4 MVP;
vec4 OutputSize;
vec4 OriginalSize;
vec4 SourceSize;
} global;
#define blr 0.0
#define blg 0.0
#define blb 0.0
#define r 0.78824
#define g 0.72941
#define b 0.66667
#define rg 0.00
#define rb 0.18039
#define gr 0.12157
#define gb 0.12157
#define br 0.05882
#define bg 0.24314
#pragma stage vertex
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;
void main()
{
vec4 screen = texture(Source, vTexCoord);
// r g b black
mat4 color = mat4(r, rg, rb, 0.0, //red channel
gr, g, gb, 0.0, //green channel
br, bg, b, 0.0, //blue channel
blr, blg, blb, 0.0); //alpha channel; these numbers do nothing for our purposes.
screen = color * screen;
FragColor = screen;
}

View file

@ -0,0 +1,14 @@
shaders = "2"
shader0 = "../handheld/shaders/color/gbc-color.slang"
shader1 = "../retro/shaders/retro-v2.slang"
filter_linear0 = "false"
scale_type0 = "source"
scale0 = "1.000000"
filter_linear1 = "false"
parameters = "darken_screen;RETRO_PIXEL_SIZE"
darken_screen = "0.500000"
RETRO_PIXEL_SIZE = "0.840000"