KYRA: (EOB/SegaCD) - make use of Common::ObjectPool

The priority render chain can go up to several thousand objects. So this might improve performance.
This commit is contained in:
athrxx 2020-09-06 18:45:34 +02:00
parent b87773bcd9
commit f77e238629
2 changed files with 19 additions and 3 deletions

View File

@ -933,7 +933,11 @@ template<bool hflip> void SegaRenderer::renderLineFragment(uint8 *dst, uint8 *ma
#undef mRenderLineFragment
void SegaRenderer::initPrioRenderTask(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal, bool hflip) {
#if SEGA_USE_MEMPOOL
_prioChainEnd = new (_prioRenderMemPool) PrioTileRenderObj(_prioChainEnd, dst, mask, src, start, end, pal, hflip);
#else
_prioChainEnd = new PrioTileRenderObj(_prioChainEnd, dst, mask, src, start, end, pal, hflip);
#endif
if (!_prioChainStart)
_prioChainStart = _prioChainEnd;
}
@ -942,7 +946,11 @@ void SegaRenderer::clearPrioChain() {
while (_prioChainEnd) {
_prioChainEnd->_next = 0;
PrioTileRenderObj *e = _prioChainEnd->_pred;
#if SEGA_USE_MEMPOOL
_prioRenderMemPool.deleteChunk(_prioChainEnd);
#else
delete _prioChainEnd;
#endif
_prioChainEnd = e;
}
_prioChainStart = 0;
@ -1110,7 +1118,7 @@ void SegaCDFont::drawChar(uint16 c, byte *dst, int pitch, int xOffs, int yOffs)
dst++;
if ((x & 7) == 7)
dst += 28;
}
}
dst = dst2 + 4;
if ((++yOffs & 7) == 0)
dst = dst + (pitch << 5) - 32;

View File

@ -25,11 +25,16 @@
#ifdef ENABLE_EOB
#define SEGA_PERFORMANCE true
#define SEGA_USE_MEMPOOL true
#include "kyra/graphics/screen_eob.h"
namespace Kyra {
#if SEGA_USE_MEMPOOL
#include "common/memorypool.h"
#endif
#define SEGA_PERFORMANCE true
namespace Kyra {
class SegaRenderer {
public:
@ -141,6 +146,9 @@ private:
PrioTileRenderObj *_next;
};
#if SEGA_USE_MEMPOOL
Common::ObjectPool<PrioTileRenderObj> _prioRenderMemPool;
#endif
PrioTileRenderObj *_prioChainStart, *_prioChainEnd;
uint16 _screenW, _screenH, _blocksW, _blocksH;
Screen_EoB *_screen;