diff --git a/plugins/zzogl-pg/opengl/NewRegs.cpp b/plugins/zzogl-pg/opengl/NewRegs.cpp index 880e68d37d..1e40623896 100644 --- a/plugins/zzogl-pg/opengl/NewRegs.cpp +++ b/plugins/zzogl-pg/opengl/NewRegs.cpp @@ -626,17 +626,12 @@ void __fastcall GIFRegHandlerSCANMSK(u32* data) { FUNCLOG GIFRegSCANMSK* r = (GIFRegSCANMSK*)(data); -// ZeroGS::FlushBoth(); -// ZeroGS::ResolveC(&ZeroGS::vb[0]); -// ZeroGS::ResolveZ(&ZeroGS::vb[0]); - // GSdx flushes here, like this: - /*if(r->SCANMSK != gs.smask) - { - //Flush - }*/ + if(r->MSK != gs.smask) { ZeroGS::FlushBoth(); +// ZeroGS::ResolveC(&ZeroGS::vb[0]); +// ZeroGS::ResolveZ(&ZeroGS::vb[0]); } gs.smask = r->MSK; @@ -710,38 +705,34 @@ void __fastcall GIFRegHandlerTEXA(u32* data) { FUNCLOG GIFRegTEXA* r = (GIFRegTEXA*)(data); - texaInfo newinfo; - /*if(r->TEXA != m_env.TEXA) - { - Flush(); - }*/ - newinfo.aem = r->AEM; - newinfo.ta[0] = r->TA0; - newinfo.ta[1] = r->TA1; - - if (*(u32*)&newinfo != *(u32*)&gs.texa) + if ((r->AEM != gs.texa.aem) || (r->TA0 != gs.texa.ta[0]) || (r->TA1 != gs.texa.ta[1])) { ZeroGS::FlushBoth(); - - *(u32*)&gs.texa = *(u32*) & newinfo; - - gs.texa.fta[0] = newinfo.ta[0] / 255.0f; - gs.texa.fta[1] = newinfo.ta[1] / 255.0f; ZeroGS::vb[0].bTexConstsSync = false; ZeroGS::vb[1].bTexConstsSync = false; } + + gs.texa.aem = r->AEM; + gs.texa.ta[0] = r->TA0; + gs.texa.ta[1] = r->TA1; + gs.texa.fta[0] = r->TA0 / 255.0f; + gs.texa.fta[1] = r->TA1 / 255.0f; } void __fastcall GIFRegHandlerFOGCOL(u32* data) { FUNCLOG - //GIFRegFOGCOL* r = (GIFRegFOGCOL*)(data); + GIFRegFOGCOL* r = (GIFRegFOGCOL*)(data); - // Yeah, it even flushes here. - // I'll worry about changing this later. - ZeroGS::SetFogColor(data[0]&0xffffff); + if (gs.fogcol != r->ai32[0]) + { + ZeroGS::FlushBoth(); + } + + ZeroGS::SetFogColor(r); + gs.fogcol = r->ai32[0]; } void __fastcall GIFRegHandlerTEXFLUSH(u32* data) diff --git a/plugins/zzogl-pg/opengl/zerogs.cpp b/plugins/zzogl-pg/opengl/zerogs.cpp index 78d5f6415e..3386d909cf 100644 --- a/plugins/zzogl-pg/opengl/zerogs.cpp +++ b/plugins/zzogl-pg/opengl/zerogs.cpp @@ -614,9 +614,6 @@ __forceinline void MOVFOG(VertexGPU *p, Vertex gsf) int Values[100] = {0, }; -#ifndef __LINUX__ -__forceinline -#endif void SET_VERTEX(VertexGPU *p, int Index, const VB& curvb) { int index = Index; @@ -789,9 +786,6 @@ void ZeroGS::KickTriangleFan() OUTPUT_VERT(p[2], 2); } -#ifndef __LINUX__ -__forceinline -#endif void SetKickVertex(VertexGPU *p, Vertex v, int next, const VB& curvb) { SET_VERTEX(p, next, curvb); @@ -886,6 +880,19 @@ void ZeroGS::SetFogColor(u32 fog) // } } +void ZeroGS::SetFogColor(GIFRegFOGCOL* fog) +{ + FUNCLOG + + SetShaderCaller("SetFogColor"); + Vector v; + + v.x = fog->FCR / 255.0f; + v.y = fog->FCG / 255.0f; + v.z = fog->FCB / 255.0f; + ZZcgSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor"); +} + void ZeroGS::ExtWrite() { FUNCLOG diff --git a/plugins/zzogl-pg/opengl/zerogs.h b/plugins/zzogl-pg/opengl/zerogs.h index e2e29e445c..38dbe761e0 100644 --- a/plugins/zzogl-pg/opengl/zerogs.h +++ b/plugins/zzogl-pg/opengl/zerogs.h @@ -492,6 +492,7 @@ void SetDestAlphaTest(); bool IsWriteDestAlphaTest(); void SetFogColor(u32 fog); +void SetFogColor(GIFRegFOGCOL* fog); void SaveTex(tex0Info* ptex, int usevid); char* NamedSaveTex(tex0Info* ptex, int usevid);