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_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(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);
}
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);
}
@ -93,56 +93,56 @@ void main()
vec4 lightestColor = cc;
//Kernel 0 and 4
float maxDark = max3(br, b, bl);
float minLight = min3(tl, t, tr);
float maxDark = max_3(br, b, bl);
float minLight = min_3(tl, t, tr);
if (minLight > cc.a && minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, tl, t, tr);
} else {
maxDark = max3(tl, t, tr);
minLight = min3(br, b, bl);
maxDark = max_3(tl, t, tr);
minLight = min_3(br, b, bl);
if (minLight > cc.a && minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, br, b, bl);
}
}
//Kernel 1 and 5
maxDark = max3(cc, l, b);
minLight = min3(r, t, tr);
maxDark = max_3(cc, l, b);
minLight = min_3(r, t, tr);
if (minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, r, t, tr);
} else {
maxDark = max3(cc, r, t);
minLight = min3(bl, l, b);
maxDark = max_3(cc, r, t);
minLight = min_3(bl, l, b);
if (minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, bl, l, b);
}
}
//Kernel 2 and 6
maxDark = max3(l, tl, bl);
minLight = min3(r, br, tr);
maxDark = max_3(l, tl, bl);
minLight = min_3(r, br, tr);
if (minLight > cc.a && minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, r, br, tr);
} else {
maxDark = max3(r, br, tr);
minLight = min3(l, tl, bl);
maxDark = max_3(r, br, tr);
minLight = min_3(l, tl, bl);
if (minLight > cc.a && minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, l, tl, bl);
}
}
//Kernel 3 and 7
maxDark = max3(cc, l, t);
minLight = min3(r, br, b);
maxDark = max_3(cc, l, t);
minLight = min_3(r, br, b);
if (minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, r, br, b);
} else {
maxDark = max3(cc, r, b);
minLight = min3(t, l, tl);
maxDark = max_3(cc, r, b);
minLight = min_3(t, l, tl);
if (minLight > maxDark) {
lightestColor = getLargest(cc, lightestColor, t, l, tl);
}

View File

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