diff --git a/src/FxEngine/zbuffer.c b/src/FxEngine/zbuffer.c index a7a9805..15a94f8 100644 --- a/src/FxEngine/zbuffer.c +++ b/src/FxEngine/zbuffer.c @@ -26,12 +26,13 @@ static const uint32_t size_char = size_uint32*sizeof(int32_t); static int32_t* address=0; const int32_t clearval=3000; - void FE_zbuffer_clear() { if (address==0) { - address = malloc(size_char); + address = (int32_t*)malloc(size_char+3); + address/=4; + address*=4; if (address==0) // cas de figure où il n'y a plus assez de RAM { dclear(C_WHITE); @@ -43,24 +44,21 @@ void FE_zbuffer_clear() } // TODO déterminer le type d'effacement if (isSH3()) - { // effacement fait par le CPU - uint32_t indice; + { // effacement CPU + uint_fast16_t indice; for (indice = 0; indice < size_uint32; indice ++) address[indice] = clearval; } else - { // effacement fait par le DMA + { // effacement DMA dma_transfer(0, DMA_32B, size_uint32, &clearval, DMA_FIXED, address, DMA_INC); } - - } void FE_start_rendering() { - if (isSH3()) - return; - dma_transfer_wait(0); + if (!isSH3()) + dma_transfer_wait(0); }