mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
GPU: Skip specular on powered diffuse.
Matches hardware tests and improves lighting for Virtua Tennis, see #4140.
This commit is contained in:
parent
c944063d03
commit
9a4cd5bd9d
@ -159,7 +159,7 @@ void GenerateVertexShaderHLSL(const VShaderID &id, char *buffer, ShaderLanguage
|
||||
WRITE(p, "float3 u_lightambient%i : register(c%i);\n", i, CONST_VS_LIGHTAMBIENT + i);
|
||||
WRITE(p, "float3 u_lightdiffuse%i : register(c%i);\n", i, CONST_VS_LIGHTDIFFUSE + i);
|
||||
|
||||
if (comp != GE_LIGHTCOMP_ONLYDIFFUSE) {
|
||||
if (comp == GE_LIGHTCOMP_BOTH) {
|
||||
WRITE(p, "float3 u_lightspecular%i : register(c%i);\n", i, CONST_VS_LIGHTSPECULAR + i);
|
||||
}
|
||||
}
|
||||
@ -536,7 +536,7 @@ void GenerateVertexShaderHLSL(const VShaderID &id, char *buffer, ShaderLanguage
|
||||
if (doLight[i] != LIGHT_FULL)
|
||||
continue;
|
||||
diffuseIsZero = false;
|
||||
if (comp != GE_LIGHTCOMP_ONLYDIFFUSE)
|
||||
if (comp == GE_LIGHTCOMP_BOTH)
|
||||
specularIsZero = false;
|
||||
if (type != GE_LIGHTTYPE_DIRECTIONAL)
|
||||
distanceNeeded = true;
|
||||
@ -579,8 +579,8 @@ void GenerateVertexShaderHLSL(const VShaderID &id, char *buffer, ShaderLanguage
|
||||
WRITE(p, " toLight /= distance;\n");
|
||||
}
|
||||
|
||||
bool doSpecular = comp != GE_LIGHTCOMP_ONLYDIFFUSE;
|
||||
bool poweredDiffuse = comp == GE_LIGHTCOMP_BOTHWITHPOWDIFFUSE;
|
||||
bool doSpecular = comp == GE_LIGHTCOMP_BOTH;
|
||||
bool poweredDiffuse = comp == GE_LIGHTCOMP_ONLYPOWDIFFUSE;
|
||||
|
||||
WRITE(p, " ldot = max(dot(toLight, worldnormal), 0.0);\n");
|
||||
if (poweredDiffuse) {
|
||||
|
@ -308,7 +308,7 @@ void GenerateVertexShader(const VShaderID &id, char *buffer, uint32_t *attrMask,
|
||||
WRITE(p, "uniform lowp vec3 u_lightambient%i;\n", i);
|
||||
WRITE(p, "uniform lowp vec3 u_lightdiffuse%i;\n", i);
|
||||
|
||||
if (comp != GE_LIGHTCOMP_ONLYDIFFUSE) {
|
||||
if (comp == GE_LIGHTCOMP_BOTH) {
|
||||
WRITE(p, "uniform lowp vec3 u_lightspecular%i;\n", i);
|
||||
}
|
||||
}
|
||||
@ -630,7 +630,7 @@ void GenerateVertexShader(const VShaderID &id, char *buffer, uint32_t *attrMask,
|
||||
if (doLight[i] != LIGHT_FULL)
|
||||
continue;
|
||||
diffuseIsZero = false;
|
||||
if (comp != GE_LIGHTCOMP_ONLYDIFFUSE)
|
||||
if (comp == GE_LIGHTCOMP_BOTH)
|
||||
specularIsZero = false;
|
||||
if (type != GE_LIGHTTYPE_DIRECTIONAL)
|
||||
distanceNeeded = true;
|
||||
@ -673,8 +673,8 @@ void GenerateVertexShader(const VShaderID &id, char *buffer, uint32_t *attrMask,
|
||||
WRITE(p, " toLight /= distance;\n");
|
||||
}
|
||||
|
||||
bool doSpecular = comp != GE_LIGHTCOMP_ONLYDIFFUSE;
|
||||
bool poweredDiffuse = comp == GE_LIGHTCOMP_BOTHWITHPOWDIFFUSE;
|
||||
bool doSpecular = comp == GE_LIGHTCOMP_BOTH;
|
||||
bool poweredDiffuse = comp == GE_LIGHTCOMP_ONLYPOWDIFFUSE;
|
||||
|
||||
WRITE(p, " ldot = max(dot(toLight, worldnormal), 0.0);\n");
|
||||
if (poweredDiffuse) {
|
||||
|
@ -326,8 +326,8 @@ struct GPUgstate {
|
||||
bool isLightingEnabled() const { return lightingEnable & 1; }
|
||||
bool isLightChanEnabled(int chan) const { return lightEnable[chan] & 1; }
|
||||
GELightComputation getLightComputation(int chan) const { return static_cast<GELightComputation>(ltype[chan] & 0x3); }
|
||||
bool isUsingPoweredDiffuseLight(int chan) const { return getLightComputation(chan) == GE_LIGHTCOMP_BOTHWITHPOWDIFFUSE; }
|
||||
bool isUsingSpecularLight(int chan) const { return getLightComputation(chan) != GE_LIGHTCOMP_ONLYDIFFUSE; }
|
||||
bool isUsingPoweredDiffuseLight(int chan) const { return getLightComputation(chan) == GE_LIGHTCOMP_ONLYPOWDIFFUSE; }
|
||||
bool isUsingSpecularLight(int chan) const { return getLightComputation(chan) == GE_LIGHTCOMP_BOTH; }
|
||||
bool isUsingSecondaryColor() const { return lmode & 1; }
|
||||
GELightType getLightType(int chan) const { return static_cast<GELightType>((ltype[chan] >> 8) & 3); }
|
||||
bool isDirectionalLight(int chan) const { return getLightType(chan) == GE_LIGHTTYPE_DIRECTIONAL; }
|
||||
|
@ -425,7 +425,7 @@ bool GenerateVulkanGLSLVertexShader(const VShaderID &id, char *buffer) {
|
||||
if (doLight[i] != LIGHT_FULL)
|
||||
continue;
|
||||
diffuseIsZero = false;
|
||||
if (comp != GE_LIGHTCOMP_ONLYDIFFUSE)
|
||||
if (comp == GE_LIGHTCOMP_BOTH)
|
||||
specularIsZero = false;
|
||||
if (type != GE_LIGHTTYPE_DIRECTIONAL)
|
||||
distanceNeeded = true;
|
||||
@ -462,8 +462,8 @@ bool GenerateVulkanGLSLVertexShader(const VShaderID &id, char *buffer) {
|
||||
WRITE(p, " toLight /= distance;\n");
|
||||
}
|
||||
|
||||
bool doSpecular = comp != GE_LIGHTCOMP_ONLYDIFFUSE;
|
||||
bool poweredDiffuse = comp == GE_LIGHTCOMP_BOTHWITHPOWDIFFUSE;
|
||||
bool doSpecular = comp == GE_LIGHTCOMP_BOTH;
|
||||
bool poweredDiffuse = comp == GE_LIGHTCOMP_ONLYPOWDIFFUSE;
|
||||
|
||||
WRITE(p, " mediump float dot%i = max(dot(toLight, worldnormal), 0.0);\n", i);
|
||||
if (poweredDiffuse) {
|
||||
|
@ -395,7 +395,7 @@ enum GELightComputation
|
||||
{
|
||||
GE_LIGHTCOMP_ONLYDIFFUSE = 0,
|
||||
GE_LIGHTCOMP_BOTH = 1,
|
||||
GE_LIGHTCOMP_BOTHWITHPOWDIFFUSE = 2,
|
||||
GE_LIGHTCOMP_ONLYPOWDIFFUSE = 2,
|
||||
};
|
||||
|
||||
enum GETextureFormat
|
||||
|
Loading…
Reference in New Issue
Block a user