English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 03 November 2010, 00:58   #1
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,881
Bitmaps in FASTRAM and blitting - C++

Hiya,

I'm currently using AllocBitMap() to create a bitmap in CHIPRAM and then calling BltBitMapRastPort() which is a bit slow because I have to C2P to the bitmap first.

Is it possible to create a bitmap in FASTRAM using the OS API and then C2P to that instead?

And if so, would BltBitMapRastPort() work with such a bitmap?

Thanks,
Nova
NovaCoder is offline  
Old 03 November 2010, 03:50   #2
Zetr0
Ya' like it Retr0?
Zetr0's Avatar
 
Join Date: Jul 2005
Location: United Kingdom
Age: 45
Posts: 9,768
@Novacoder

I use the typdef of "__CHIP" to create retainers for bitmaps / images I used to layout the Planes too. - somthing like "__CHIP UBYTE TileImage001[x][y][depth]" for planar retainers and "__FAST UBYTE TileImage001[x][y]" for Chunky Buffer

y'know..... I dont actually remember using AllocBitMap(), I do remember hammering BltBitMapMask() a lot though - but this would be on static masks of only 1 plane

Now if I remember correctly (its only been 12 years since I lasted coded Amiga) you need to make sure that any memory thats going to be displayed is located in CHIP ram - so create a retainer / buffer for it in CHIP - with DICE I used the "__CHIP" typdef - and copy from the fast buffer before its displayed.

I also found that writing my own C2P routine was quicker as you can cut corners and reduce the plane counts - then theres some bit-wise opperations you can do instead of just brute force for-loops too

wow - this was all so long ago..... I need to see if I can get my old Amiga Dev partition back online.

infact its been that long I could be talking drivel lol
Zetr0 is offline  
Old 03 November 2010, 05:07   #3
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,881
The bitmap used for display will be in CHIPRAM (attached to the screen/window) but I need another FASTRAM bitmap to play with. I've had a look through the 3.5 NDK but so far I've come up empty.
NovaCoder is offline  
Old 25 November 2010, 06:57   #4
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,881
Code:
struct BitMap *duplicatebmpfast(struct BitMap *bmp)
{
   struct BitMap *fastbmp;
   UWORD p;
   BOOL  error=FALSE;

   if (fastbmp = AllocMem(sizeof(struct BitMap),MEMF_CLEAR))
   {

      InitBitMap(&fastbmp,
                 bmp->Depth,                // Note that under V39
                 bmp->BytesPerRow*8,        // you must use the
                 bmp->Rows);                // function "GetBitMapAttr".

      for(p=0;p<bmp->Depth;p++)
      {
         if (!(fastbmp->Planes[p] = AllocMem(bmp->BytesPerRow*bmp->Rows,0)))
         {
            error = TRUE;
            break;
         }

         CopyMem(bmp->Planes[p], fastbmp->Planes[p],bmp->BytesPerRow*bmp->Rows);
      }
   }

   if (!error) return(fastbmp);


   if (fastbmp)
   {
      for(p=0;p<bmp->Depth;p++)
         if (fastbmp->Planes[p]) FreeMem(fastbmp->Planes[p],bmp->BytesPerRow*bmp->Rows);

      FreeMem(fastbmp,sizeof(struct BitMap));
   }

   return(NULL);
}
NovaCoder is offline  
Old 25 November 2010, 17:55   #5
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 44
Posts: 3,091
Is it at all possible convert all the graphics to planar format beforehand? Even if it's a little troublesome to convert them it should be well worth the effort because of the speed increase.
Thorham is offline  
Old 28 November 2010, 02:51   #6
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,881
Nope, no way in a cold hell is there any chance for me to convert them all
NovaCoder is offline  
Old 28 November 2010, 16:39   #7
Zetr0
Ya' like it Retr0?
Zetr0's Avatar
 
Join Date: Jul 2005
Location: United Kingdom
Age: 45
Posts: 9,768
If i remember wayback-when correctly

I used to use PPaint to save out graphics as c source files - this would then create a planar output file of the graphic (brush/image)

I would then compile these to object code with either a make or on the fly as needed
Zetr0 is offline  
Old 28 November 2010, 23:45   #8
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,881
Hiya,

That process may take me a little while for all of these in game graphics -> supported games

NovaCoder is offline  
Old 29 November 2010, 00:30   #9
DDNI
Targ Explorer

DDNI's Avatar
 
Join Date: Mar 2006
Location: Northern Ireland
Age: 46
Posts: 5,270
Send a message via ICQ to DDNI Send a message via MSN to DDNI
any way to create a script to help the final user preprocess the game graphics for their chosen game and store them locally for use in scummvm?
DDNI is offline  
Old 29 November 2010, 00:46   #10
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,265
Quote:
Originally Posted by DDNI View Post
any way to create a script to help the final user preprocess the game graphics for their chosen game and store them locally for use in scummvm?
I think it's admirable that he puts in so much time porting these games to run on the Amiga, I would never have the same patience myself, but he's clearly also a follower of the Path of Least Resistance it's easier to just make the games run and call the job done, than making them run well.
Leffmann is offline  
Old 29 November 2010, 08:50   #11
DDNI
Targ Explorer

DDNI's Avatar
 
Join Date: Mar 2006
Location: Northern Ireland
Age: 46
Posts: 5,270
Send a message via ICQ to DDNI Send a message via MSN to DDNI
@Leffmann, you are totally wrong! I appreciate that you have a smiley in your post, but that does not stop it from reading a little dismissive and offensive.

Novacoder has worked tirelessly getting his port running well. Often he has had to stop development and go back to square one. This dedication to performance is the polar opposite to what you have said.

Over the last couple of months Novacoder and I have been in frequent contact. He regularly sends me beta builds. I am amazed at the progress I have seen from the 1st build to the latest.

Novacoder and other Amiga coders should be applauded for their efforts! Without them we would have ground to a halt years ago.
DDNI is offline  
Old 29 November 2010, 10:32   #12
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,881
It's ok guys, I know my efforts are appreciated around here
NovaCoder is offline  
Old 29 November 2010, 17:29   #13
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,265
Quote:
Originally Posted by DDNI View Post
@Leffmann, you are totally wrong! I appreciate that you have a smiley in your post, but that does not stop it from reading a little dismissive and offensive.

Novacoder has worked tirelessly getting his port running well. Often he has had to stop development and go back to square one. This dedication to performance is the polar opposite to what you have said.

Over the last couple of months Novacoder and I have been in frequent contact. He regularly sends me beta builds. I am amazed at the progress I have seen from the 1st build to the latest.

Novacoder and other Amiga coders should be applauded for their efforts! Without them we would have ground to a halt years ago.
Ok maybe my post was blunt and a bit clumsy, I wasn't trying to hate on Nova like you think. I do agree with what you say, and if it wasn't for dedicated people like him we would just have a lot of experts saying how things should be done (like me), but no actual software to run.

Quote:
Originally Posted by NovaCoder View Post
It's ok guys, I know my efforts are appreciated around here
Of course they are. Maybe I'm the only one who's been wondering why you didn't go with the native planar graphics from the beginning when it has a such a big impact on performance. I think it would've been much less work than you initially suspected, and thus dropped the idea. Especially in the contrast to all the work you've so far. And after all, you're still working on the graphics performance.
Leffmann is offline  
Old 29 November 2010, 18:51   #14
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 44
Posts: 3,091
Quote:
Originally Posted by NovaCoder View Post
Nope, no way in a cold hell is there any chance for me to convert them all
Why is that? Do they use a strange graphics format that's not documented well in those games? If so, it's a pity. With games such as Warcraft 2, Starcraft, Diablo 1 and 2 it's extremely easy, because the extraction tools exist, and the formats are well documented.

Do you think it would be hard to write an extraction tool from scratch (not asking if you'd like to do it )?
Thorham is offline  
Old 29 November 2010, 23:48   #15
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,881
Quote:
Originally Posted by Thorham View Post
Do you think it would be hard to write an extraction tool from scratch (not asking if you'd like to do it )?
As Leffmann hinted above, it's best to spend your time where it's most needed. It would take me a years to rewrite the entire chunky backend to work with all of of those games (and the list grows bigger every year!) and what would be the benefit? The latest version of my C2P based screen update routine is already running at about 30fps on an 060....isn't that fast enough

No, it's much better for me to spend my limited time on other things, like adding support for more games, doing an RTG port etc.

Last edited by NovaCoder; 29 November 2010 at 23:58.
NovaCoder is offline  
Old 29 November 2010, 23:55   #16
DDNI
Targ Explorer

DDNI's Avatar
 
Join Date: Mar 2006
Location: Northern Ireland
Age: 46
Posts: 5,270
Send a message via ICQ to DDNI Send a message via MSN to DDNI
I tried the ctrl f and ctrl g options. The game flew! Characters sprinting across the screen!
DDNI is offline  
Old 29 November 2010, 23:56   #17
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,881
Next version is better, hold on to your hat DDNI
NovaCoder is offline  
Old 29 November 2010, 23:57   #18
DDNI
Targ Explorer

DDNI's Avatar
 
Join Date: Mar 2006
Location: Northern Ireland
Age: 46
Posts: 5,270
Send a message via ICQ to DDNI Send a message via MSN to DDNI
lol
DDNI is offline  
Old 30 November 2010, 21:09   #19
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 44
Posts: 3,091
Quote:
Originally Posted by NovaCoder View Post
and what would be the benefit? The latest version of my C2P based screen update routine is already running at about 30fps on an 060....isn't that fast enough
Well, no, it's not fast enough On a '030 it's even worse Joking aside, I'll tell you the benefits:

1) The games will run better on a wider range of CPUs.
2) The graphics can be color reduced for non AGA (Monkey Island 1 and 2, for example).
3) With everything in planar format you can spend more cycles on getting higher quality audio.

Those are really the reasons why I wanted to know how feasible this is.
Thorham is offline  
Old 30 November 2010, 23:36   #20
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,881
I'm planning on releasing the full source-code so anyone is welcome to try and make it faster

Last edited by NovaCoder; 30 November 2010 at 23:50.
NovaCoder 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
BPLxMOD for interleaved bitmaps phx Coders. Asm / Hardware 12 02 June 2012 22:47
A600 4mb Fastram + A1200 Mb Fastram mikele MarketPlace 7 07 May 2012 19:28
Bitmaps Brothers Djay request.Old Rare Games 22 23 November 2003 21:18
KOCH to publish new Bitmaps RTS LaundroMat Amiga scene 1 17 January 2003 17:36

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 14:49.


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