04 May 2018, 11:31 | #1 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
Blitter: clean-up line drawing and fill mode idle cycles.
I use the classic fast trick about poly rendering: I do not zero-fill the buffer but instead I do an x-or of the preceding line in a back buffer and then a blitter-fill into the front buffer.
But I've a peculiar blitter line draw routine where i don't have intersecting polylines (all is draw in different planes). So my question. Blitter usage/operation are fixed in line-mode and, apart the strange C and D channel behavior, require two chip-mem access (and idle cycle) to draw a pixel. But in my case the first read access is unnecessary because I simply need to zero the destination memory word. It's somewhat possible to disable read operation and gain a free cycle? Another question. I'm using the standard A->D(f) blitter area fill routine for the polys but this combo leave idle cycles (even with blitter nasty) that I prefer to avoid. There is some non-standard channel usage that does not leave free cycles? [I was in doubt if this is the right section (can be also a Coders.General request) but probably is more Asm/Hardware related..] |
04 May 2018, 14:46 | #2 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,573
|
Quote:
Quote:
|
||
04 May 2018, 16:12 | #3 | ||
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
Quote:
Then I stay with my routine Quote:
So now I need to write a CPU concurrent single-plane poly filler to take advantage of this free idle cycles. Thanks Toni for your encyclopedic knowledge and availability. |
||
06 May 2018, 21:20 | #4 | |
Registered User
Join Date: Nov 2007
Location: Spain
Posts: 29
|
Quote:
Can you explain that trick please? |
|
06 May 2018, 23:11 | #5 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
Well, filling polygons on Amiga with blitter is simple. You have at disposal a special blitter line-mode that draw 1 pixel-per-line (too raw in wire-frame but perfect for successive fill). You can even fill multiple polygons using a single operation.
Normally you do double buffer for a smooth video rendering. So the operations are: - display preceding frame and at the same time: 1) clean the back buffer (zero-fill all or boxs used) 2) draw with the blitter a wire frame of the polygons 3) fill with the blitter in-place - swap front and back buffer and repeat But suppose you have very big polygons with simple shape and, even better, rendered in separated bit-planes (my situation). The first operation can be too expensive and slow (the back buffer cleaning). Much much better maintain a "copy" of the wire framed image and use an x-or minterm for the blitter line draw routine, so you can simply "erase" preceding line, rewriting over itself! So the new operations are: - display preceding frame and at the same time: 1) redraw with the blitter on the wire-buffer the preceding polygon(s) 2) draw with the blitter the new polygon(s) 3) fill with the blitter where source A is the wire-buffer and destination D is the back buffer - swap front and back buffer and repeat. But if you followed closely there is a problem.. Normally in a demo/intro the polygons are moving, so unless you fully fill the screen with one big blit the back buffer can contain some old "garbage" (remember there is not the initial zero-fill). So you need to make some clever choice about the "enlarged" blitter-fill box around the wire-framed polygons that also overlap preceding back buffer filled polygons. If the movements between one frame and the next are not excessively rapid, a over bounding box of 16 pixels may be sufficient. I hope that what I wrote is understandable.. |
09 May 2018, 09:52 | #6 |
Registered User
Join Date: Nov 2007
Location: Spain
Posts: 29
|
Thank you ross, it's very clear now
|
09 May 2018, 16:39 | #7 |
Registered User
Join Date: May 2017
Location: AmigaLand
Posts: 459
|
Thanks for this cool knack.
I'm not sure if I understand well. But, could it be possible the trick is more faster than erasing a backbuffer ? Even with a max size filling box ? You'll have an extra DMA channel + erasing lines + more datas to copy but still I wonder. Please don't laugh too loud if I'm way off beam ;-) |
09 May 2018, 17:26 | #8 | |||
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
Quote:
If the video scene is composed of many small and far polygons with complex figures, it is certainly better to erase the back buffer. Quote:
Yes, i've (double) more data to blitter line-draw but sure less than a full back buffer erase! (remember.. big polygons.. so the filled parts are really many). Different situation instead for the chip memory requirement, that is doubled .. since the two wire buffer (front and back) have the same size of the render buffer (plus data for the management of the structures, but they are not much). From my tests speed gain is remarkable so i've used this technique. Quote:
|
|||
12 May 2018, 20:03 | #9 | |
Registered User
Join Date: Dec 2007
Location: Dark Kingdom
Posts: 213
|
Quote:
|
|
12 May 2018, 22:32 | #10 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
Quote:
Even so anyway i've hard times to move two big mono polys with a max extension box of 256x256 pixels in a 4-planes (and some 5-planes zones) screen. A single fill requires more than a 1/3 frame! And it is not even convenient to fill concurrently with the CPU since idle cycles are used by the video DMA.. Drop full frame rate is not an option Last edited by ross; 12 May 2018 at 22:53. Reason: Some info. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Blitter line drawing: nothing happens | Crank | Coders. General | 21 | 25 April 2018 21:43 |
Blitter line mode examples? | LuigiThirty | Coders. Asm / Hardware | 4 | 17 August 2017 08:26 |
Blitter fill problem | mekhall | Coders. Asm / Hardware | 7 | 20 June 2016 00:04 |
Clipping line for blitter fill | leonard | Coders. Asm / Hardware | 12 | 27 April 2013 12:03 |
Line mode blitter | absence | Coders. General | 4 | 25 September 2009 20:50 |
|
|