Skip to content

Commit

Permalink
Simplified simpleBuffer manager
Browse files Browse the repository at this point in the history
  • Loading branch information
tehKaiN committed Jun 10, 2018
1 parent 88dd170 commit 5eb3d25
Showing 1 changed file with 11 additions and 26 deletions.
37 changes: 11 additions & 26 deletions src/ace/managers/viewport/simplebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ void simpleBufferSetFront(tSimpleBufferManager *pManager, tBitMap *pFront) {
copSetMove(&pCmdList[2].sMove, &g_pCustom->ddfstrt, uwDDfStrt);
copSetMove(&pCmdList[3].sMove, &g_pCustom->bpl1mod, uwModulo); // Bitplane modulo
copSetMove(&pCmdList[4].sMove, &g_pCustom->bpl2mod, uwModulo);
copSetMove(&pCmdList[5].sMove, &g_pCustom->bplcon1, 0); // Shift: 0
UBYTE i;
ULONG ulPlaneAddr;
for (i = 0; i < pManager->sCommon.pVPort->ubBPP; ++i) {
ulPlaneAddr = (ULONG)pManager->pFront->Planes[i];
copSetMove(&pCmdList[6 + i*2 + 0].sMove, &g_pBplFetch[i].uwHi, ulPlaneAddr >> 16);
copSetMove(&pCmdList[6 + i*2 + 1].sMove, &g_pBplFetch[i].uwLo, ulPlaneAddr & 0xFFFF);
}
// Copy to front buffer since it needs initialization there too
CopyMem(
&pCopList->pBackBfr->pList[pManager->uwCopperOffset],
Expand All @@ -88,30 +80,23 @@ void simpleBufferSetFront(tSimpleBufferManager *pManager, tBitMap *pFront) {
copMove(pCopList, pBlock, &g_pCustom->ddfstrt, uwDDfStrt);
copMove(pCopList, pBlock, &g_pCustom->bpl1mod, uwModulo); // Bitplane modulo
copMove(pCopList, pBlock, &g_pCustom->bpl2mod, uwModulo);
copMove(pCopList, pBlock, &g_pCustom->bplcon1, 0); // Shift: 0
for (UBYTE i = 0; i < pManager->sCommon.pVPort->ubBPP; ++i) {
ULONG ulPlaneAddr = (ULONG)pManager->pFront->Planes[i];
copMove(pCopList, pBlock, &g_pBplFetch[i].uwHi, ulPlaneAddr >> 16);
copMove(pCopList, pBlock, &g_pBplFetch[i].uwLo, ulPlaneAddr & 0xFFFF);
}
}
// Once more so that both copper buffers get updated
simpleBufferProcess(pManager);
simpleBufferProcess(pManager);
logBlockEnd("simplebufferSetFront()");
}

tSimpleBufferManager *simpleBufferCreate(void *pTags, ...) {
va_list vaTags;
tCopList *pCopList;
tSimpleBufferManager *pManager;
UWORD uwBoundWidth, uwBoundHeight;
UBYTE ubBitmapFlags;
tBitMap *pFront = 0, *pBack = 0;
UBYTE isCameraCreated = 0;
tBitMap *pFront = 0, *pBack = 0;

logBlockBegin("simpleBufferCreate(pTags: %p, ...)", pTags);
va_list vaTags;
va_start(vaTags, pTags);

// Init manager
pManager = memAllocFastClear(sizeof(tSimpleBufferManager));
tSimpleBufferManager *pManager = memAllocFastClear(sizeof(tSimpleBufferManager));
pManager->sCommon.process = (tVpManagerFn)simpleBufferProcess;
pManager->sCommon.destroy = (tVpManagerFn)simpleBufferDestroy;
pManager->sCommon.ubId = VPM_SCROLL;
Expand All @@ -126,9 +111,9 @@ tSimpleBufferManager *simpleBufferCreate(void *pTags, ...) {
logWrite("Parent VPort: %p\n", pVPort);

// Buffer bitmap
uwBoundWidth = tagGet(pTags, vaTags, TAG_SIMPLEBUFFER_BOUND_WIDTH, pVPort->uwWidth);
uwBoundHeight = tagGet(pTags, vaTags, TAG_SIMPLEBUFFER_BOUND_HEIGHT, pVPort->uwHeight);
ubBitmapFlags = tagGet(pTags, vaTags, TAG_SIMPLEBUFFER_BITMAP_FLAGS, BMF_CLEAR);
UWORD uwBoundWidth = tagGet(pTags, vaTags, TAG_SIMPLEBUFFER_BOUND_WIDTH, pVPort->uwWidth);
UWORD uwBoundHeight = tagGet(pTags, vaTags, TAG_SIMPLEBUFFER_BOUND_HEIGHT, pVPort->uwHeight);
UBYTE ubBitmapFlags = tagGet(pTags, vaTags, TAG_SIMPLEBUFFER_BITMAP_FLAGS, BMF_CLEAR);
logWrite("Bounds: %ux%u\n", uwBoundWidth, uwBoundHeight);
pFront = bitmapCreate(
uwBoundWidth, uwBoundHeight, pVPort->ubBPP, ubBitmapFlags
Expand Down Expand Up @@ -156,7 +141,7 @@ tSimpleBufferManager *simpleBufferCreate(void *pTags, ...) {
pManager->pCameraManager = cameraCreate(pVPort, 0, 0, uwBoundWidth, uwBoundHeight);
}

pCopList = pVPort->pView->pCopList;
tCopList *pCopList = pVPort->pView->pCopList;
if(pCopList->ubMode == COPPER_MODE_BLOCK) {
// CopBlock contains: bitplanes + shiftX
pManager->pCopBlock = copBlockCreate(
Expand Down Expand Up @@ -253,7 +238,7 @@ void simpleBufferProcess(tSimpleBufferManager *pManager) {
if(pManager->ubFlags & SIMPLEBUFFER_FLAG_COPLIST_RAW) {
tCopCmd *pCmdList = &pCopList->pBackBfr->pList[pManager->uwCopperOffset];
copSetMove(&pCmdList[5].sMove, &g_pCustom->bplcon1, uwShift);
for (i = 0; i < pManager->sCommon.pVPort->ubBPP; ++i) {
for (i = 0; i < pManager->pBack->Depth; ++i) {
ulPlaneAddr = ((ULONG)pManager->pBack->Planes[i]) + ulBplOffs;
copSetMove(&pCmdList[6 + i*2 + 0].sMove, &g_pBplFetch[i].uwHi, ulPlaneAddr >> 16);
copSetMove(&pCmdList[6 + i*2 + 1].sMove, &g_pBplFetch[i].uwLo, ulPlaneAddr & 0xFFFF);
Expand Down

0 comments on commit 5eb3d25

Please sign in to comment.