fix some errors identified by librashader scan (#636)

* fix min3/max3 problem

* fix min3/max3 problem

* delete broken/obsolete presets

* fix bad path in mega bezel preset
This commit is contained in:
hunterk 2024-09-16 20:28:13 -05:00 committed by GitHub
parent 630fe655fe
commit edd2dd3f77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 40 additions and 88 deletions

View File

@ -1,4 +1,4 @@
#reference "../../../Base_CRT_Presets/MBZ__3__STD__GDV.slangp" #reference "../Base_CRT_Presets/MBZ__3__STD__GDV.slangp"
HSM_ROTATE_CORE_IMAGE = 1 HSM_ROTATE_CORE_IMAGE = 1
HSM_ASPECT_RATIO_MODE = 2 HSM_ASPECT_RATIO_MODE = 2

View File

@ -1,16 +0,0 @@
shaders = 1
shader0 = shaders/LUT/LUT.slang
filter_linear0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
textures = SamplerLUT
SamplerLUT = shaders/LUT/GBA.png
SamplerLUT_linear = true
parameters = "LUT_Size"
LUT_Size = "32.000000"

View File

@ -1,16 +0,0 @@
shaders = 1
shader0 = shaders/LUT/LUT.slang
filter_linear0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
textures = SamplerLUT
SamplerLUT = shaders/LUT/NDS.png
SamplerLUT_linear = true
parameters = "LUT_Size"
LUT_Size = "32.000000"

View File

@ -1,16 +0,0 @@
shaders = 1
shader0 = shaders/LUT/LUT.slang
filter_linear0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
textures = SamplerLUT
SamplerLUT = shaders/LUT/VBA.png
SamplerLUT_linear = true
parameters = "LUT_Size"
LUT_Size = "32.000000"

View File

@ -55,10 +55,10 @@ layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor; layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source; layout(set = 0, binding = 2) uniform sampler2D Source;
float min3(vec4 a, vec4 b, vec4 c) { float min_3(vec4 a, vec4 b, vec4 c) {
return min(min(a.a, b.a), c.a); return min(min(a.a, b.a), c.a);
} }
float max3(vec4 a, vec4 b, vec4 c) { float max_3(vec4 a, vec4 b, vec4 c) {
return max(max(a.a, b.a), c.a); return max(max(a.a, b.a), c.a);
} }
@ -93,56 +93,56 @@ void main()
vec4 lightestColor = cc; vec4 lightestColor = cc;
//Kernel 0 and 4 //Kernel 0 and 4
float maxDark = max3(br, b, bl); float maxDark = max_3(br, b, bl);
float minLight = min3(tl, t, tr); float minLight = min_3(tl, t, tr);
if (minLight > cc.a && minLight > maxDark) { if (minLight > cc.a && minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, tl, t, tr); lightestColor = getLargest(cc, lightestColor, tl, t, tr);
} else { } else {
maxDark = max3(tl, t, tr); maxDark = max_3(tl, t, tr);
minLight = min3(br, b, bl); minLight = min_3(br, b, bl);
if (minLight > cc.a && minLight > maxDark) { if (minLight > cc.a && minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, br, b, bl); lightestColor = getLargest(cc, lightestColor, br, b, bl);
} }
} }
//Kernel 1 and 5 //Kernel 1 and 5
maxDark = max3(cc, l, b); maxDark = max_3(cc, l, b);
minLight = min3(r, t, tr); minLight = min_3(r, t, tr);
if (minLight > maxDark) { if (minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, r, t, tr); lightestColor = getLargest(cc, lightestColor, r, t, tr);
} else { } else {
maxDark = max3(cc, r, t); maxDark = max_3(cc, r, t);
minLight = min3(bl, l, b); minLight = min_3(bl, l, b);
if (minLight > maxDark) { if (minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, bl, l, b); lightestColor = getLargest(cc, lightestColor, bl, l, b);
} }
} }
//Kernel 2 and 6 //Kernel 2 and 6
maxDark = max3(l, tl, bl); maxDark = max_3(l, tl, bl);
minLight = min3(r, br, tr); minLight = min_3(r, br, tr);
if (minLight > cc.a && minLight > maxDark) { if (minLight > cc.a && minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, r, br, tr); lightestColor = getLargest(cc, lightestColor, r, br, tr);
} else { } else {
maxDark = max3(r, br, tr); maxDark = max_3(r, br, tr);
minLight = min3(l, tl, bl); minLight = min_3(l, tl, bl);
if (minLight > cc.a && minLight > maxDark) { if (minLight > cc.a && minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, l, tl, bl); lightestColor = getLargest(cc, lightestColor, l, tl, bl);
} }
} }
//Kernel 3 and 7 //Kernel 3 and 7
maxDark = max3(cc, l, t); maxDark = max_3(cc, l, t);
minLight = min3(r, br, b); minLight = min_3(r, br, b);
if (minLight > maxDark) { if (minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, r, br, b); lightestColor = getLargest(cc, lightestColor, r, br, b);
} else { } else {
maxDark = max3(cc, r, b); maxDark = max_3(cc, r, b);
minLight = min3(t, l, tl); minLight = min_3(t, l, tl);
if (minLight > maxDark) { if (minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, t, l, tl); lightestColor = getLargest(cc, lightestColor, t, l, tl);
} }
@ -150,4 +150,4 @@ void main()
FragColor = lightestColor; FragColor = lightestColor;
} }

View File

@ -57,10 +57,10 @@ layout(set = 0, binding = 2) uniform sampler2D Source;
//#define strength 0.7 //#define strength 0.7
float min3(vec4 a, vec4 b, vec4 c) { float min_3(vec4 a, vec4 b, vec4 c) {
return min(min(a.a, b.a), c.a); return min(min(a.a, b.a), c.a);
} }
float max3(vec4 a, vec4 b, vec4 c) { float max_3(vec4 a, vec4 b, vec4 c) {
return max(max(a.a, b.a), c.a); return max(max(a.a, b.a), c.a);
} }
@ -90,15 +90,15 @@ void main()
vec4 lightestColor = cc; vec4 lightestColor = cc;
//Kernel 0 and 4 //Kernel 0 and 4
float maxDark = max3(br, b, bl); float maxDark = max_3(br, b, bl);
float minLight = min3(tl, t, tr); float minLight = min_3(tl, t, tr);
if (minLight > cc.a && minLight > maxDark) { if (minLight > cc.a && minLight > maxDark) {
FragColor = getAverage(cc, tl, t, tr); FragColor = getAverage(cc, tl, t, tr);
return; return;
} else { } else {
maxDark = max3(tl, t, tr); maxDark = max_3(tl, t, tr);
minLight = min3(br, b, bl); minLight = min_3(br, b, bl);
if (minLight > cc.a && minLight > maxDark) { if (minLight > cc.a && minLight > maxDark) {
FragColor = getAverage(cc, br, b, bl); FragColor = getAverage(cc, br, b, bl);
return; return;
@ -106,15 +106,15 @@ void main()
} }
//Kernel 1 and 5 //Kernel 1 and 5
maxDark = max3(cc, l, b); maxDark = max_3(cc, l, b);
minLight = min3(r, t, tr); minLight = min_3(r, t, tr);
if (minLight > maxDark) { if (minLight > maxDark) {
FragColor = getAverage(cc, r, t, tr); FragColor = getAverage(cc, r, t, tr);
return; return;
} else { } else {
maxDark = max3(cc, r, t); maxDark = max_3(cc, r, t);
minLight = min3(bl, l, b); minLight = min_3(bl, l, b);
if (minLight > maxDark) { if (minLight > maxDark) {
FragColor = getAverage(cc, bl, l, b); FragColor = getAverage(cc, bl, l, b);
return; return;
@ -122,15 +122,15 @@ void main()
} }
//Kernel 2 and 6 //Kernel 2 and 6
maxDark = max3(l, tl, bl); maxDark = max_3(l, tl, bl);
minLight = min3(r, br, tr); minLight = min_3(r, br, tr);
if (minLight > cc.a && minLight > maxDark) { if (minLight > cc.a && minLight > maxDark) {
FragColor = getAverage(cc, r, br, tr); FragColor = getAverage(cc, r, br, tr);
return; return;
} else { } else {
maxDark = max3(r, br, tr); maxDark = max_3(r, br, tr);
minLight = min3(l, tl, bl); minLight = min_3(l, tl, bl);
if (minLight > cc.a && minLight > maxDark) { if (minLight > cc.a && minLight > maxDark) {
FragColor = getAverage(cc, l, tl, bl); FragColor = getAverage(cc, l, tl, bl);
return; return;
@ -138,15 +138,15 @@ void main()
} }
//Kernel 3 and 7 //Kernel 3 and 7
maxDark = max3(cc, l, t); maxDark = max_3(cc, l, t);
minLight = min3(r, br, b); minLight = min_3(r, br, b);
if (minLight > maxDark) { if (minLight > maxDark) {
FragColor = getAverage(cc, r, br, b); FragColor = getAverage(cc, r, br, b);
return; return;
} else { } else {
maxDark = max3(cc, r, b); maxDark = max_3(cc, r, b);
minLight = min3(t, l, tl); minLight = min_3(t, l, tl);
if (minLight > maxDark) { if (minLight > maxDark) {
FragColor = getAverage(cc, t, l, tl); FragColor = getAverage(cc, t, l, tl);
return; return;
@ -154,4 +154,4 @@ void main()
} }
FragColor = cc; FragColor = cc;
} }