English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 07 July 2011, 18:57   #1
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 469
Double buffer copper??

So you double buffer your screen drawing, clearing one while drawing the other.

I'm wondering if you can do this with the copper and how best to go about it

I know that for interlace you can setup two copper lists, however I would be concerned as to which one was acutally active at any given time.

So, lets say I say i build a copper list ready for the next frame. If I then load the copper pointers at the end of the routine but the copper is still running through the current list, does instantly start your new one or wait until it is finished then start your new one?

would love to know how....

cheers
h0ffman is offline  
Old 07 July 2011, 19:33   #2
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 39
Posts: 1,919
Quote:
Originally Posted by h0ffman View Post
So you double buffer your screen drawing, clearing one while drawing the other.

I'm wondering if you can do this with the copper and how best to go about it

I know that for interlace you can setup two copper lists, however I would be concerned as to which one was acutally active at any given time.
You usually setup a copperlist per screen, or in your case one for the physical (active) screen and one for the logical (currently inactive) screen which is currently being created.


Quote:
Originally Posted by h0ffman View Post
So, lets say I say i build a copper list ready for the next frame. If I then load the copper pointers at the end of the routine but the copper is still running through the current list, does instantly start your new one or wait until it is finished then start your new one?

would love to know how....

cheers
My understanding is that it will continue using the current copperlist and then use the new address in COPxLCH at the next VBL.

If you want it to start the new copperlist immediately, then write any value to the appropriate strobe register (e.g. COPJMPx).


Regards,
Lonewolf10

Last edited by Lonewolf10; 07 July 2011 at 19:56.
Lonewolf10 is offline  
Old 11 July 2011, 21:06   #3
korruptor
TDI
korruptor's Avatar
 
Join Date: Feb 2007
Location: DUNDEE
Posts: 122
I double buffer copper lists and swap them over as the first part of my loop. I've 2 copper lists, pointing to 2 different sets of bitplanes, so swapping them when my loop is entered handles the screen double buffering for me. I just refer to a base pointer in the code and switch what cop1lc refers to each frame.

I had a nasty issue with a race condition when I first started trying to learn asm - I was updating the copperlist as it was being read - so I moved over to double buffering the lot as it just seemed to be easier to manage.

What I'm not doing atm is building any copper lists on the fly, so I've got a load of unnecessary duplication in my code.
korruptor is offline  
Old 11 July 2011, 23:12   #4
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 469
Nice one, cheers guys, have tested the theory and it seems to work
h0ffman is offline  
Old 12 July 2011, 23:27   #5
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 39
Posts: 1,919
Quote:
Originally Posted by korruptor View Post
I had a nasty issue with a race condition when I first started trying to learn asm - I was updating the copperlist as it was being read - so I moved over to double buffering the lot as it just seemed to be easier to manage.
Hehe, had a few issues along those lines myself this week too. I'm not using double buffering at the moment, but it's one of the things I will definately use on my next project


Quote:
Originally Posted by korruptor View Post
What I'm not doing atm is building any copper lists on the fly, so I've got a load of unnecessary duplication in my code.
I have several copperlists in my code, but some are being modified on the fly


Regards,
Lonewolf10
Lonewolf10 is offline  
Old 13 July 2011, 05:02   #6
korruptor
TDI
korruptor's Avatar
 
Join Date: Feb 2007
Location: DUNDEE
Posts: 122
Both mine are being modified. I just don't like the fact that I'm statically duplicating all the unmodified stuff, multiple times. Low pri and not a massive issue, but it bugs the hell out of me all the same

I wish I had more time
korruptor is offline  
Old 14 July 2011, 20:54   #7
Photon
Moderator
Photon's Avatar
 
Join Date: Nov 2004
Location: Hult / Sweden
Posts: 4,589
If it's the buffer you are doubling, and the rest of the copper should show the same, just set the currently-not-being-drawn-into bitplane pointers in the Vblank interrupt.

Or, you could 'poke' the bitplane pointers in a single copper to do double-buffering.

No need for more than 1 copper, just because you double buffer. Only if you also need a copper buffer; when content differs in the copperlist between two frames - somewhere to poke the copper that is not being displayed yet.
Photon is offline  
Old 19 July 2011, 14:51   #8
korruptor
TDI
korruptor's Avatar
 
Join Date: Feb 2007
Location: DUNDEE
Posts: 122
Yeah, my copper contents were changing, so I duplicated the list for simplicity. Dirty
korruptor is offline  
Old 19 July 2011, 20:10   #9
Photon
Moderator
Photon's Avatar
 
Join Date: Nov 2004
Location: Hult / Sweden
Posts: 4,589
Well, it's not dirty if you're planning on double-buffering the rest of the copperlist contents, like a coppershade that should match some moving bitplane, for example. Or if you have a screen split and the buffer you are doubling isn't at the top. And if you're running a copper with some stuff in it anyway, it IS the simplest way to switch buffers.

Wasn't a criticism at all I try to keep such out of non-opinion posts. Reducing redundancy is good programming though, even if it's not always best practice.
Photon 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
Combining copper scrolling with copper background phx Coders. Asm / Hardware 14 16 June 2013 08:26
Vsync Fullscreen and Double Buffer, incorrect frame rate? rsn8887 support.WinUAE 1 07 April 2011 21:43
SysEx buffer overflow Ducktale support.WinUAE 1 30 August 2007 13:20
4 way IDE buffer for sale Smiley MarketPlace 7 04 July 2007 17:27
Double PAL / Double NTSC, oficially supported by WHDLoad... Shoonay project.WHDLoad 1 17 December 2005 18:05

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 18:15.


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