Analog Shader Pack v3 - slang edition
=====================================

The whole Analog Shader Pack v3 converted from Cg (.cg / .cgp) to RetroArch's
slang format (.slang / .slangp), plus the five 199X presets.

INSTALL
  Copy this folder into RetroArch's shader directory, for example
      RetroArch/shaders/shaders_slang/Analog Shader Pack v3/
  then: Quick Menu > Shaders > Load Preset and pick any .slangp.
  Slang needs the Vulkan, glcore, D3D11/12 or Metal video driver
  (Settings > Drivers > Video). The plain "gl" driver only runs Cg/GLSL.

WHAT'S INSIDE (475 presets)
  Arcade monitors - Horizontal / Vertical   64 presets
  Computer monitors                          5
  Professional monitors (+ Vertical)        46
  Televisions (Flat, Curved, Vintage)       96
  Magazine Shader                            1
  shaders_slang/Analog Shader Pack/*.slangp 18  (the pack's base looks)
  shaders_slang/ntsc*/*.slangp             240  (the pack's 24 tuned NTSC folders)
  199X/                                      5  (your MAIN, Contrast, LongNights,
                                                 Bloom, Bloom_Clear)

  The folder layout mirrors the Cg pack: every preset sits where its .cgp did,
  and shaders_slang/ mirrors shaders_cg/.

NOT CONVERTED (on purpose)
  shaders_cg/ also carried a full copy of libretro's old common-shaders
  library: about 590 stock presets (crt-royale, xbr, hqx, ...), and the pack
  duplicated TroggleMonkey's blur benchmark/quality-test presets 7 times
  (~960 files). None of these are part of the pack's own looks, and all of
  them already exist in RetroArch's official slang-shaders collection.

HOW IT WAS PORTED
  * 146 distinct shader variants were identified by content (including each NTSC
    folder's own ntsc-param.inc). Untouched libretro originals and the author's
    modified copies were told apart by comparing against libretro's
    common-shaders git history.
  * TroggleMonkey's royale blurs are byte-identical to libretro's, so the
    official slang ports are bundled (blurs/ + include/, MIT licence).
  * Everything else was ported to Vulkan GLSL by hand or, for the 24
    "oldtvshader" variants and the NTSC folders, generated from one template
    with each file's own constants.
  * Every preset was loaded and run in an actual RetroArch build (Vulkan
    driver), with no shader errors, and its output was checked on a test image.

BEHAVIOUR NOTES (Cg -> slang differences that needed a decision)
  1. Shared parameter names. Cg let two passes declare the same #pragma parameter
     differently (e.g. SHARPNESS, COLOR_BOOST, shadowMask, R). Slang refuses
     that, so each name now has one definition pack-wide: the union of the
     ranges, the most common default. Every preset writes explicit values,
     so defaults never decide the look.
  2. Duplicate values in presets. 157 .cgp files list a parameter twice
     with different values (e.g. Astrocity: R = 0.0 and later R = 2.0, where
     image-adjustment's "Red" and crt-geom's "Radius" share the name R). While a
     preset was being tuned, RetroArch's Cg backend applied every entry in order,
     so the LATER value is what the author saw, and that is what's used. (On a
     fresh reload Cg read the first value instead, which makes e.g. both
     Astrocity presets render black.)
  3. PASS1 / PASSPREVn. Cg's "PASS1" is slang's PassOutput0. "PASSPREVn"
     (n passes back) depends on position, so the converter writes small copies
     named *.from-PassOutputN.slang next to the 3 shaders that use it.
  4. FEEDBACK. None of the presets set feedback_pass, and in that case
     RetroArch's Cg backend binds the current original frame as FEEDBACK.
     feedback.slang therefore reads Original.
  5. Padded textures. Cg in RetroArch used power-of-two padded textures. Shaders
     that used fixed texture-space offsets (the sharpen filters, oldtv chroma
     shift, big blur, halation gaussians, quad_interp, 4xSoft/advanced-aa
     resolution overrides) rescale those offsets so their strength matches.
  6. Cg quirks kept on purpose: the NTSC "component" folder's PI = 15.14159265;
     oldtvshader clamp(x, hi, lo) calls (evaluated as min(max(x, lo), hi), as
     GPUs do); bloom - Copy's all-zero blur offsets; quad_interp's very large
     default sample offsets (its off-texture taps read black, as clamp_to_border
     did in Cg; this is built into the shader so it doesn't depend on the driver).
  7. The pack's "ntsc-pass2-3phase-gamma" had a "##ifdef" typo; its gamma
     values are exposed as normal parameters.
  8. Two base presets ("VINTAGE TV" and "VINTAGE TV - Copy (2)") had a doubled
     quote in a shader path (""VINTAGE TV/cam02-ucs-forward.cg"); the intended
     path was used.
  9. Framebuffer formats. RetroArch's slang backends ignore float_framebuffer /
     srgb_framebuffer on a pass that has no scale_type, while the Cg backend
     honoured them. Such passes now carry an explicit scale_type = source,
     scale = 1.0 (the size they had anyway) so their formats still apply.
     Where Cg had both flags on one pass, it used float; that is kept by
     turning sRGB off on that pass, since slang would pick sRGB instead.
 10. Parameters are referenced as global.NAME directly rather than through
     #define NAME global.NAME macros, which RetroArch's built-in glslang
     mis-expands inside other macros.

CREDITS
  Analog Shader Pack by its original author. Shaders by Themaister, hunterk,
  cgwg, Hyllian, EasyMode, Timothy Lottes, TroggleMonkey, guest, Sp00kyFox,
  bacondither, mudlord and the libretro shader contributors; licences as
  noted in each file.
