# crt-royale-fast: a fast crt-royale adapted from original sources by Hyllian (2024).

shaders = "8"

textures = "mask_grille_texture_small;mask_slot_texture_small;mask_shadow_texture_small"
mask_grille_texture_small = "../../../crt/shaders/crt-royale/TileableLinearApertureGrille15Wide8And5d5SpacingResizeTo64BGR.png"
mask_slot_texture_small = "../../../crt/shaders/crt-royale/TileableLinearSlotMaskTall15Wide9And4d5Horizontal9d14VerticalSpacingResizeTo64BGRshifted.png"
mask_shadow_texture_small = "../../../crt/shaders/crt-royale/TileableLinearShadowMaskEDPResizeTo64.png"
mask_grille_texture_small_wrap_mode = "repeat"
mask_slot_texture_small_wrap_mode = "repeat"
mask_shadow_texture_small_wrap_mode = "repeat"
mask_grille_texture_small_linear = "true"
mask_slot_texture_small_linear = "true"
mask_shadow_texture_small_linear = "true"
mask_grille_texture_small_mipmap = "false"  # Mipmapping causes artifacts with manually resized masks without tex2Dlod
mask_slot_texture_small_mipmap = "false"    # Mipmapping causes artifacts with manually resized masks without tex2Dlod
mask_shadow_texture_small_mipmap = "false"  # Mipmapping causes artifacts with manually resized masks without tex2Dlod

# Pass0: Linearize the input based on CRT gamma and bob interlaced fields.
# (Bobbing ensures we can immediately blur without getting artifacts.)
shader0 = "../../../crt/shaders/crt-royale/src-fast/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang"
alias0 = "ORIG_LINEARIZED"
filter_linear0 = "false"
scale_type0 = "source"
scale0 = "1.0"
srgb_framebuffer0 = "true"


# Pass1: Resample interlaced scanlines vertically.
# Separating vertical/horizontal scanline sampling is faster: It lets us
# consider more scanlines while calculating weights for fewer pixels, and
# it reduces our samples from vertical*horizontal to vertical+horizontal.
# This has to come right after ORIG_LINEARIZED, because there's no
# "original_source" scale_type we can use later.
shader1 = "../../../crt/shaders/crt-royale/src-fast/crt-royale-scanlines-vertical-interlacing.slang"
alias1 = "VERTICAL_SCANLINES"
filter_linear1 = "true"
scale_type_x1 = "source"
scale_x1 = "1.0"
scale_type_y1 = "viewport"
scale_y1 = "1.0"
srgb_framebuffer1 = "true"

# Pass2: Resize the phosphor mask vertically.
shader2 = "../../../crt/shaders/crt-royale/src-fast/crt-royale-mask-resize-vertical.slang"
filter_linear2 = "true"
scale_type_x2 = "absolute"
scale_x2 = "64"
scale_type_y2 = "viewport"
scale_y2 = "0.0625" # Safe for >= 341.333 horizontal triads at viewport size
#srgb_framebuffer2 = "false" # mask_texture is already assumed linear

# Pass3: Resize the phosphor mask horizontally.  scale_x3 = scale_y5.
shader3 = "../../../crt/shaders/crt-royale/src-fast/crt-royale-mask-resize-horizontal.slang"
alias3 = "MASK_RESIZE"
filter_linear3 = "false"
scale_type_x3 = "viewport"
scale_x3 = "0.0625"
scale_type_y3 = "source"
scale_y3 = "1.0"
#srgb_framebuffer3 = "false" # mask_texture is already assumed linear

# Pass4: Resample scanlines horizontally, apply the phosphor mask.
shader4 = "../../../crt/shaders/crt-royale/src-fast/crt-royale-scanlines-horizontal-apply-mask.slang"
alias4 = "MASKED_SCANLINES"
filter_linear4 = "true" # This could just as easily be nearest neighbor.
scale_type4 = "viewport"
scale4 = "1.0"
srgb_framebuffer4 = "true"

# Pass5: Compute a brightpass.  This will require reading the final mask.
shader5 = "../../../crt/shaders/crt-royale/src-fast/crt-royale-brightpass.slang"
alias5 = "BRIGHTPASS"
filter_linear5 = "true" # This could just as easily be nearest neighbor.
scale_type5 = "viewport"
scale5 = "1.0"
srgb_framebuffer5 = "true"

# Pass6: Blur the brightpass vertically
shader6 = "../../../crt/shaders/crt-royale/src-fast/crt-royale-bloom-vertical.slang"
filter_linear6 = "true" # This could just as easily be nearest neighbor.
scale_type6 = "source"
scale6 = "1.0"
srgb_framebuffer6 = "true"

# Pass7: Blur the brightpass horizontally and combine it with the dimpass:
shader7 = "../../../crt/shaders/crt-royale/src-fast/crt-royale-bloom-horizontal-reconstitute.slang"
filter_linear7 = "true"
scale_type7 = "source"
scale7 = "1.0"
srgb_framebuffer7 = "true"
wrap_mode7 = "clamp_to_edge"

lcd_gamma = "2.400000"
bloom_underestimate_levels = "1.000000"
beam_min_sigma = "0.150000"
beam_max_sigma = "0.270000"
mask_type = "1.000000"
mask_triad_size_desired = "4.000000"
