1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

gSPNEON.cpp: merge gSPLightVertex_NEON and gSPLightVertex4_NEON

This commit is contained in:
gizmo98 2017-10-09 17:31:20 +02:00 committed by Sergey Lipskiy
parent 39d4b223c8
commit 7d22828193
2 changed files with 5 additions and 46 deletions

View File

@ -263,10 +263,10 @@ void DotProductMax4FullNeon( float v0[3], float v1[4][3], float _lights[4][3], f
); );
} }
void gSPLightVertex4_NEON(u32 v, SPVertex * spVtx) void gSPLightVertex_NEON(u32 vnum, u32 v, SPVertex * spVtx)
{ {
if (!config.generalEmulation.enableHWLighting) { if (!config.generalEmulation.enableHWLighting) {
for(int j = 0; j < 4; ++j) { for(int j = 0; j < vnum; ++j) {
SPVertex & vtx = spVtx[v + j]; SPVertex & vtx = spVtx[v + j];
vtx.r = gSP.lights.rgb[gSP.numLights][R]; vtx.r = gSP.lights.rgb[gSP.numLights][R];
vtx.g = gSP.lights.rgb[gSP.numLights][G]; vtx.g = gSP.lights.rgb[gSP.numLights][G];
@ -297,7 +297,7 @@ void gSPLightVertex4_NEON(u32 v, SPVertex * spVtx)
vtx.b = min(1.0f, vtx.b); vtx.b = min(1.0f, vtx.b);
} }
} else { } else {
for(int j = 0; j < 4; ++j) { for(int j = 0; j < vnum; ++j) {
SPVertex & vtx = spVtx[v + j]; SPVertex & vtx = spVtx[v + j];
vtx.HWLight = gSP.numLights; vtx.HWLight = gSP.numLights;
vtx.r = vtx.nx; vtx.r = vtx.nx;
@ -306,40 +306,3 @@ void gSPLightVertex4_NEON(u32 v, SPVertex * spVtx)
} }
} }
} }
void gSPLightVertex_NEON(SPVertex & _vtx)
{
if (config.generalEmulation.enableHWLighting == 0) {
_vtx.HWLight = 0;
_vtx.r = gSP.lights.rgb[gSP.numLights][R];
_vtx.g = gSP.lights.rgb[gSP.numLights][G];
_vtx.b = gSP.lights.rgb[gSP.numLights][B];
s32 count = gSP.numLights-1;
while (count >= 6) {
DotProductMax7FullNeon(&_vtx.nx,(float (*)[3])gSP.lights.i_xyz[gSP.numLights - count - 1],(float (*)[3])gSP.lights.rgb[gSP.numLights - count - 1],&_vtx.r);
count -= 7;
}
while (count >= 3) {
DotProductMax4FullNeon(&_vtx.nx,(float (*)[3])gSP.lights.i_xyz[gSP.numLights - count - 1],(float (*)[3])gSP.lights.rgb[gSP.numLights - count - 1],&_vtx.r);
count -= 4;
}
while (count >= 0)
{
f32 intensity = DotProduct( &_vtx.nx, gSP.lights.i_xyz[gSP.numLights - count - 1] );
if (intensity < 0.0f)
intensity = 0.0f;
_vtx.r += gSP.lights.rgb[gSP.numLights - count - 1][R] * intensity;
_vtx.g += gSP.lights.rgb[gSP.numLights - count - 1][G] * intensity;
_vtx.b += gSP.lights.rgb[gSP.numLights - count - 1][B] * intensity;
count -= 1;
}
_vtx.r = min(1.0f, _vtx.r);
_vtx.g = min(1.0f, _vtx.g);
_vtx.b = min(1.0f, _vtx.b);
} else {
_vtx.HWLight = gSP.numLights;
_vtx.r = _vtx.nx;
_vtx.g = _vtx.ny;
_vtx.b = _vtx.nz;
}
}

View File

@ -503,12 +503,8 @@ void gSPLightVertexStandard(u32 v, SPVertex * spVtx)
} }
} }
#else #else
void gSPLightVertex_NEON(SPVertex & _vtx); void gSPLightVertex_NEON(u32 vnum, u32 v, SPVertex * spVtx);
void gSPLightVertex4_NEON(u32 v, SPVertex * spVtx); gSPLightVertex_NEON(VNUM, v, spVtx);
if (VNUM == 1)
gSPLightVertex_NEON(spVtx[v]);
else
gSPLightVertex4_NEON(v, spVtx);
#endif #endif
} }