English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 04 May 2018, 11:31   #1
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,066
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..]
ross is offline  
Old 04 May 2018, 14:46   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 21,773
Quote:
Originally Posted by ross View Post
It's somewhat possible to disable read operation and gain a free cycle?
Yes but..: http://eab.abime.net/showpost.php?p=814879&postcount=7 (note that those useless line mode weird things are not emulated, need to know full blitter internals first)

Quote:
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?
It is not possible. Agnus can't do back to back same channel DMA accesses. (due to internal pipelining)
Toni Wilen is offline  
Old 04 May 2018, 16:12   #3
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,066
Quote:
Originally Posted by Toni Wilen View Post
Yes but..: http://eab.abime.net/showpost.php?p=814879&postcount=7 (note that those useless line mode weird things are not emulated, need to know full blitter internals first)
wow, pure blitter weirdness!
Then I stay with my routine

Quote:
It is not possible. Agnus can't do back to back same channel DMA accesses. (due to internal pipelining)
I suspected it, but I tried anyway to ask..
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.
ross is offline  
Old 06 May 2018, 21:20   #4
Seoman
Registered User

 
Join Date: Nov 2007
Location: Spain
Posts: 24
Quote:
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.

Can you explain that trick please?
Seoman is offline  
Old 06 May 2018, 23:11   #5
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,066
Quote:
Originally Posted by Seoman View Post
Can you explain that trick please?
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..
ross is offline  
Old 09 May 2018, 09:52   #6
Seoman
Registered User

 
Join Date: Nov 2007
Location: Spain
Posts: 24
Thank you ross, it's very clear now
Seoman is offline  
Old 09 May 2018, 16:39   #7
LeCaravage
Registered User

LeCaravage's Avatar
 
Join Date: May 2017
Location: AmigaLand
Posts: 122
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 ;-)
LeCaravage is offline  
Old 09 May 2018, 17:26   #8
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,066
Quote:
Originally Posted by LeCaravage View Post
But, could it be possible the trick is more faster than erasing a backbuffer ? Even with a max size filling box ?
Unfortunately not always but only in particular conditions, which are those with which I find myself dealing (big and simple polygons, non-intersecting lines, separate planes).
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:
You'll have an extra DMA channel + erasing lines + more datas to copy but still I wonder.
I don't have an extra DMA channel used. Also a standard blitter fill require A+D, the only difference is that usually A=D (you fill on-place).
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:
Please don't laugh too loud if I'm way off beam ;-)
Il n'y a pas de questions stupides, il n'y a que des réponses stupides.
ross is offline  
Old 12 May 2018, 20:03   #9
TheDarkCoder
Registered User
 
Join Date: Dec 2007
Location: Dark Kingdom
Posts: 211
Quote:
Originally Posted by ross View Post

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.
I am not sure to understand operation 1. To redraw with the blitter on the wire-buffer the preceding polygon(s), you redraw each line separately, or you have a bounding box for a wire-framed polygon that you xor with the previous content of the buffer?
TheDarkCoder is offline  
Old 12 May 2018, 22:32   #10
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,066
Quote:
Originally Posted by TheDarkCoder View Post
I am not sure to understand operation 1. To redraw with the blitter on the wire-buffer the preceding polygon(s), you redraw each line separately, or you have a bounding box for a wire-framed polygon that you xor with the previous content of the buffer?
Each line separately, the bounding box is too big..

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.
ross is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:12.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.07428 seconds with 13 queries