20 September 2018, 12:09 | #21 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
I'll be happy to share my CPU based code once I believe I can't make it faster, but until people better than me have verified that it is as fast as it can be, it's not the basis for comparison with anything.
As for blitter based code? That's a job for someone else. |
20 September 2018, 15:18 | #22 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
@deimos
Thanks for your reply. you've been doing a hell of job! I could try to put on some simple test to see which is faster. Some sort of best case scenario with well aligned quand, and fill it with blitter and cpu |
21 September 2018, 15:34 | #23 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
|
21 September 2018, 15:50 | #24 | |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
I think your test needs to be a bit more representative of what a real application or game would draw.
Quote:
|
|
21 September 2018, 16:00 | #25 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
|
22 September 2018, 11:50 | #26 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,211
|
Does you blitter test iinvolve the following steps:
clearing the blitter buffer? drawing the lines? filling the buffer? copying the buffer to all the bitplanes (either "or'ing" or "not anding")? To be honest, your test is not representitive of anything if it is not doing all these things.... |
22 September 2018, 15:15 | #27 | |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
Quote:
|
|
23 September 2018, 11:23 | #28 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
About filling, I've an idea. Instead of fill a triangle, we can use a mask that cut unwanted pixels outside triangle edges(some sort of inverted mask)on a prefilled bitmap, and then, with blitter, copy this triangle chunck, into screen, piece by pieces, meanwhile cpu is preparing the next triangles' chunck. Every chunck is maximum 16 px in height
|
23 September 2018, 15:56 | #29 | |
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
|
Quote:
|
|
23 September 2018, 16:52 | #30 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
|
23 September 2018, 17:07 | #31 |
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
|
Okay. When the CPU "prepares" a chunk, do you intend that the CPU draws the mask pattern into a buffer? Effectively drawing the left- and right- edges of a 16-pixels-high segment of a triangle into a 1-bitplane image? If not, how do you intend this to work?
|
23 September 2018, 17:09 | #32 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
You'we got it, cpu draws that mask patter, and then with blitter we can draw this chunk into buffer. This way should free cpu do fill the whole triangle since it's prefilled
|
23 September 2018, 17:18 | #33 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
I think that with a bunch of precomputated masks(16*16 pixel), and knowing lines' slope, we can build that edge mask very fast.
|
23 September 2018, 17:35 | #34 | |
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
|
Quote:
Here are some more things for you to consider when you refine this: - How many mask patterns do you need? Is there a trade off between precision and memory usage here? Can the mask patterns reasonably fit into memory? - How do you handle edges that slope more horizontally than vertically? (This is a more general version of 'how do you handle edges which cross a horizontal 16-pixel boundary halfway through a 16-line-block?') - what the CPU does is similar to drawing the edge of a triangle. Would it make more sense for the CPU to work directly against the screen? - How do you effectively handle the 'interior' portions of large triangles - those areas where there are entirely filled 16x16-pixel-blocks? If you can sort out these algorithmic problems then you are closer to a point where this can be compared to other approaches. Last edited by Kalms; 23 September 2018 at 17:56. |
|
23 September 2018, 19:11 | #35 | |||
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
Quote:
Quote:
Quote:
|
|||
23 September 2018, 19:51 | #36 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
I think I wasn't able to explain this way well. Think about a piece of paper which is our prefilled area. Now, think about having scissor to cut our triangle and put it into screen.
I hope this example would be fine. Some sort of Stencil buffer |
24 September 2018, 08:09 | #37 |
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
|
I'm not going to spend more time on this myself, but from what I can see so far the two main challenges will probably be 1. memory consumption for the precomputed masks (with too few masks, the triangle edges will look ugly when they cross between 16-pixel blocks) and 2. CPU overhead per individual block.
|
26 September 2018, 14:30 | #38 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
Another possible way to optimize this kind of rendering is to define traingles' or quads' bounding box, and fill the outside portions' of these polygons and then doing a cookie cut operation with blitter
|
26 September 2018, 23:30 | #39 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,211
|
Just code it up and come back with some results. Will be interesting to see what you come up with
|
27 September 2018, 05:41 | #40 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using blitter for filling 3D polygons | kovacm | Amiga scene | 34 | 25 January 2018 15:30 |
Blitter filling speed, how much? | sandruzzo | Coders. Asm / Hardware | 7 | 03 July 2015 14:38 |
CPU Filling vs. Blitter Filling Routine | victim | Coders. General | 18 | 26 January 2014 02:15 |
Blitter filling routine used in games | Codetapper | Coders. General | 2 | 26 January 2012 10:20 |
Filling with the blitter... | Lonewolf10 | Coders. Tutorials | 7 | 13 September 2011 14:30 |
|
|