Merge pull request #244 from MajorPainTheCactus/megatron_2_7

V2.7 Sony Megatron Shader
This commit is contained in:
hizzlekizzle 2022-03-26 20:09:19 -05:00 committed by GitHub
commit 9520a6c10e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 124 additions and 49 deletions

View file

@ -0,0 +1,74 @@
shaders = "5"
feedback_pass = "0"
shader0 = "../ntsc/shaders/ntsc-adaptive/ntsc-pass1.slang"
scale_type0 = source
scale_x0 = 4.0
filter_linear0 = false
scale_y0 = 1.0
float_framebuffer0 = true
shader1 = "../ntsc/shaders/ntsc-adaptive/ntsc-pass2.slang"
scale_type1 = source
scale_x1 = 0.75
scale_y1 = 1.0
filter_linear1 = true
shader2 = "shaders/crt-sony-megatron-source-pass.slang"
filter_linear2 = "false"
scale_type2 = "source"
scale2 = "1.0"
wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false"
alias2 = "SourceSDR"
shader3 = "shaders/crt-sony-megatron-hdr-pass.slang"
filter_linear3 = "false"
scale_type3 = "source"
scale3 = "1.0"
wrap_mode3 = "clamp_to_border"
mipmap_input3 = "false"
alias3 = "SourceHDR"
shader4 = "shaders/crt-sony-megatron.slang"
filter_linear4 = "false"
wrap_mode4 = "clamp_to_border"
mipmap_input4 = "false"
alias4 = ""
float_framebuffer4 = "false"
srgb_framebuffer4 = "false"
hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "2.000000"
hcrt_crt_resolution = "0.000000"
hcrt_paper_white_nits = "700.000000"
hcrt_expand_gamut = "0.000000"
hcrt_white_temperature = "0.000000"
hcrt_gamma = "0.000000"
hcrt_red_vertical_convergence = "0.000000"
hcrt_green_vertical_convergence = "0.000000"
hcrt_blue_vertical_convergence = "0.000000"
hcrt_red_horizontal_convergence = "0.000000"
hcrt_green_horizontal_convergence = "0.000000"
hcrt_blue_horizontal_convergence = "-1.000000"
hcrt_red_scanline_min = "1.0000000"
hcrt_red_scanline_max = "1.100000"
hcrt_red_scanline_attack = "0.850000"
hcrt_red_scanline_end = "0.000000"
hcrt_green_scanline_min = "1.000000"
hcrt_green_scanline_max = "1.100000"
hcrt_green_scanline_attack = "0.850000"
hcrt_green_scanline_end = "0.000000"
hcrt_blue_scanline_min = "1.000000"
hcrt_blue_scanline_max = "1.100000"
hcrt_blue_scanline_attack = "0.850000"
hcrt_blue_scanline_end = "0.000000"
hcrt_red_beam_sharpness = "1.000000"
hcrt_red_beam_attack = "0.0000000"
hcrt_green_beam_sharpness = "1.000000"
hcrt_green_beam_attack = "0.000000"
hcrt_blue_beam_sharpness = "1.000000"
hcrt_blue_beam_attack = "0.000000"

View file

@ -81,41 +81,41 @@ layout(std140, set = 0, binding = 0) uniform UBO
#include "include/parameters.h" #include "include/parameters.h"
#define HCRT_HDR params.hcrt_hdr #define HCRT_HDR params.hcrt_hdr
#define HCRT_OUTPUT_COLOUR_SPACE params.hcrt_colour_space #define HCRT_OUTPUT_COLOUR_SPACE params.hcrt_colour_space
#define HCRT_MAX_NITS params.hcrt_max_nits #define HCRT_MAX_NITS params.hcrt_max_nits
#define HCRT_PAPER_WHITE_NITS params.hcrt_paper_white_nits #define HCRT_PAPER_WHITE_NITS params.hcrt_paper_white_nits
#define HCRT_EXPAND_GAMUT params.hcrt_expand_gamut #define HCRT_EXPAND_GAMUT params.hcrt_expand_gamut
#define HCRT_GAMMA params.hcrt_gamma #define HCRT_GAMMA params.hcrt_gamma
#define HCRT_LCD_RESOLUTION params.hcrt_lcd_resolution #define HCRT_LCD_RESOLUTION params.hcrt_lcd_resolution
#define HCRT_LCD_SUBPIXEL params.hcrt_lcd_subpixel #define HCRT_LCD_SUBPIXEL params.hcrt_lcd_subpixel
#define HCRT_RED_VERTICAL_CONVERGENCE params.hcrt_red_vertical_convergence #define HCRT_RED_VERTICAL_CONVERGENCE params.hcrt_red_vertical_convergence
#define HCRT_GREEN_VERTICAL_CONVERGENCE params.hcrt_green_vertical_convergence #define HCRT_GREEN_VERTICAL_CONVERGENCE params.hcrt_green_vertical_convergence
#define HCRT_BLUE_VERTICAL_CONVERGENCE params.hcrt_blue_vertical_convergence #define HCRT_BLUE_VERTICAL_CONVERGENCE params.hcrt_blue_vertical_convergence
#define HCRT_RED_HORIZONTAL_CONVERGENCE params.hcrt_red_horizontal_convergence #define HCRT_RED_HORIZONTAL_CONVERGENCE params.hcrt_red_horizontal_convergence
#define HCRT_GREEN_HORIZONTAL_CONVERGENCE params.hcrt_green_horizontal_convergence #define HCRT_GREEN_HORIZONTAL_CONVERGENCE params.hcrt_green_horizontal_convergence
#define HCRT_BLUE_HORIZONTAL_CONVERGENCE params.hcrt_blue_horizontal_convergence #define HCRT_BLUE_HORIZONTAL_CONVERGENCE params.hcrt_blue_horizontal_convergence
#define HCRT_CRT_SCREEN_TYPE params.hcrt_crt_screen_type #define HCRT_CRT_SCREEN_TYPE params.hcrt_crt_screen_type
#define HCRT_CRT_RESOLUTION params.hcrt_crt_resolution #define HCRT_CRT_RESOLUTION params.hcrt_crt_resolution
#define HCRT_RED_SCANLINE_MIN params.hcrt_red_scanline_min #define HCRT_RED_SCANLINE_MIN params.hcrt_red_scanline_min
#define HCRT_RED_SCANLINE_MAX params.hcrt_red_scanline_max #define HCRT_RED_SCANLINE_MAX params.hcrt_red_scanline_max
#define HCRT_RED_SCANLINE_ATTACK params.hcrt_red_scanline_attack #define HCRT_RED_SCANLINE_ATTACK params.hcrt_red_scanline_attack
#define HCRT_GREEN_SCANLINE_MIN params.hcrt_green_scanline_min #define HCRT_GREEN_SCANLINE_MIN params.hcrt_green_scanline_min
#define HCRT_GREEN_SCANLINE_MAX params.hcrt_green_scanline_max #define HCRT_GREEN_SCANLINE_MAX params.hcrt_green_scanline_max
#define HCRT_GREEN_SCANLINE_ATTACK params.hcrt_green_scanline_attack #define HCRT_GREEN_SCANLINE_ATTACK params.hcrt_green_scanline_attack
#define HCRT_BLUE_SCANLINE_MIN params.hcrt_blue_scanline_min #define HCRT_BLUE_SCANLINE_MIN params.hcrt_blue_scanline_min
#define HCRT_BLUE_SCANLINE_MAX params.hcrt_blue_scanline_max #define HCRT_BLUE_SCANLINE_MAX params.hcrt_blue_scanline_max
#define HCRT_BLUE_SCANLINE_ATTACK params.hcrt_blue_scanline_attack #define HCRT_BLUE_SCANLINE_ATTACK params.hcrt_blue_scanline_attack
#define HCRT_RED_BEAM_SHARPNESS params.hcrt_red_beam_sharpness #define HCRT_RED_BEAM_SHARPNESS params.hcrt_red_beam_sharpness
#define HCRT_RED_BEAM_ATTACK params.hcrt_red_beam_attack #define HCRT_RED_BEAM_ATTACK params.hcrt_red_beam_attack
#define HCRT_GREEN_BEAM_SHARPNESS params.hcrt_green_beam_sharpness #define HCRT_GREEN_BEAM_SHARPNESS params.hcrt_green_beam_sharpness
#define HCRT_GREEN_BEAM_ATTACK params.hcrt_green_beam_attack #define HCRT_GREEN_BEAM_ATTACK params.hcrt_green_beam_attack
#define HCRT_BLUE_BEAM_SHARPNESS params.hcrt_blue_beam_sharpness #define HCRT_BLUE_BEAM_SHARPNESS params.hcrt_blue_beam_sharpness
#define HCRT_BLUE_BEAM_ATTACK params.hcrt_blue_beam_attack #define HCRT_BLUE_BEAM_ATTACK params.hcrt_blue_beam_attack
#define COMPAT_TEXTURE(c, d) texture(c, d) #define COMPAT_TEXTURE(c, d) texture(c, d)
@ -286,7 +286,7 @@ const uint kShadowMasks[kResolutionAxis][kTVLAxis][kBGRAxis][kMaxShadowMaskSizeY
#define kMaxSlotMaskSize 8 #define kMaxSlotMaskSize 8
#define kMaxSlotSizeX 2 #define kMaxSlotSizeX 2
#define kMaxSlotSizeY 4 #define kMaxSlotSizeY 6
#define kXXXX { kBlack, kBlack, kBlack, kBlack, kBlack, kBlack, kBlack, kBlack } #define kXXXX { kBlack, kBlack, kBlack, kBlack, kBlack, kBlack, kBlack, kBlack }
@ -305,33 +305,34 @@ const uint kShadowMasks[kResolutionAxis][kTVLAxis][kBGRAxis][kMaxShadowMaskSizeY
#define kRRGGBBX { kRed, kRed, kGreen, kGreen, kBlue, kBlue, kBlack, kBlack } #define kRRGGBBX { kRed, kRed, kGreen, kGreen, kBlue, kBlue, kBlack, kBlack }
#define kBBGGRRX { kBlue, kBlue, kGreen, kGreen, kRed, kRed, kBlack, kBlack } #define kBBGGRRX { kBlue, kBlue, kGreen, kGreen, kRed, kRed, kBlack, kBlack }
#define kMGMG_MGXX_MGMG_XXMG { { kMG, kMG }, { kMG, kXXXX }, { kMG, kMG }, { kXXXX, kMG } } #define kMGMG_MGXX_MGMG_XXMG { { kMG, kMG }, { kMG, kXXXX }, { kMG, kMG }, { kXXXX, kMG }, { kXXXX, kXXXX }, { kXXXX, kXXXX } }
#define kGMGM_GMXX_GMGM_XXGM { { kGM, kGM }, { kGM, kXXXX }, { kGM, kGM }, { kXXXX, kGM } } #define kGMGM_GMXX_GMGM_XXGM { { kGM, kGM }, { kGM, kXXXX }, { kGM, kGM }, { kXXXX, kGM }, { kXXXX, kXXXX }, { kXXXX, kXXXX } }
#define kBGRBGR_BGRXXX_BGRBGR_XXXBGR { { kBGR, kBGR }, { kBGR, kXXXX }, { kBGR, kBGR }, { kXXXX, kBGR } } #define kBGRBGR_BGRXXX_BGRBGR_XXXBGR { { kBGR, kBGR }, { kBGR, kXXXX }, { kBGR, kBGR }, { kXXXX, kBGR }, { kXXXX, kXXXX }, { kXXXX, kXXXX } }
#define kRGBRGB_RGBXXX_RGBRGB_XXXRGB { { kRGB, kRGB }, { kRGB, kXXXX }, { kRGB, kRGB }, { kXXXX, kRGB } } #define kRGBRGB_RGBXXX_RGBRGB_XXXRGB { { kRGB, kRGB }, { kRGB, kXXXX }, { kRGB, kRGB }, { kXXXX, kRGB }, { kXXXX, kXXXX }, { kXXXX, kXXXX } }
#define kRGBXRGBX_RGBXXXXX_RGBXRGBX_XXXXRGBX { { kRGBX, kRGBX }, { kRGBX, kXXXX }, { kRGBX, kRGBX }, { kXXXX, kRGBX } } #define kRGBXRGBX_RGBXXXXX_RGBXRGBX_XXXXRGBX { { kRGBX, kRGBX }, { kRGBX, kXXXX }, { kRGBX, kRGBX }, { kXXXX, kRGBX }, { kXXXX, kXXXX }, { kXXXX, kXXXX } }
#define kBGRXBGRX_BGRXXXXX_BGRXBGRX_XXXXBGRX { { kBGRX, kBGRX }, { kBGRX, kXXXX }, { kBGRX, kBGRX }, { kXXXX, kBGRX } } #define kBGRXBGRX_BGRXXXXX_BGRXBGRX_XXXXBGRX { { kBGRX, kBGRX }, { kBGRX, kXXXX }, { kBGRX, kBGRX }, { kXXXX, kBGRX }, { kXXXX, kXXXX }, { kXXXX, kXXXX } }
#define kRYCBXRYCBX_RYCBXXXXX_RYCBXRYCBX_XXXXRYCBX { { kRYCBX, kRYCBX }, { kRYCBX, kXXXX }, { kRYCBX, kRYCBX }, { kXXXX, kRYCBX } } #define kRYCBXRYCBX_RYCBXXXXX_RYCBXRYCBX_XXXXRYCBX { { kRYCBX, kRYCBX }, { kRYCBX, kXXXX }, { kRYCBX, kRYCBX }, { kXXXX, kRYCBX }, { kXXXX, kXXXX }, { kXXXX, kXXXX } }
#define kBCYRXBCYRX_BCYRXXXXX_BCYRXBCYRX_XXXXBCYRX { { kBCYRX, kBCYRX }, { kBCYRX, kXXXX }, { kBCYRX, kBCYRX }, { kXXXX, kBCYRX } } #define kBCYRXBCYRX_BCYRXXXXX_BCYRXBCYRX_XXXXBCYRX { { kBCYRX, kBCYRX }, { kBCYRX, kXXXX }, { kBCYRX, kBCYRX }, { kXXXX, kBCYRX }, { kXXXX, kXXXX }, { kXXXX, kXXXX } }
#define kRRGGBBXRRGGBBX_RRGGBBXXXXX_RRGGBBXRRGGBBX_XXXXRRGGBBX { { kRRGGBBX, kRRGGBBX }, { kRRGGBBX, kXXXX }, { kRRGGBBX, kRRGGBBX }, { kXXXX, kRRGGBBX } } #define kRRGGBBXRRGGBBX_RRGGBBXRRGGBBX_RRGGBBXXXXX_RRGGBBXRRGGBBX_RRGGBBXRRGGBBX_XXXXRRGGBBX { { kRRGGBBX, kRRGGBBX }, { kRRGGBBX, kRRGGBBX }, { kRRGGBBX, kXXXX }, { kRRGGBBX, kRRGGBBX }, { kRRGGBBX, kRRGGBBX }, { kXXXX, kRRGGBBX } }
#define kBBGGRRXBBGGRRX_BBGGRRXXXXX_BBGGRRXBBGGRRX_XXXXBBGGRRX { { kBBGGRRX, kBBGGRRX }, { kBBGGRRX, kXXXX }, { kBBGGRRX, kBBGGRRX }, { kXXXX, kBBGGRRX } } #define kBBGGRRXBBGGRRX_BBGGRRXBBGGRRX_BBGGRRXXXXX_BBGGRRXBBGGRRX_BBGGRRXBBGGRRX_XXXXBBGGRRX { { kBBGGRRX, kBBGGRRX }, { kBBGGRRX, kBBGGRRX }, { kBBGGRRX, kXXXX }, { kBBGGRRX, kBBGGRRX }, { kBBGGRRX, kBBGGRRX }, { kXXXX, kBBGGRRX } }
const float kSlotMaskSize[kResolutionAxis][kTVLAxis] = { { 7.0f, 4.0f, 3.0f, 2.0f }, { 7.0f, 7.0f, 5.0f, 4.0f } }; //4K: 300 TVL, 600 TVL, 800 TVL, 1000 TVL 8K: 300 TVL, 600 TVL, 800 TVL, 1000 TVL const float kSlotMaskSizeX[kResolutionAxis][kTVLAxis] = { { 7.0f, 4.0f, 3.0f, 2.0f }, { 7.0f, 7.0f, 5.0f, 4.0f } }; //4K: 300 TVL, 600 TVL, 800 TVL, 1000 TVL 8K: 300 TVL, 600 TVL, 800 TVL, 1000 TVL
const float kSlotMaskSizeY[kResolutionAxis][kTVLAxis] = { { 6.0f, 4.0f, 4.0f, 4.0f }, { 6.0f, 6.0f, 4.0f, 4.0f } }; //4K: 300 TVL, 600 TVL, 800 TVL, 1000 TVL 8K: 300 TVL, 600 TVL, 800 TVL, 1000 TVL
const uint kSlotMasks[kResolutionAxis][kTVLAxis][kBGRAxis][kMaxSlotSizeY][kMaxSlotSizeX][kMaxSlotMaskSize] = { const uint kSlotMasks[kResolutionAxis][kTVLAxis][kBGRAxis][kMaxSlotSizeY][kMaxSlotSizeX][kMaxSlotMaskSize] = {
{ // 4K { // 4K
{ kRRGGBB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XRRGGBBX_RRGGBBXXXXX_RRGGBBXRRGGBBX_XXXXRRGGBBX, kBBGGRRXBBGGRRX_BBGGRRXXXXX_BBGGRRXBBGGRRX_XXXXBBGGRRX }, // 600 TVL { kRRGGBBXRRGGBBX_RRGGBBXRRGGBBX_RRGGBBXXXXX_RRGGBBXRRGGBBX_RRGGBBXRRGGBBX_XXXXRRGGBBX, kBBGGRRXBBGGRRX_BBGGRRXBBGGRRX_BBGGRRXXXXX_BBGGRRXBBGGRRX_BBGGRRXBBGGRRX_XXXXBBGGRRX }, // 600 TVL
{ kRYCBXRYCBX_RYCBXXXXX_RYCBXRYCBX_XXXXRYCBX, kBCYRXBCYRX_BCYRXXXXX_BCYRXBCYRX_XXXXBCYRX }, // 800 TVL { kRYCBXRYCBX_RYCBXXXXX_RYCBXRYCBX_XXXXRYCBX, kBCYRXBCYRX_BCYRXXXXX_BCYRXBCYRX_XXXXBCYRX }, // 800 TVL
{ kRGBXRGBX_RGBXXXXX_RGBXRGBX_XXXXRGBX, kBGRXBGRX_BGRXXXXX_BGRXBGRX_XXXXBGRX } // 1000 TVL { kRGBXRGBX_RGBXXXXX_RGBXRGBX_XXXXRGBX, kBGRXBGRX_BGRXXXXX_BGRXBGRX_XXXXBGRX } // 1000 TVL
} }
@ -464,10 +465,10 @@ void main()
} }
case kSlotMask: case kSlotMask:
{ {
uint slot_x = uint(floor(mod(current_position.x / kSlotMaskSize[lcd_resolution][crt_resolution], kMaxSlotSizeX))); uint slot_x = uint(floor(mod(current_position.x / kSlotMaskSizeX[lcd_resolution][crt_resolution], kMaxSlotSizeX)));
uint slot_y = uint(floor(mod(current_position.y, kMaxSlotSizeY))); uint slot_y = uint(floor(mod(current_position.y, kSlotMaskSizeY[lcd_resolution][crt_resolution])));
uint mask = uint(floor(mod(current_position.x, kSlotMaskSize[lcd_resolution][crt_resolution]))); uint mask = uint(floor(mod(current_position.x, kSlotMaskSizeX[lcd_resolution][crt_resolution])));
colour_mask = kSlotMasks[lcd_resolution][crt_resolution][lcd_subpixel_layout][slot_x][slot_y][mask]; colour_mask = kSlotMasks[lcd_resolution][crt_resolution][lcd_subpixel_layout][slot_x][slot_y][mask];