03 November 2010, 00:58 | #1 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
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 |
03 November 2010, 03:50 | #2 |
Ya' like it Retr0?
Join Date: Jul 2005
Location: United Kingdom
Age: 49
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 |
03 November 2010, 05:07 | #3 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
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.
|
25 November 2010, 06:57 | #4 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
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); } |
25 November 2010, 17:55 | #5 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,749
|
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.
|
28 November 2010, 02:51 | #6 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
Nope, no way in a cold hell is there any chance for me to convert them all
|
28 November 2010, 16:39 | #7 |
Ya' like it Retr0?
Join Date: Jul 2005
Location: United Kingdom
Age: 49
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 |
28 November 2010, 23:45 | #8 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
|
29 November 2010, 00:30 | #9 |
Targ Explorer
|
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?
|
29 November 2010, 00:46 | #10 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
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.
|
29 November 2010, 08:50 | #11 |
Targ Explorer
|
@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. |
29 November 2010, 10:32 | #12 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
It's ok guys, I know my efforts are appreciated around here
|
29 November 2010, 17:29 | #13 | |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Quote:
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. |
|
29 November 2010, 18:51 | #14 | |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,749
|
Quote:
Do you think it would be hard to write an extraction tool from scratch (not asking if you'd like to do it )? |
|
29 November 2010, 23:48 | #15 | |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
Quote:
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. |
|
29 November 2010, 23:55 | #16 |
Targ Explorer
|
I tried the ctrl f and ctrl g options. The game flew! Characters sprinting across the screen!
|
29 November 2010, 23:56 | #17 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
Next version is better, hold on to your hat DDNI
|
29 November 2010, 23:57 | #18 |
Targ Explorer
|
lol
|
30 November 2010, 21:09 | #19 | |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,749
|
Quote:
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. |
|
30 November 2010, 23:36 | #20 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
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. |
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 |
|
|