mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-23 00:01:31 +11:00
296 lines
12 KiB
Plaintext
296 lines
12 KiB
Plaintext
# TODO:
|
|
# Guess more aspect ratios: edit. nope: Guessing is impossible..
|
|
# Update pipeline graph
|
|
|
|
# Investigate the possible use of mipmapping in bloom function too.
|
|
# Try to move flickering scanlines into main, maybe by faking them with screenlines?
|
|
|
|
|
|
# Performances:
|
|
# haswell igp: i5-4590 CPU @ 3.30GHz
|
|
# Output on aspect: full, 1080p, 16:9, 60fps
|
|
# All measurements made with aspect=full, so as long as ambient light is not used, the whole screen is filled by the shader.
|
|
# This means that all the measurements, but ambient light itself are likely higher than real use.
|
|
|
|
# input: mame, dynamite dux: 26/09/2022 27/10/2022 02/11/2022
|
|
# GPU% Delta% vs Basal:
|
|
# no shader: 11 -23.6 11 10 10
|
|
# basal: 34.6 0.0 31.5 29.5 27.7
|
|
# FXAA: 37.5 2.9 34.15 32.2
|
|
# scanlines: 36.5 1.9 32.3 31.5
|
|
# ...flickering: 36.2 1.6 32.4 32
|
|
#input glow gamma 3: 40 5.4 36.75 35.2
|
|
# rgb mask: 35.7 1.1 32.60 33.4 **
|
|
# slotmask: 36.5 1.9 33.6 32.1
|
|
# halo gamma 3: 40.0 5.4 36.9 35.5
|
|
# bloom(q2): 38 3.4 35.8 35 30.5
|
|
# color corrections: 35 0.4 31.6 29.5
|
|
# curvature warp: 39.2 4.6 33.5 34.1
|
|
# vignette+spot: 35.2 0.6 33.2 34
|
|
# ambient light: 38 3.4 32.1 33.6
|
|
# Bezel: 37.5 33.7
|
|
#-----------------------------------------------
|
|
#Total basal + all the features: 72.2 65.3 65.2 61.2 (bloom q1)
|
|
|
|
# Koko-aio shader is meant to be an all-in one crt shader.
|
|
# It can be configured with many parameters, so that can be
|
|
# scaled to run on even on modest gpus while still developed to
|
|
# run with heavier presets on at least Haswell+ iGpus.
|
|
# It is not meant to simulate the internal behaviour of CRT displays,
|
|
# but to give users the parameters to make their monitors to look similar.
|
|
# Several presets are included.
|
|
|
|
# Actually it provides emulation for:
|
|
# scanlines, screenlines, RGB vertical masks, horizontal slot masks,
|
|
# glowing, haloing, blooming, gamma and SATURATION correction,pixel_outi
|
|
# black frame insertions, interlace emulation, antialiasing.
|
|
|
|
# External code by:
|
|
# * CRT - Guest - Dr.Venom (single pass bloom function)
|
|
# * Nvidia (FXAA)
|
|
|
|
|
|
|
|
|
|
|
|
# Bezel texture contains the following infomations:
|
|
# - The red channel represents the luminance information
|
|
# - The green channel represents the highlights
|
|
# - The alpha channel in the inner frame represents the part of the bezel that will be filled by the game content
|
|
# - The blue channel represents the part of the bezel that will be filled by the game reflection.
|
|
|
|
textures = "monitor_body;bg_under;bg_over"
|
|
|
|
monitor_body = "textures/monitor_body.png"
|
|
monitor_body_linear = "true"
|
|
# Does this work?
|
|
monitor_body_wrap_mode = "clamp_to_edge"
|
|
monitor_body_mipmap = "true"
|
|
|
|
bg_under = "textures/background_under.png"
|
|
bg_under_linear = "true"
|
|
bg_under_wrap_mode = "mirrored_repeat"
|
|
bg_under_mipmap = "true"
|
|
|
|
bg_over = "textures/background_over.png"
|
|
bg_over_linear = "true"
|
|
bg_over_wrap_mode = "mirrored_repeat"
|
|
bg_over_mipmap = "true"
|
|
|
|
shaders = 17
|
|
# For P-uae defaults, doubling just y0 seems the best option.
|
|
# 90% of games are lowres in vertical size and p-uae defaults
|
|
# to 720 pixels width, which is enough for this preset to work as intended.
|
|
# Rest warned, that when a game sets an interlaced resolution, p-uae
|
|
# will output even 560 h-lines which, doubled, will result in
|
|
# 1120 h lines. too much even for a 1080p screen.
|
|
# Auto-Cropping/overscan emulation could be added in a future release.
|
|
# For other emulators/systems, probably it is best and safe to doulbe x0 too.
|
|
|
|
# In the first pass we draw an optional black border around the image for bezel purposes
|
|
# and scale the image to something better usable by FXAA
|
|
# Scaling y to 2x is needed by flickering scanlines pass.
|
|
|
|
shader0 = shaders/first_pass.slang
|
|
alias0 = "first_pass"
|
|
filter_linear0 = false
|
|
scale_type0 = source
|
|
scale_x0 = 2.0
|
|
scale_y0 = 2.0
|
|
wrap_mode0 = "mirrored_repeat"
|
|
float_framebuffer0 = false
|
|
|
|
# Nvidia fxaa pass:
|
|
# works good for "SD" resolutions
|
|
shader1 = shaders/fxaa.slang
|
|
alias1 = "FXAA_pass"
|
|
filter_linear1 = true
|
|
scale_type1 = source
|
|
scale1 = 1.0
|
|
|
|
# FXAA don't really need any mipmap, but avglum_pass several passes after it does.
|
|
# and for the weird way retroarch manages mipmaps, specify that FXAA_pass wants mipmaps
|
|
# makes first_pass mipmaps available to everyone.
|
|
# even if theoretically not needed, texture() occurrence in FXAA_pass needed to be switched
|
|
# to textureLod(..,0.0) or it acts weird, don't ask me why.
|
|
# yay.
|
|
|
|
mipmap_input1 = true
|
|
wrap_mode1 = "mirrored_repeat"
|
|
float_framebuffer1 = false
|
|
|
|
|
|
shader2 = shaders/shift_and_bleed.slang
|
|
alias2 = "shift_and_bleed_pass"
|
|
filter_linear2 = true
|
|
scale2 = 1.0
|
|
scale_type2 = source
|
|
float_framebuffer2 = false
|
|
mipmap_input2 = false
|
|
wrap_mode2 = "mirrored_repeat"
|
|
|
|
|
|
|
|
# Blur and glow the image as requested
|
|
# This pass aims to simulate the signal input power.
|
|
# Glowing will be used to weighting the scanlines.
|
|
# In this pass we also generate flickering scanlines by blindly blanking
|
|
# alternate lines at #frame interval
|
|
|
|
shader3 = shaders/in_glow.slang
|
|
alias3 = "in_glow_pass"
|
|
filter_linear3 = true
|
|
scale3 = 1.0
|
|
scale_type3 = source
|
|
float_framebuffer3 = true
|
|
wrap_mode3 = "mirrored_repeat"
|
|
|
|
|
|
# This essentially is the same as glowing by a code point of view.
|
|
# But this pass will be added later on instead of mixed
|
|
|
|
shader4 = shaders/halo.slang
|
|
alias4 = "halo_pass"
|
|
filter_linear4 = true
|
|
scale4 = 1.0
|
|
scale_type4 = source
|
|
float_framebuffer4 = true
|
|
mipmap_input4 = false
|
|
wrap_mode4 = "mirrored_repeat"
|
|
|
|
# Get the average luminance needed by ambilight here, because:
|
|
# * mipmap_input only works on "Source" texture
|
|
# * the following pass does not use the previous one
|
|
# * the previous pass represents scene changes.
|
|
|
|
# The rgb channels of the following pass contains luminance info
|
|
# Used by the bezel code to light up the bezel corners.
|
|
# The alpha channel contains the sum/3.0 of rgb channels
|
|
# used to detect scene changes.
|
|
|
|
shader5 = shaders/avglum_pass.slang
|
|
alias5 = "avglum_pass"
|
|
filter_linear5 = true
|
|
scale_type5 = source
|
|
scale5 = 0.5
|
|
wrap_mode5 = "mirrored_repeat"
|
|
mipmap_input5 = false
|
|
|
|
# The following 2 passes will blur the mirrored part of main pass
|
|
# to emulate bezel reflections.
|
|
|
|
shader6 = shaders/reflection_blur_h.slang
|
|
alias6 = "reflected_blurred_pass1"
|
|
filter_linear6 = true
|
|
scale_type6 = source
|
|
scale6 = 1.0
|
|
wrap_mode6 = "mirrored_repeat"
|
|
|
|
shader7 = shaders/reflection_blur_v.slang
|
|
alias7 = "reflected_blurred_pass2"
|
|
filter_linear7 = true
|
|
scale_type7 = source
|
|
scale7 = 1.0
|
|
wrap_mode7 = "mirrored_repeat"
|
|
|
|
|
|
# In the subsequent passes we do first a fast bloom by first
|
|
# sampling the original texture and scale it down to keep
|
|
# it fast, next we do subsequent blurd of the bloomed
|
|
# pass.
|
|
|
|
shader8 = shaders/bloom_pass_1.slang
|
|
alias8 = "bloom_pass_1"
|
|
filter_linear8 = true
|
|
scale_type8 = source
|
|
scale8 = 1.0
|
|
# I NEED TO SET **THIS** TO mirrored_repeat TO HAVE THE PREVIOUS PASS mirrored_repeated (!?)
|
|
wrap_mode8 = "mirrored_repeat"
|
|
float_framebuffer8 = true
|
|
|
|
|
|
shader9 = shaders/bloom_pass_2.slang
|
|
alias9 = "bloom_pass_2"
|
|
filter_linear9 = true
|
|
scale_type9 = source
|
|
scale9 = 0.5
|
|
wrap_mode9 = "clamp_to_edge"
|
|
|
|
|
|
shader10 = shaders/bloom_pass_3.slang
|
|
alias10 = "bloom_pass_3"
|
|
filter_linear10 = true
|
|
scale_type10 = source
|
|
scale10 = 1.0
|
|
wrap_mode10 = "clamp_to_edge"
|
|
|
|
|
|
shader11 = shaders/bloom_pass_4.slang
|
|
alias11 = "bloom_pass_final"
|
|
filter_linear11 = true
|
|
scale_type11 = source
|
|
scale11 = 1.0
|
|
wrap_mode11 = "mirrored_repeat"
|
|
|
|
|
|
# Back led lights:
|
|
# Since the next pass will need mipmaps of the original image, and is only possible to get mipmaps
|
|
from the very previous pass, the next one will just passthrough the original image
|
|
#
|
|
|
|
shader12 = shaders/ambi_push_pass.slang
|
|
alias12 = "ambi_push_pass"
|
|
# I NEED TO SET **THIS** TO true TO HAVE THE PREVIOUS PASS linearly filtered
|
|
filter_linear12 = true
|
|
scale_type12 = source
|
|
scale12 = 1.0
|
|
wrap_mode12 = "mirrored_repeat"
|
|
mipmap_input12 = false
|
|
float_framebuffer12 = true
|
|
|
|
# Gather mipmaps from prevous pass and use them to light virtual leds under the virtual monitor
|
|
shader13 = shaders/ambi_pre_pass.slang
|
|
alias13 = "ambi_pre_pass1"
|
|
filter_linear13 = true
|
|
scale_type13 = source
|
|
scale13 = 1.0
|
|
mipmap_input13 = true
|
|
wrap_mode13 = "clamp_to_border"
|
|
float_framebuffer13 = false
|
|
|
|
# Temporally smooth led lights.
|
|
shader14 = shaders/ambi_temporal_pass.slang
|
|
alias14 = "ambi_temporal_pass"
|
|
filter_linear14 = true
|
|
scale_type14 = source
|
|
float_framebuffer14 = true
|
|
|
|
|
|
# In this pass we gather information about the rotated state of the source
|
|
# This information can only be taken when a pass scales to viewport
|
|
# So use a low output resolution to keep things as light as possible.
|
|
# The feedback of this pass will be queried by previous ones.
|
|
# I tried to move this into final_pass, but the gpu consumption was higher.
|
|
|
|
shader15 = shaders/isrotated.slang
|
|
alias15 = "isrotated_pass"
|
|
filter_linear15 = true
|
|
scale15 = 0.1
|
|
scale_type15 = viewport
|
|
wrap_mode15 = "mirrored_repeat"
|
|
|
|
# In this pass we emulate scanlines, glowing,
|
|
# RGB vertical mask, slot mask,haloing and color corrections
|
|
|
|
# This pass pass will do the composition of the previous passes
|
|
# with the bloomed image, vignette and spot light, black frame insertions
|
|
# and Bezel emulation
|
|
|
|
shader16 = shaders/final_pass.slang
|
|
alias16 = "final_pass"
|
|
filter_linear16 = true
|
|
scale_type16 = viewport
|
|
scale16 = 1.0
|
|
wrap_mode16 = "mirrored_repeat"
|
|
|