diff --git a/test/famicom-raw-cgwg.slangp b/nes_raw_palette/cgwg-famicom-geom.slangp similarity index 52% rename from test/famicom-raw-cgwg.slangp rename to nes_raw_palette/cgwg-famicom-geom.slangp index 6f33ba14..020e1dc8 100644 --- a/test/famicom-raw-cgwg.slangp +++ b/nes_raw_palette/cgwg-famicom-geom.slangp @@ -1,6 +1,6 @@ shaders = 5 -shader0 = shaders/famicom-raw-cgwg/composite-encode.slang +shader0 = shaders/cgwg-famicom-geom/composite-encode.slang filter_linear0 = false scale_type0 = source scale_x0 = 2.0 @@ -8,18 +8,18 @@ frame_count_mod0 = 2 alias0 = encode_pass 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 filter_linear1 = false float_framebuffer1 = true -shader2 = shaders/famicom-raw-cgwg/adaptive-comb-decode.slang +shader2 = shaders/cgwg-famicom-geom/adaptive-comb-decode.slang filter_linear2 = false frame_count_mod2 = 2 float_framebuffer2 = true -shader3 = shaders/famicom-raw-cgwg/lowpass-chroma.slang +shader3 = shaders/cgwg-famicom-geom/lowpass-chroma.slang filter_linear3 = false float_framebuffer3 = true -shader4 = shaders/famicom-raw-cgwg/crt-geom-famicom.slang +shader4 = shaders/cgwg-famicom-geom/crt-geom-famicom.slang diff --git a/crt/gtu-famicom.slangp b/nes_raw_palette/gtu-famicom.slangp similarity index 100% rename from crt/gtu-famicom.slangp rename to nes_raw_palette/gtu-famicom.slangp diff --git a/ntsc/ntsc-nes.slangp b/nes_raw_palette/ntsc-nes.slangp similarity index 66% rename from ntsc/ntsc-nes.slangp rename to nes_raw_palette/ntsc-nes.slangp index f7625d85..ad1ed5b6 100644 --- a/ntsc/ntsc-nes.slangp +++ b/nes_raw_palette/ntsc-nes.slangp @@ -1,7 +1,7 @@ shaders = 3 -shader0 = ../misc/nes-color-decoder.slang -shader1 = shaders/ntsc-pass1-composite-3phase.slang -shader2 = shaders/ntsc-pass2-3phase.slang +shader0 = shaders/nes-color-decoder.slang +shader1 = ../ntsc/shaders/ntsc-pass1-composite-3phase.slang +shader2 = ../ntsc/shaders/ntsc-pass2-3phase.slang filter_linear0 = false filter_linear1 = false diff --git a/test/shaders/famicom-raw-cgwg/adaptive-comb-decode.slang b/nes_raw_palette/shaders/cgwg-famicom-geom/adaptive-comb-decode.slang similarity index 100% rename from test/shaders/famicom-raw-cgwg/adaptive-comb-decode.slang rename to nes_raw_palette/shaders/cgwg-famicom-geom/adaptive-comb-decode.slang diff --git a/test/shaders/famicom-raw-cgwg/composite-encode.slang b/nes_raw_palette/shaders/cgwg-famicom-geom/composite-encode.slang similarity index 77% rename from test/shaders/famicom-raw-cgwg/composite-encode.slang rename to nes_raw_palette/shaders/cgwg-famicom-geom/composite-encode.slang index cea13ac8..18aa2d79 100644 --- a/test/shaders/famicom-raw-cgwg/composite-encode.slang +++ b/nes_raw_palette/shaders/cgwg-famicom-geom/composite-encode.slang @@ -1,13 +1,10 @@ #version 450 -#pragma format R32_UINT #pragma name encode_pass layout(push_constant) uniform Push { - vec4 SourceSize; - vec4 OriginalSize; - vec4 OutputSize; - uint FrameCount; + vec4 SourceSize; + uint FrameCount; } params; layout(std140, set = 0, binding = 0) uniform UBO @@ -31,12 +28,26 @@ layout(location = 0) in vec2 vTexCoord; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 2) uniform sampler2D Source; +bool wave (int p, int color) +{ + return ((color + p + 8) % 12 < 6); +} + void main() { +/* original palette decode for historical purposes: uint n = uint(texture(Source, vTexCoord).r); uint color = n & 0xfu; 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, 1.094, 1.506, 1.962, 1.962); diff --git a/test/shaders/famicom-raw-cgwg/crt-geom-famicom.slang b/nes_raw_palette/shaders/cgwg-famicom-geom/crt-geom-famicom.slang similarity index 100% rename from test/shaders/famicom-raw-cgwg/crt-geom-famicom.slang rename to nes_raw_palette/shaders/cgwg-famicom-geom/crt-geom-famicom.slang diff --git a/nes_raw_palette/shaders/cgwg-famicom-geom/int_stock.slang b/nes_raw_palette/shaders/cgwg-famicom-geom/int_stock.slang new file mode 100644 index 00000000..dde8789d --- /dev/null +++ b/nes_raw_palette/shaders/cgwg-famicom-geom/int_stock.slang @@ -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); +} \ No newline at end of file diff --git a/test/shaders/famicom-raw-cgwg/lowpass-chroma.slang b/nes_raw_palette/shaders/cgwg-famicom-geom/lowpass-chroma.slang similarity index 100% rename from test/shaders/famicom-raw-cgwg/lowpass-chroma.slang rename to nes_raw_palette/shaders/cgwg-famicom-geom/lowpass-chroma.slang diff --git a/test/shaders/famicom-raw-cgwg/lowpass-notch-decode-yiq.slang b/nes_raw_palette/shaders/cgwg-famicom-geom/lowpass-notch-decode-yiq.slang similarity index 100% rename from test/shaders/famicom-raw-cgwg/lowpass-notch-decode-yiq.slang rename to nes_raw_palette/shaders/cgwg-famicom-geom/lowpass-notch-decode-yiq.slang diff --git a/crt/shaders/gtu-famicom/DAC.slang b/nes_raw_palette/shaders/gtu-famicom/DAC.slang similarity index 100% rename from crt/shaders/gtu-famicom/DAC.slang rename to nes_raw_palette/shaders/gtu-famicom/DAC.slang diff --git a/crt/shaders/gtu-famicom/DAC_LUT.slang b/nes_raw_palette/shaders/gtu-famicom/DAC_LUT.slang similarity index 100% rename from crt/shaders/gtu-famicom/DAC_LUT.slang rename to nes_raw_palette/shaders/gtu-famicom/DAC_LUT.slang diff --git a/crt/shaders/gtu-famicom/NesTable.png b/nes_raw_palette/shaders/gtu-famicom/NesTable.png similarity index 100% rename from crt/shaders/gtu-famicom/NesTable.png rename to nes_raw_palette/shaders/gtu-famicom/NesTable.png diff --git a/crt/shaders/gtu-famicom/combFilter.slang b/nes_raw_palette/shaders/gtu-famicom/combFilter.slang similarity index 100% rename from crt/shaders/gtu-famicom/combFilter.slang rename to nes_raw_palette/shaders/gtu-famicom/combFilter.slang diff --git a/crt/shaders/gtu-famicom/lowPass.slang b/nes_raw_palette/shaders/gtu-famicom/lowPass.slang similarity index 100% rename from crt/shaders/gtu-famicom/lowPass.slang rename to nes_raw_palette/shaders/gtu-famicom/lowPass.slang diff --git a/crt/shaders/gtu-famicom/scaleX.slang b/nes_raw_palette/shaders/gtu-famicom/scaleX.slang similarity index 100% rename from crt/shaders/gtu-famicom/scaleX.slang rename to nes_raw_palette/shaders/gtu-famicom/scaleX.slang diff --git a/crt/shaders/gtu-famicom/scaleY.slang b/nes_raw_palette/shaders/gtu-famicom/scaleY.slang similarity index 100% rename from crt/shaders/gtu-famicom/scaleY.slang rename to nes_raw_palette/shaders/gtu-famicom/scaleY.slang diff --git a/misc/nes-color-decoder.slang b/nes_raw_palette/shaders/nes-color-decoder.slang similarity index 100% rename from misc/nes-color-decoder.slang rename to nes_raw_palette/shaders/nes-color-decoder.slang