mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-04-10 19:15:14 +00:00
Fixed new 3D engine's fragment shader to work on some older GPUs by reducing the number of discard statements to one
This commit is contained in:
parent
4b184b05dc
commit
458684eb22
|
@ -58,6 +58,8 @@ static const char *fragmentShaderBasic =
|
||||||
"vec4 colData;\n"
|
"vec4 colData;\n"
|
||||||
"vec4 finalData;\n"
|
"vec4 finalData;\n"
|
||||||
|
|
||||||
|
"bool discardFragment = false;\n"
|
||||||
|
|
||||||
"tex1Data = vec4(1.0, 1.0, 1.0, 1.0);\n"
|
"tex1Data = vec4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
|
|
||||||
"if(textureEnabled==1) {\n"
|
"if(textureEnabled==1) {\n"
|
||||||
|
@ -71,7 +73,7 @@ static const char *fragmentShaderBasic =
|
||||||
|
|
||||||
"if (alphaTest==1) {\n" // does it make any sense to do this later?
|
"if (alphaTest==1) {\n" // does it make any sense to do this later?
|
||||||
"if (tex1Data.a < (8.0/16.0)) {\n"
|
"if (tex1Data.a < (8.0/16.0)) {\n"
|
||||||
"discard;\n"
|
"discardFragment = true;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
|
||||||
|
@ -84,12 +86,14 @@ static const char *fragmentShaderBasic =
|
||||||
|
|
||||||
"finalData = tex1Data * colData;\n"
|
"finalData = tex1Data * colData;\n"
|
||||||
"if (finalData.a < (1.0/16.0)) {\n" // basically chuck out any totally transparent pixels value = 1/16 the smallest transparency level h/w supports
|
"if (finalData.a < (1.0/16.0)) {\n" // basically chuck out any totally transparent pixels value = 1/16 the smallest transparency level h/w supports
|
||||||
|
"discardFragment = true;\n"
|
||||||
|
"}\n"
|
||||||
|
|
||||||
|
"if (discardFragment) {\n"
|
||||||
"discard;\n"
|
"discard;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
|
||||||
|
"if (lightEnable==1) {\n"
|
||||||
"if (lightEnable==1)\n"
|
|
||||||
"{\n"
|
|
||||||
"vec3 lightIntensity;\n"
|
"vec3 lightIntensity;\n"
|
||||||
"vec3 sunVector;\n" // sun lighting vector (as reflecting away from vertex)
|
"vec3 sunVector;\n" // sun lighting vector (as reflecting away from vertex)
|
||||||
"float sunFactor;\n" // sun light projection along vertex normal (0.0 to 1.0)
|
"float sunFactor;\n" // sun light projection along vertex normal (0.0 to 1.0)
|
||||||
|
|
Loading…
Reference in a new issue