AmigaPorts / ACE

Amiga C Engine
Mozilla Public License 2.0
154 stars 25 forks source link

Rework blitter functions arguments #185

Open tehKaiN opened 1 year ago

tehKaiN commented 1 year ago

Currently, blitCopy() etc require something like 10 args, passing which is a bad idea performance-wise.

It could be replace by passing an arg struct. Instead of

blitCopy(s_pBgSub, 0, 0, s_pBfr->pBack, 0, 0, 320, 128, MINTERM_COPY);
blitCopy(s_pBgSub, 0, 128, s_pBfr->pBack, 0, 128, 320, 128, MINTERM_COPY);

It would be something like

tBlitCopyArgs sArgs = {s_pBgSub, 0, 0, s_pBfr->pBack, 0, 0, 320, 128, MINTERM_COPY};
blitCopyPredefined(&sArgs);
sArgs.uwSrcY = 128;
sArgs.uwDstY = 128;
blitCopyPredefined(&sArgs);

Pros:

Cons:

Vairn commented 1 year ago

seems like a good idea, you can do some easy batch rendereing with only changing two values, especially with my wall rendering calls blitcopymask 2000* odd times a frame.

might be an little exaggerated

steamknight commented 1 year ago

If we pass a structure, there will be a pointer dereference for each original parameter inside the blit call. I'm curious if that will still be faster than passing in 10 arguments to the function or if the compiler can optimize the extra dereference away.

tehKaiN commented 1 year ago

Definitely needs benchmarking!