Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dbl bfr #58

Merged
merged 57 commits into from
May 7, 2019
Merged

Dbl bfr #58

merged 57 commits into from
May 7, 2019

Conversation

tehKaiN
Copy link
Member

@tehKaiN tehKaiN commented May 6, 2018

fixes #57
fixes #34
fixes #59

Imposes a breaking change: pointer to simplebuffer's bitmap is changed from pManager->pBuffer to pManager->pFront and pManager->pBack.

@tehKaiN tehKaiN requested a review from approxit May 6, 2018 16:57
uwBoundWidth, uwBoundHeight,
pVPort->ubBPP, ubBitmapFlags
);
if(!pFront) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pFront?

@@ -81,7 +186,8 @@ tSimpleBufferManager *simpleBufferCreate(
logWrite("Copperlist offset: %u\n", pManager->uwCopperOffset);
}

simpleBufferSetBitmap(pManager, pBuffer);
simpleBufferSetFront(pManager, pFront);
simpleBufferSetBack(pManager, pBack == 0 ? pFront : pBack);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicit == 0 is not needed.
pBack ? pBack : pFront

(6+2*pManager->sCommon.pVPort->ubBPP)*sizeof(tCopCmd)
);
if(pManager->pCameraManager && isCameraCreated) {
cameraDestroy(pManager->pCameraManager);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing pManager that was freed in line 206?

@approxit
Copy link
Collaborator

approxit commented May 7, 2018

I need to say NO for breaking change with removing pBuffer pointer.

Actually games explicitly use pBuffer everywhere. pBack/pFront is a hard coded pattern bound only to simplebuffer manager. Other buffer managers use pBuffer. You don't want to refactor whole game code while switching on/from simplebuffer manager.

Let's keep the old pointer to keep sanity, and pFront/pBack as additional pointers.

@tehKaiN
Copy link
Member Author

tehKaiN commented May 7, 2018

Okay, hold on. This braking change is minor and I've mentioned it only so that you can effortlessly update code in your prods. Keep in mind that we're not versioning ACE yet, so unless we're in semver 1.0 expect stuff to change a lot.

I expect that ACE will have little to no backwards compatibility between versions for sake of speed, because there are lots of stuff in code which were written in a very poor way. Best approaches are not yet known, so I'm not going to support wrong ones.

This change is for the better, since for single-buffered screens pFront and pBack will be the same, and if you work on pBack then you can switch to double buffered stuff without changing anything else except for one creation tag.

Also, recent OS disabling and GCC pull requests probably broke your code anyway, so idk why you're getting mad at such trivial change.

If you really don't want to change code in your games, just include ACE as submodule with HEAD set to last known commit which worked.

Regarding simplebuffer-only pattern, expect double buffering support in tile/scroll buffers too.

@@ -187,7 +187,7 @@ tSimpleBufferManager *simpleBufferCreate(
}

simpleBufferSetFront(pManager, pFront);
simpleBufferSetBack(pManager, pBack == 0 ? pFront : pBack);
simpleBufferSetBack(pManager, pBack ? pFront : pBack);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ommiting == 0 actually flips the logic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 6301206

Copy link
Collaborator

@approxit approxit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expressed myself not correctly, sorry.

I'm not against breaking changes. What I mean is to keep engine API consistent.
Breaking out simplebuffer manager from pBuffer which is used by EVERY other buffer manager is breaking the consistence. It's API job to ease end-users with working with engine. Double buffering is an optional feature which forces the-most-simple-case (single buffered mode) to have a penalty in decision about buffer manager change.

Good API should have most common cases as defaults. That's why I want to keep pBuffer in singlebuffer manager. Optional feature is not worthy of removing that handy consistent name regardless of the manager you use.

@@ -202,12 +202,12 @@ tSimpleBufferManager *simpleBufferCreate(
if(pFront) {
bitmapDestroy(pFront);
}
if(pManager && pManager->pCameraManager && isCameraCreated) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be nested inside pManager check. Why check twice, when you can check once?

@tehKaiN
Copy link
Member Author

tehKaiN commented May 7, 2018

We may wait with merge until rest of vport managers get double buffering support then - it will be consistent across whole engine.

From my current point of view, writing games using single buffering shouldn't be a default approach since it works in very few cases, where you're sure you will always be with your drawing before display beam. Double buffering allows you to not waste computing time on bob sorting which gets costly if you also consider z-sort. Without sorting in mind, your only concern is if you finish all blits in time of single frame, or in two frames if you target 25fps instead of 50.

@tehKaiN tehKaiN force-pushed the dbl-bfr branch 3 times, most recently from 5eb3d25 to 88dd170 Compare June 10, 2018 10:33
@tehKaiN tehKaiN force-pushed the dbl-bfr branch 3 times, most recently from f2f47c5 to ec41b96 Compare June 25, 2018 11:29
@tehKaiN tehKaiN force-pushed the dbl-bfr branch 2 times, most recently from 2e2d12a to e3d9ad3 Compare July 10, 2018 19:08
@tehKaiN tehKaiN force-pushed the dbl-bfr branch 3 times, most recently from a6e9d25 to db49889 Compare July 15, 2018 12:34
@tehKaiN tehKaiN force-pushed the dbl-bfr branch 4 times, most recently from cc64a3d to 1229792 Compare July 24, 2018 06:32
@tehKaiN tehKaiN force-pushed the dbl-bfr branch 3 times, most recently from 0c5fdb8 to a7d9142 Compare September 7, 2018 18:04
@tehKaiN tehKaiN force-pushed the master branch 2 times, most recently from d55fe9d to 57733d4 Compare September 7, 2018 18:08
@tehKaiN
Copy link
Member Author

tehKaiN commented May 7, 2019

i don't want to wait for it any longer, seems stable enough

@tehKaiN tehKaiN merged commit f50d520 into master May 7, 2019
@tehKaiN tehKaiN deleted the dbl-bfr branch July 25, 2020 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants