mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
GPU: Correct powered diffuse with exp=0.
Just to ensure negative factors are handled too, as they are on hardware.
This commit is contained in:
parent
1cec9f5ea1
commit
6e46d6c0f9
4 changed files with 4 additions and 10 deletions
|
@ -586,7 +586,7 @@ void GenerateVertexShaderHLSL(const VShaderID &id, char *buffer, ShaderLanguage
|
|||
if (poweredDiffuse) {
|
||||
// pow(0.0, 0.0) may be undefined, but the PSP seems to treat it as 1.0.
|
||||
// Seen in Tales of the World: Radiant Mythology (#2424.)
|
||||
WRITE(p, " if (ldot == 0.0 && u_matspecular.a == 0.0) {\n");
|
||||
WRITE(p, " if (u_matspecular.a == 0.0) {\n");
|
||||
WRITE(p, " ldot = 1.0;\n");
|
||||
WRITE(p, " } else {\n");
|
||||
WRITE(p, " ldot = pow(ldot, u_matspecular.a);\n");
|
||||
|
|
|
@ -680,7 +680,7 @@ void GenerateVertexShader(const VShaderID &id, char *buffer, uint32_t *attrMask,
|
|||
if (poweredDiffuse) {
|
||||
// pow(0.0, 0.0) may be undefined, but the PSP seems to treat it as 1.0.
|
||||
// Seen in Tales of the World: Radiant Mythology (#2424.)
|
||||
WRITE(p, " if (ldot == 0.0 && u_matspecular.a == 0.0) {\n");
|
||||
WRITE(p, " if (u_matspecular.a == 0.0) {\n");
|
||||
WRITE(p, " ldot = 1.0;\n");
|
||||
WRITE(p, " } else {\n");
|
||||
WRITE(p, " ldot = pow(ldot, u_matspecular.a);\n");
|
||||
|
|
|
@ -110,13 +110,7 @@ void Process(VertexData& vertex, bool hasColor) {
|
|||
float diffuse_factor = Dot(L, vertex.worldnormal);
|
||||
if (gstate.isUsingPoweredDiffuseLight(light)) {
|
||||
float k = gstate.getMaterialSpecularCoef();
|
||||
// TODO: Validate Tales of the World: Radiant Mythology (#2424.)
|
||||
// pow(0.0, 0.0) may be undefined, but the PSP seems to treat it as 1.0.
|
||||
if (diffuse_factor <= 0.0f && k == 0.0f) {
|
||||
diffuse_factor = 1.0f;
|
||||
} else {
|
||||
diffuse_factor = pow(diffuse_factor, k);
|
||||
}
|
||||
diffuse_factor = pspLightPow(diffuse_factor, k);
|
||||
}
|
||||
|
||||
if (diffuse_factor > 0.f) {
|
||||
|
|
|
@ -469,7 +469,7 @@ bool GenerateVulkanGLSLVertexShader(const VShaderID &id, char *buffer) {
|
|||
if (poweredDiffuse) {
|
||||
// pow(0.0, 0.0) may be undefined, but the PSP seems to treat it as 1.0.
|
||||
// Seen in Tales of the World: Radiant Mythology (#2424.)
|
||||
WRITE(p, " if (dot%i == 0.0 && light.matspecular.a == 0.0) {\n", i);
|
||||
WRITE(p, " if (light.matspecular.a == 0.0) {\n");
|
||||
WRITE(p, " dot%i = 1.0;\n", i);
|
||||
WRITE(p, " } else {\n");
|
||||
WRITE(p, " dot%i = pow(dot%i, light.matspecular.a);\n", i, i);
|
||||
|
|
Loading…
Add table
Reference in a new issue