diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index b26b811c4f..41afe17cc2 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -159,7 +159,7 @@ void TransformDrawEngine::ApplyDrawState(int prim) { int blendFuncA = gstate.getBlendFuncA(); int blendFuncB = gstate.getBlendFuncB(); - int blendFuncEq = gstate.getBlendEq(); + GEBlendMode blendFuncEq = gstate.getBlendEq(); if (blendFuncA > GE_SRCBLEND_FIXA) blendFuncA = GE_SRCBLEND_FIXA; if (blendFuncB > GE_DSTBLEND_FIXB) blendFuncB = GE_DSTBLEND_FIXB; @@ -225,6 +225,11 @@ void TransformDrawEngine::ApplyDrawState(int prim) { } else { glstate.blendFuncSeparate.set(glBlendFuncA, glBlendFuncB, glBlendFuncA, glBlendFuncB); } +#if !defined(USING_GLES2) + if (blendFuncEq == GE_BLENDMODE_ABSDIFF) { + WARN_LOG_REPORT_ONCE(blendAbsdiff, G3D, "Unsupported absdiff blend mode"); + } +#endif glstate.blendEquation.set(eqLookup[blendFuncEq]); } diff --git a/GPU/GPUState.h b/GPU/GPUState.h index 19c01600ae..7f8f3f00f2 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -233,7 +233,7 @@ struct GPUgstate u32 getFixA() const { return blendfixa & 0xFFFFFF; } u32 getFixB() const { return blendfixb & 0xFFFFFF; } GEBlendDstFactor getBlendFuncB() const { return (GEBlendDstFactor)((blend >> 4) & 0xF); } - int getBlendEq() const { return (blend >> 8) & 0x7; } + GEBlendMode getBlendEq() const { return static_cast((blend >> 8) & 0x7); } bool isAlphaBlendEnabled() const { return alphaBlendEnable & 1; } // AntiAlias @@ -309,6 +309,7 @@ struct GPUgstate bool isDirectionalLight(int chan) const { return getLightType(chan) == GE_LIGHTTYPE_DIRECTIONAL; } bool isPointLight(int chan) const { return getLightType(chan) == GE_LIGHTTYPE_POINT; } bool isSpotLight(int chan) const { return getLightType(chan) == GE_LIGHTTYPE_SPOT; } + GEShadeMode getShadeMode() const { return static_cast(shademodel & 1); } unsigned int getAmbientR() const { return ambientcolor&0xFF; } unsigned int getAmbientG() const { return (ambientcolor>>8)&0xFF; } unsigned int getAmbientB() const { return (ambientcolor>>16)&0xFF; } @@ -352,7 +353,7 @@ struct GPUgstate int getRegionX1() const { return region1 & 0x3FF; } int getRegionY1() const { return (region1 >> 10) & 0x3FF; } int getRegionX2() const { return (region2 & 0x3FF); } - int getRegionY2() const { return ((region2 >> 10) & 0x3FF); } + int getRegionY2() const { return (region2 >> 10) & 0x3FF; } float getViewportX1() const { return fabsf(getFloat24(viewportx1) * 2.0f); } float getViewportY1() const { return fabsf(getFloat24(viewporty1) * 2.0f); } diff --git a/GPU/Software/Rasterizer.cpp b/GPU/Software/Rasterizer.cpp index 038778c008..1685cef7f1 100644 --- a/GPU/Software/Rasterizer.cpp +++ b/GPU/Software/Rasterizer.cpp @@ -775,7 +775,7 @@ void DrawTriangle(const VertexData& v0, const VertexData& v1, const VertexData& Vec3 prim_color_rgb(0, 0, 0); int prim_color_a = 0; Vec3 sec_color(0, 0, 0); - if ((gstate.shademodel&1) == GE_SHADE_GOURAUD) { + if (gstate.getShadeMode() == GE_SHADE_GOURAUD) { // NOTE: When not casting color0 and color1 to float vectors, this code suffers from severe overflow issues. // Not sure if that should be regarded as a bug or if casting to float is a valid fix. // TODO: Is that the correct way to interpolate?