GBA Video: Optimize compositing cases slightly
Jeffrey Pfau jeffrey@endrift.com
Mon, 22 Aug 2016 12:35:48 -0700
3 files changed,
10 insertions(+),
3 deletions(-)
M
src/gba/renderers/software-bg.c
→
src/gba/renderers/software-bg.c
@@ -40,9 +40,6 @@ x += background->dx; \
y += background->dy; \ \ uint32_t current = *pixel; \ - if (!IS_WRITABLE(current)) { \ - continue; \ - } \ MOSAIC(COORD) \ if (pixelData) { \ COMPOSITE_256_ ## OBJWIN (BLEND, 0); \
M
src/gba/renderers/software-private.h
→
src/gba/renderers/software-private.h
@@ -51,6 +51,9 @@ *pixel = color;
} static inline void _compositeBlendNoObjwin(struct GBAVideoSoftwareRenderer* renderer, uint32_t* pixel, uint32_t color, uint32_t current) { + if (!IS_WRITABLE(current)) { \ + return; \ + } \ if (color >= current) { if (current & FLAG_TARGET_1 && color & FLAG_TARGET_2) { color = _mix(renderer->blda, current, renderer->bldb, color);@@ -84,6 +87,9 @@ *pixel = color;
} #define COMPOSITE_16_OBJWIN(BLEND, IDX) \ + if (!IS_WRITABLE(current)) { \ + continue; \ + } \ if (objwinForceEnable || (!(current & FLAG_OBJWIN)) == objwinOnly) { \ unsigned color = (current & FLAG_OBJWIN) ? objwinPalette[paletteData | pixelData] : palette[pixelData]; \ unsigned mergedFlags = flags; \@@ -97,6 +103,9 @@ #define COMPOSITE_16_NO_OBJWIN(BLEND, IDX) \
_composite ## BLEND ## NoObjwin(renderer, &pixel[IDX], palette[pixelData] | flags, current); #define COMPOSITE_256_OBJWIN(BLEND, IDX) \ + if (!IS_WRITABLE(current)) { \ + continue; \ + } \ if (objwinForceEnable || (!(current & FLAG_OBJWIN)) == objwinOnly) { \ unsigned color = (current & FLAG_OBJWIN) ? objwinPalette[pixelData] : palette[pixelData]; \ unsigned mergedFlags = flags; \