add cgwg-famicom-geom and move all raw palette shaders into a new subdir

This commit is contained in:
hunterk 2019-05-20 14:58:19 -05:00
parent 7e8d978fcd
commit e6d6393744
17 changed files with 61 additions and 14 deletions

View file

@ -1,6 +1,6 @@
shaders = 5 shaders = 5
shader0 = shaders/famicom-raw-cgwg/composite-encode.slang shader0 = shaders/cgwg-famicom-geom/composite-encode.slang
filter_linear0 = false filter_linear0 = false
scale_type0 = source scale_type0 = source
scale_x0 = 2.0 scale_x0 = 2.0
@ -8,18 +8,18 @@ frame_count_mod0 = 2
alias0 = encode_pass alias0 = encode_pass
float_framebuffer0 = true float_framebuffer0 = true
shader1 = shaders/famicom-raw-cgwg/lowpass-notch-decode-yiq.slang shader1 = shaders/cgwg-famicom-geom/lowpass-notch-decode-yiq.slang
frame_count_mod1 = 2 frame_count_mod1 = 2
filter_linear1 = false filter_linear1 = false
float_framebuffer1 = true float_framebuffer1 = true
shader2 = shaders/famicom-raw-cgwg/adaptive-comb-decode.slang shader2 = shaders/cgwg-famicom-geom/adaptive-comb-decode.slang
filter_linear2 = false filter_linear2 = false
frame_count_mod2 = 2 frame_count_mod2 = 2
float_framebuffer2 = true float_framebuffer2 = true
shader3 = shaders/famicom-raw-cgwg/lowpass-chroma.slang shader3 = shaders/cgwg-famicom-geom/lowpass-chroma.slang
filter_linear3 = false filter_linear3 = false
float_framebuffer3 = true float_framebuffer3 = true
shader4 = shaders/famicom-raw-cgwg/crt-geom-famicom.slang shader4 = shaders/cgwg-famicom-geom/crt-geom-famicom.slang

View file

@ -1,7 +1,7 @@
shaders = 3 shaders = 3
shader0 = ../misc/nes-color-decoder.slang shader0 = shaders/nes-color-decoder.slang
shader1 = shaders/ntsc-pass1-composite-3phase.slang shader1 = ../ntsc/shaders/ntsc-pass1-composite-3phase.slang
shader2 = shaders/ntsc-pass2-3phase.slang shader2 = ../ntsc/shaders/ntsc-pass2-3phase.slang
filter_linear0 = false filter_linear0 = false
filter_linear1 = false filter_linear1 = false

View file

@ -1,12 +1,9 @@
#version 450 #version 450
#pragma format R32_UINT
#pragma name encode_pass #pragma name encode_pass
layout(push_constant) uniform Push layout(push_constant) uniform Push
{ {
vec4 SourceSize; vec4 SourceSize;
vec4 OriginalSize;
vec4 OutputSize;
uint FrameCount; uint FrameCount;
} params; } params;
@ -31,12 +28,26 @@ 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;
bool wave (int p, int color)
{
return ((color + p + 8) % 12 < 6);
}
void main() void main()
{ {
/* original palette decode for historical purposes:
uint n = uint(texture(Source, vTexCoord).r); uint n = uint(texture(Source, vTexCoord).r);
uint color = n & 0xfu; uint color = n & 0xfu;
uint level = color < 0xeu ? (n>>4u)&3u : 1u; uint level = color < 0xeu ? (n>>4u)&3u : 1u;
uint emphasis = n >> 6u; uint emphasis = n >> 6u;
*/
vec4 c = texture(Source, vTexCoord.xy);
// Extract the chroma, level, and emphasis from the normalized RGB triplet
int color = int(floor((c.r * 15.0) + 0.5));
int level = int(floor((c.g * 3.0) + 0.5));
int emphasis = int(floor((c.b * 7.0) + 0.5));
const float levels[] = float[](0.350, 0.518, 0.962, 1.550, const float levels[] = float[](0.350, 0.518, 0.962, 1.550,
1.094, 1.506, 1.962, 1.962); 1.094, 1.506, 1.962, 1.962);

View file

@ -0,0 +1,36 @@
#version 450
#pragma format R32_UINT
layout(push_constant) uniform Push
{
vec4 SourceSize;
vec4 OriginalSize;
vec4 OutputSize;
uint FrameCount;
} params;
layout(std140, set = 0, binding = 0) uniform UBO
{
mat4 MVP;
} global;
#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()
{
FragColor = vec4(texture(Source, vTexCoord).rgb, 1.0);
}

View file

Before

Width:  |  Height:  |  Size: 849 B

After

Width:  |  Height:  |  Size: 849 B