* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
***************************************************************************/
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
***************************************************************************/
///////////////////////////////////////////////////////////////////////////////
// Inner loop driver instantiation file
///////////////////////////////////////////////////////////////////////////////
// Inner loop driver instantiation file
#define gpuLightingRGB gpuLightingRGBARM
#define gpuLightingTXT gpuLightingTXTARM
#define gpuLightingTXTGouraud gpuLightingTXTGouraudARM
#define gpuLightingRGB gpuLightingRGBARM
#define gpuLightingTXT gpuLightingTXTARM
#define gpuLightingTXTGouraud gpuLightingTXTGouraudARM
#define gpuLightingRGB gpuLightingRGBGeneric
#define gpuLightingTXT gpuLightingTXTGeneric
#define gpuLightingTXTGouraud gpuLightingTXTGouraudGeneric
#define gpuLightingRGB gpuLightingRGBGeneric
#define gpuLightingTXT gpuLightingTXTGeneric
#define gpuLightingTXTGouraud gpuLightingTXTGouraudGeneric
if (CF_MASKCHECK) { if (uDst & 0x8000) goto endpixel; }
col = gpuGouraudColor15bpp(r, g, b);
if (CF_MASKCHECK) { if (uDst & 0x8000) goto endpixel; }
col = gpuGouraudColor15bpp(r, g, b);
// Blend func can save an operation if it knows uSrc MSB is
// unset. For untextured prims, this is always true.
// Blend func can save an operation if it knows uSrc MSB is
// unset. For untextured prims, this is always true.
// unset. For untextured prims, this is always true.
const bool skip_uSrc_mask = true;
// unset. For untextured prims, this is always true.
const bool skip_uSrc_mask = true;
{
// Blend func can save an operation if it knows uSrc MSB is unset.
// Untextured prims can always skip (source color always comes with MSB=0).
{
// Blend func can save an operation if it knows uSrc MSB is unset.
// Untextured prims can always skip (source color always comes with MSB=0).
- // For textured prims, lighting funcs always return it unset. (bonus!)
- const bool skip_uSrc_mask = (!CF_TEXTMODE) || CF_LIGHT;
+ // For textured prims, the generic lighting funcs always return it unset. (bonus!)
+ const bool skip_uSrc_mask = MSB_PRESERVED ? (!CF_TEXTMODE) : (!CF_TEXTMODE) || CF_LIGHT;
if (CF_LIGHT)
uSrc = gpuLightingTXT(uSrc, r5, g5, b5);
if (CF_LIGHT)
uSrc = gpuLightingTXT(uSrc, r5, g5, b5);
- if (CF_MASKSET) { *pDst = uSrc | 0x8000; }
- else if (CF_BLEND || CF_LIGHT) { *pDst = uSrc | srcMSB; }
- else { *pDst = uSrc; }
+ if (CF_MASKSET) { *pDst = uSrc | 0x8000; }
+ else if (!MSB_PRESERVED && (CF_BLEND || CF_LIGHT)) { *pDst = uSrc | srcMSB; }
+ else { *pDst = uSrc; }
{
// Blend func can save an operation if it knows uSrc MSB is unset.
// Untextured prims can always skip this (src color MSB is always 0).
{
// Blend func can save an operation if it knows uSrc MSB is unset.
// Untextured prims can always skip this (src color MSB is always 0).
- // For textured prims, lighting funcs always return it unset. (bonus!)
- const bool skip_uSrc_mask = (!CF_TEXTMODE) || CF_LIGHT;
+ // For textured prims, the generic lighting funcs always return it unset. (bonus!)
+ const bool skip_uSrc_mask = MSB_PRESERVED ? (!CF_TEXTMODE) : (!CF_TEXTMODE) || CF_LIGHT;
+ bool should_blend;
// UNTEXTURED, NO GOURAUD
const u16 pix15 = gpu_unai.PixelData;
do {
// UNTEXTURED, NO GOURAUD
const u16 pix15 = gpu_unai.PixelData;
do {
// NOTE: Don't enable CF_BLITMASK pixel skipping (speed hack)
// on untextured polys. It seems to do more harm than good: see
// NOTE: Don't enable CF_BLITMASK pixel skipping (speed hack)
// on untextured polys. It seems to do more harm than good: see
// See note in above loop regarding CF_BLITMASK
//if (CF_BLITMASK) { if ((bMsk>>((((uintptr_t)pDst)>>1)&7))&1) goto endpolynotextgou; }
// See note in above loop regarding CF_BLITMASK
//if (CF_BLITMASK) { if ((bMsk>>((((uintptr_t)pDst)>>1)&7))&1) goto endpolynotextgou; }
//senquack - note: original UNAI code had gpu_unai.{u4/v4} packed into
// one 32-bit unsigned int, but this proved to lose too much accuracy
//senquack - note: original UNAI code had gpu_unai.{u4/v4} packed into
// one 32-bit unsigned int, but this proved to lose too much accuracy
uSrc = gpuLightingTXT(uSrc, r5, g5, b5);
}
uSrc = gpuLightingTXT(uSrc, r5, g5, b5);
}
- if (CF_MASKSET) { *pDst = uSrc | 0x8000; }
- else if (CF_BLEND || CF_LIGHT) { *pDst = uSrc | srcMSB; }
- else { *pDst = uSrc; }
+ if (CF_MASKSET) { *pDst = uSrc | 0x8000; }
+ else if (!MSB_PRESERVED && (CF_BLEND || CF_LIGHT)) { *pDst = uSrc | srcMSB; }
+ else { *pDst = uSrc; }