mirror of https://github.com/mgba-emu/mgba.git
DS GX: Minor optimizations
This commit is contained in:
parent
2b6ed2661e
commit
13bc1125ce
|
@ -667,6 +667,10 @@ static void DSGXSoftwareRendererDrawScanline(struct DSGXRenderer* renderer, int
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
|
unsigned stencilValue = span->polyId;
|
||||||
|
if (span->poly->blendFormat == 3) {
|
||||||
|
stencilValue |= 0x40;
|
||||||
|
}
|
||||||
for (; x < (span->ep[1].coord[0] >> 12) && x < DS_VIDEO_HORIZONTAL_PIXELS; ++x) {
|
for (; x < (span->ep[1].coord[0] >> 12) && x < DS_VIDEO_HORIZONTAL_PIXELS; ++x) {
|
||||||
color_t color = _lookupColor(softwareRenderer, &span->ep[0], span->poly);
|
color_t color = _lookupColor(softwareRenderer, &span->ep[0], span->poly);
|
||||||
_stepEndpoint(span);
|
_stepEndpoint(span);
|
||||||
|
@ -674,16 +678,13 @@ static void DSGXSoftwareRendererDrawScanline(struct DSGXRenderer* renderer, int
|
||||||
unsigned current = scanline[x];
|
unsigned current = scanline[x];
|
||||||
unsigned b = current >> 27;
|
unsigned b = current >> 27;
|
||||||
unsigned ab = a;
|
unsigned ab = a;
|
||||||
unsigned s = span->polyId;
|
unsigned s = stencilValue;
|
||||||
if (b > ab) {
|
if (b > ab) {
|
||||||
ab = b;
|
ab = b;
|
||||||
}
|
}
|
||||||
if (span->poly->blendFormat == 3) {
|
|
||||||
s |= 0x40;
|
|
||||||
}
|
|
||||||
if (a == 0x1F) {
|
if (a == 0x1F) {
|
||||||
if (span->ep[0].coord[softwareRenderer->sort] < softwareRenderer->depthBuffer[x]) {
|
if (span->ep[0].coord[softwareRenderer->sort] < softwareRenderer->depthBuffer[x]) {
|
||||||
if (s != 0x40 && !(softwareRenderer->stencilBuffer[x] & 0x40)) {
|
if (!(s == 0x40 || (softwareRenderer->stencilBuffer[x] & 0x40))) {
|
||||||
softwareRenderer->depthBuffer[x] = span->ep[0].coord[softwareRenderer->sort];
|
softwareRenderer->depthBuffer[x] = span->ep[0].coord[softwareRenderer->sort];
|
||||||
scanline[x] = color;
|
scanline[x] = color;
|
||||||
s &= ~0x40;
|
s &= ~0x40;
|
||||||
|
@ -696,9 +697,8 @@ static void DSGXSoftwareRendererDrawScanline(struct DSGXRenderer* renderer, int
|
||||||
color = _mix32(a, color, 0x1F - a, current);
|
color = _mix32(a, color, 0x1F - a, current);
|
||||||
color |= ab << 27;
|
color |= ab << 27;
|
||||||
}
|
}
|
||||||
if (softwareRenderer->stencilBuffer[x] != s) {
|
if (softwareRenderer->stencilBuffer[x] != s && span->ep[0].coord[softwareRenderer->sort] < softwareRenderer->depthBuffer[x]) {
|
||||||
if (span->ep[0].coord[softwareRenderer->sort] < softwareRenderer->depthBuffer[x]) {
|
if (!(s == 0x40 || (softwareRenderer->stencilBuffer[x] & 0x40))) {
|
||||||
if (s != 0x40 && !(softwareRenderer->stencilBuffer[x] & 0x40)) {
|
|
||||||
if (DSGXPolygonAttrsIsUpdateDepth(span->poly->poly->polyParams)) {
|
if (DSGXPolygonAttrsIsUpdateDepth(span->poly->poly->polyParams)) {
|
||||||
softwareRenderer->depthBuffer[x] = span->ep[0].coord[softwareRenderer->sort];
|
softwareRenderer->depthBuffer[x] = span->ep[0].coord[softwareRenderer->sort];
|
||||||
}
|
}
|
||||||
|
@ -710,7 +710,6 @@ static void DSGXSoftwareRendererDrawScanline(struct DSGXRenderer* renderer, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (y == DS_VIDEO_VERTICAL_PIXELS - 1) {
|
if (y == DS_VIDEO_VERTICAL_PIXELS - 1) {
|
||||||
softwareRenderer->flushPending = false;
|
softwareRenderer->flushPending = false;
|
||||||
|
|
Loading…
Reference in New Issue