Early finalization if possible

This commit is contained in:
Jeffrey Pfau 2013-11-02 22:11:36 -07:00
parent 53a52d8cf8
commit 32e0591fd0
2 changed files with 9 additions and 0 deletions

View File

@ -517,6 +517,8 @@ static void GBAVideoSoftwareRendererWriteBLDCNT(struct GBAVideoSoftwareRenderer*
renderer->target2Obj = bldcnt.target2Obj;
renderer->target2Bd = bldcnt.target2Bd;
renderer->anyTarget2 = bldcnt.packed & 0x3F00;
if (oldEffect != renderer->blendEffect) {
_updatePalettes(renderer);
}
@ -725,6 +727,9 @@ static void _drawBackgroundMode0(struct GBAVideoSoftwareRenderer* renderer, stru
int flags = (background->priority << OFFSET_PRIORITY) | FLAG_IS_BACKGROUND;
flags |= FLAG_TARGET_1 * (background->target1 && renderer->blendEffect == BLEND_ALPHA);
flags |= FLAG_TARGET_2 * background->target2;
if (!renderer->anyTarget2) {
flags |= FLAG_FINALIZED;
}
uint32_t screenBase;
uint32_t charBase;
@ -1001,6 +1006,9 @@ static void _drawBackgroundMode0(struct GBAVideoSoftwareRenderer* renderer, stru
int flags = (background->priority << OFFSET_PRIORITY) | FLAG_IS_BACKGROUND; \
flags |= FLAG_TARGET_1 * (background->target1 && renderer->blendEffect == BLEND_ALPHA); \
flags |= FLAG_TARGET_2 * background->target2; \
if (!renderer->anyTarget2) { \
flags |= FLAG_FINALIZED; \
} \
int variant = background->target1 && renderer->currentWindow.blendEnable && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); \
color_t* palette = renderer->normalPalette; \
if (variant) { \

View File

@ -115,6 +115,7 @@ struct GBAVideoSoftwareRenderer {
enum BlendEffect blendEffect;
color_t normalPalette[512];
color_t variantPalette[512];
int anyTarget2;
uint16_t blda;
uint16_t bldb;