mirror of
https://github.com/libretro/ppsspp.git
synced 2025-01-27 11:41:49 +00:00
swrast warning fixes
This commit is contained in:
parent
d83a6e74a6
commit
9f3848b49c
@ -86,9 +86,9 @@ void Process(VertexData& vertex)
|
|||||||
|
|
||||||
// ambient lighting
|
// ambient lighting
|
||||||
Vec3<int> lac = Vec3<int>(gstate.getLightAmbientColorR(light), gstate.getLightAmbientColorG(light), gstate.getLightAmbientColorB(light));
|
Vec3<int> lac = Vec3<int>(gstate.getLightAmbientColorR(light), gstate.getLightAmbientColorG(light), gstate.getLightAmbientColorB(light));
|
||||||
final_color.r() += att * spot * lac.r() * mac.r() / 255;
|
final_color.r() += (int)(att * spot * lac.r() * mac.r() / 255);
|
||||||
final_color.g() += att * spot * lac.g() * mac.g() / 255;
|
final_color.g() += (int)(att * spot * lac.g() * mac.g() / 255);
|
||||||
final_color.b() += att * spot * lac.b() * mac.b() / 255;
|
final_color.b() += (int)(att * spot * lac.b() * mac.b() / 255);
|
||||||
|
|
||||||
// diffuse lighting
|
// diffuse lighting
|
||||||
Vec3<int> ldc = Vec3<int>(gstate.getDiffuseColorR(light), gstate.getDiffuseColorG(light), gstate.getDiffuseColorB(light));
|
Vec3<int> ldc = Vec3<int>(gstate.getDiffuseColorR(light), gstate.getDiffuseColorG(light), gstate.getDiffuseColorB(light));
|
||||||
@ -103,9 +103,9 @@ void Process(VertexData& vertex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (diffuse_factor > 0.f) {
|
if (diffuse_factor > 0.f) {
|
||||||
final_color.r() += att * spot * ldc.r() * mdc.r() * diffuse_factor / 255;
|
final_color.r() += (int)(att * spot * ldc.r() * mdc.r() * diffuse_factor / 255);
|
||||||
final_color.g() += att * spot * ldc.g() * mdc.g() * diffuse_factor / 255;
|
final_color.g() += (int)(att * spot * ldc.g() * mdc.g() * diffuse_factor / 255);
|
||||||
final_color.b() += att * spot * ldc.b() * mdc.b() * diffuse_factor / 255;
|
final_color.b() += (int)(att * spot * ldc.b() * mdc.b() * diffuse_factor / 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gstate.isUsingSpecularLight(light)) {
|
if (gstate.isUsingSpecularLight(light)) {
|
||||||
@ -124,9 +124,9 @@ void Process(VertexData& vertex)
|
|||||||
specular_factor = pow(specular_factor, k);
|
specular_factor = pow(specular_factor, k);
|
||||||
|
|
||||||
if (specular_factor > 0.f) {
|
if (specular_factor > 0.f) {
|
||||||
specular_color.r() += att * spot * lsc.r() * msc.r() * specular_factor / 255;
|
specular_color.r() += (int)(att * spot * lsc.r() * msc.r() * specular_factor / 255);
|
||||||
specular_color.g() += att * spot * lsc.g() * msc.g() * specular_factor / 255;
|
specular_color.g() += (int)(att * spot * lsc.g() * msc.g() * specular_factor / 255);
|
||||||
specular_color.b() += att * spot * lsc.b() * msc.b() * specular_factor / 255;
|
specular_color.b() += (int)(att * spot * lsc.b() * msc.b() * specular_factor / 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,8 +124,8 @@ static inline void GetTexelCoordinates(int level, float s, float t, unsigned int
|
|||||||
int width = 1 << (gstate.texsize[level] & 0xf);
|
int width = 1 << (gstate.texsize[level] & 0xf);
|
||||||
int height = 1 << ((gstate.texsize[level]>>8) & 0xf);
|
int height = 1 << ((gstate.texsize[level]>>8) & 0xf);
|
||||||
|
|
||||||
u = s * width; // TODO: width-1 instead?
|
u = (unsigned int)(s * width); // TODO: width-1 instead?
|
||||||
v = t * height; // TODO: width-1 instead?
|
v = (unsigned int)(t * height); // TODO: width-1 instead?
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void GetTextureCoordinates(const VertexData& v0, const VertexData& v1, const VertexData& v2, int w0, int w1, int w2, float& s, float& t)
|
static inline void GetTextureCoordinates(const VertexData& v0, const VertexData& v1, const VertexData& v2, int w0, int w1, int w2, float& s, float& t)
|
||||||
@ -361,6 +361,7 @@ static inline bool StencilTestPassed(u8 stencil)
|
|||||||
case GE_COMP_GEQUAL:
|
case GE_COMP_GEQUAL:
|
||||||
return (stencil >= ref);
|
return (stencil >= ref);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ApplyStencilOp(int op, int x, int y)
|
static inline void ApplyStencilOp(int op, int x, int y)
|
||||||
@ -467,6 +468,7 @@ static inline bool ColorTestPassed(Vec3<int> color)
|
|||||||
case GE_COMP_NOTEQUAL:
|
case GE_COMP_NOTEQUAL:
|
||||||
return (color.r() != ref.r() || color.g() != ref.g() || color.b() != ref.b());
|
return (color.r() != ref.r() || color.g() != ref.g() || color.b() != ref.b());
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool AlphaTestPassed(int alpha)
|
static inline bool AlphaTestPassed(int alpha)
|
||||||
@ -500,6 +502,7 @@ static inline bool AlphaTestPassed(int alpha)
|
|||||||
case GE_COMP_GEQUAL:
|
case GE_COMP_GEQUAL:
|
||||||
return (alpha >= ref);
|
return (alpha >= ref);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Vec3<int> GetSourceFactor(int source_a, const Vec4<int>& dst)
|
static inline Vec3<int> GetSourceFactor(int source_a, const Vec4<int>& dst)
|
||||||
@ -698,8 +701,8 @@ void DrawTriangle(const VertexData& v0, const VertexData& v1, const VertexData&
|
|||||||
unsigned int u = 0, v = 0;
|
unsigned int u = 0, v = 0;
|
||||||
if (gstate.isModeThrough()) {
|
if (gstate.isModeThrough()) {
|
||||||
// TODO: Is it really this simple?
|
// TODO: Is it really this simple?
|
||||||
u = (v0.texturecoords.s() * w0 + v1.texturecoords.s() * w1 + v2.texturecoords.s() * w2) / (w0+w1+w2);
|
u = (int)((v0.texturecoords.s() * w0 + v1.texturecoords.s() * w1 + v2.texturecoords.s() * w2) / (w0+w1+w2));
|
||||||
v = (v0.texturecoords.t() * w0 + v1.texturecoords.t() * w1 + v2.texturecoords.t() * w2) / (w0+w1+w2);
|
v = (int)((v0.texturecoords.t() * w0 + v1.texturecoords.t() * w1 + v2.texturecoords.t() * w2) / (w0+w1+w2));
|
||||||
} else {
|
} else {
|
||||||
float s = 0, t = 0;
|
float s = 0, t = 0;
|
||||||
GetTextureCoordinates(v0, v1, v2, w0, w1, w2, s, t);
|
GetTextureCoordinates(v0, v1, v2, w0, w1, w2, s, t);
|
||||||
|
@ -41,7 +41,7 @@ struct ScreenCoords
|
|||||||
|
|
||||||
ScreenCoords operator * (const float t) const
|
ScreenCoords operator * (const float t) const
|
||||||
{
|
{
|
||||||
return ScreenCoords(x * t, y * t, z * t);
|
return ScreenCoords((fixed16)(x * t), (fixed16)(y * t), (u16)(z * t));
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenCoords operator / (const int t) const
|
ScreenCoords operator / (const int t) const
|
||||||
@ -68,7 +68,7 @@ struct DrawingCoords
|
|||||||
|
|
||||||
DrawingCoords operator * (const float t) const
|
DrawingCoords operator * (const float t) const
|
||||||
{
|
{
|
||||||
return DrawingCoords(x * t, y * t, z * t);
|
return DrawingCoords((u10)(x * t), (u10)(y * t), (u16)(z * t));
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawingCoords operator + (const DrawingCoords& oth) const
|
DrawingCoords operator + (const DrawingCoords& oth) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user