sameboy-lcd: Add parameters

This commit is contained in:
Monroe88 2018-03-24 16:08:00 -05:00
parent f83030f044
commit 97100730fb

View file

@ -28,12 +28,27 @@
layout(std140, set = 0, binding = 0) uniform UBO layout(std140, set = 0, binding = 0) uniform UBO
{ {
vec4 SourceSize; vec4 SourceSize;
vec4 OriginalSize; vec4 OriginalSize;
vec4 OutputSize; vec4 OutputSize;
mat4 MVP; mat4 MVP;
} global; } global;
layout(push_constant) uniform Push
{
float COLOR_LOW;
float COLOR_HIGH;
float SCANLINE_DEPTH;
} params;
#pragma parameter COLOR_LOW "Color Low" 0.8 0.0 1.5 0.05
#pragma parameter COLOR_HIGH "Color High" 1.0 0.0 1.5 0.05
#pragma parameter SCANLINE_DEPTH "Scanline Depth" 0.1 0.0 2.0 0.05
#define COLOR_LOW params.COLOR_LOW
#define COLOR_HIGH params.COLOR_HIGH
#define SCANLINE_DEPTH params.SCANLINE_DEPTH
#pragma stage vertex #pragma stage vertex
layout(location = 0) in vec4 Position; layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord; layout(location = 1) in vec2 TexCoord;
@ -41,8 +56,8 @@ layout(location = 0) out vec2 vTexCoord;
void main() void main()
{ {
gl_Position = global.MVP * Position; gl_Position = global.MVP * Position;
vTexCoord = TexCoord; vTexCoord = TexCoord;
} }
#pragma stage fragment #pragma stage fragment
@ -50,10 +65,6 @@ layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor; layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source; layout(set = 0, binding = 2) uniform sampler2D Source;
#define COLOR_LOW 0.8
#define COLOR_HIGH 1.0
#define SCANLINE_DEPTH 0.1
void main() void main()
{ {
vec2 pos = fract(vTexCoord * global.SourceSize.xy); vec2 pos = fract(vTexCoord * global.SourceSize.xy);