Jump to content

Photo

The Blitter Trick?


21 replies to this topic

#1 DrTypo OFFLINE  

DrTypo

    Star Raider

  • 96 posts
  • Location:Paris, France

Posted Thu May 17, 2012 5:15 PM

Hello,

JagChris PM'ed me about a tidbit of information. He quoted BattleSphere developpers about a "Blitter Trick" that can speed things up quite of bit:

Our little Blitter Trick™ has insured that even with lots of explosions going off at once, the framerate is really high. We're quite proud of this little 'hack' we came up with.


Apparently, Crazyace and Chilly Willy have an inkling:

I read that as reading the object processor ram using the blitter, and maybe using the mechanism for the 1/2 line switch to switch the linebuffer twice in a frame - this would effectively half the vertical resolution by duplicating the previous lines display , and by having no OP drawing in the 2nd line there would be much more b/w for blitter trickery


Does anyone have some insight on this? What is this about?

Thanks.

#2 Chilly Willy OFFLINE  

Chilly Willy

    Dragonstomper

  • 747 posts
  • Location:The Land of Enchantment

Posted Thu May 17, 2012 10:45 PM

Yeah, I told JagChris that if you repeated the line from the buffer, you have two savings: the first is that the display is half as tall (100 instead of 200, for example, where each display line actually occupies two TV scanlines), so you only have to render half as much data per screen; second, the OP is only fetching data on every other line, leaving more bandwidth for other things, like the blitter. So that's my guess behind the "blitter trick". Anyone used to the A8 platform and the way certain modes reuse data from the internal buffer rather than fetching more data would probably think of this. I did something similar on the 32X for my last version of Yeti3D - I used the line table to repeat every other line to make the display 112 lines tall, meaning I only had to render half the display. That really improved the performance of Yeti3D considerably.

#3 LinkoVitch OFFLINE  

LinkoVitch

    River Patroller

  • 2,575 posts
  • Location:Manchester UK

Posted Fri May 18, 2012 4:07 AM

If you have free GPU RAM, you can use it to hold your source blit data. So read the image from GPU RAM and blit to main RAM, this does actually give you quite a speed boost in my testing with it. It also has the added benefit of making ZeroSquare cry :D

Of course you only have 4K of GPU RAM to use, if you are using the GPU, less than that too... Unless your generating stuff to be blitted by the GPU and then pasting it to main RAM with the blitter..

#4 DrTypo OFFLINE  

DrTypo

    Star Raider

  • Topic Starter
  • 96 posts
  • Location:Paris, France

Posted Fri May 18, 2012 8:54 AM

Thanks for the feedback.
It's clearly not about cutting vertical resolution in half.
I'll duplicate the whole quote from the dev diaries that JagChris provided:

Latest cut of Battlesphere™ is running just fine. Framerate is indeed up, thanks to the special hardware 'hack' devised by Scott and Myself. Nobody has thought of this little ditty before... it's too COOL! For what it's worth, this little trick would have easily made DOOM a 320x240 game at 20-30fps all the time.. This game is running so smooth now. Things are shaping up nice...

... in the 25-30fps just about all the time. Sure, flood the screen with ships, debris, explosions, and shots and we're down to 15 or so, but man does this thing haul... Heh heh, no one's gonna figure out the little magic trick it took to make that one happen.... Reminds me of the olden days of 800 programming where there things you could make the hardware do that the designers never dreamed of. This is so cool.

Framerate is stilll very high. We run constantly over 20FPS, usually between 30-60fps, depending on the amount of action onscreen. Our little Blitter Trick™ has insured that even with lots of explosions going off at once, the framerate is really high. We're quite proud of this little 'hack' we came up with. It really works!! Not that we were anything but screaming fast before... the load management going on between the processors by our custom engines is no slouch. It's also 'generic' enough that we'll re-use most of it for our next Jag title.


(bolded by JagChris)

I guess it's more something like using GPU RAM to cache data. Something that improves blitter performance.
Well maybe someone will figure this out again... or not.

#5 LinkoVitch OFFLINE  

LinkoVitch

    River Patroller

  • 2,575 posts
  • Location:Manchester UK

Posted Fri May 18, 2012 9:05 AM

Heh heh, no one's gonna figure out the little magic trick it took to make that one happen....


Things like that really get my back up. It is effectively like saying "heh everyone else is a complete idiot, only we have any brains, go us, we're awesome".

I am all for people discovering cool stuff and being pleased with themselves, but massive self gratification like that winds me up. If I ever do that by all means bitchslap me! :)

Back on topic, I do recall reading somewhere that for T2K apparently Mr Minter ran the Blitter backwards to get some of the effects or performance he used for that. Apparently he wasn't supposed to be able to do that, or it wasn't supposed to work, but it did. I could be blowing hot air, but I am sure I read that, possibly on here too, but it was many many years ago.

#6 Gaztee OFFLINE  

Gaztee

    Stargunner

  • 1,731 posts
  • Location:Birmingham, UK

Posted Fri May 18, 2012 9:39 AM

How can you trade mark a Blitter Trick?? Sure doesn't mind blowing his own trumpet, maybe he doubles as Ron Jermey's Cock, another big tool! :? And Link yeah you'd get a size 11 up yer ass, or more likely, get the your Mrs to beat you up :-D

#7 Zerosquare OFFLINE  

Zerosquare

    River Patroller

  • 2,740 posts
  • Location:France

Posted Fri May 18, 2012 9:40 AM

Anything claimed by the authors of Battlesphere should be taken not with a grain of salt, but with a whole salt shaker. They've been known to spread hype or plain wrong "facts" in the past to make themselves look good.

Back on topic, I do recall reading somewhere that for T2K apparently Mr Minter ran the Blitter backwards to get some of the effects or performance he used for that. Apparently he wasn't supposed to be able to do that, or it wasn't supposed to work, but it did. I could be blowing hot air, but I am sure I read that, possibly on here too, but it was many many years ago.

No you're right, I recall reading that as well. I think it's related to the "pixel shatter" zoom effect (e.g., the "Excellent !" banners). Usually, when doing a zoom, you read non-adjacent pixels (for example, for a 0.5x zoom, you'd read every other pixel, both horizontally and vertically) but write the pixels next to each other. If you do the reverse, you get the "shatter" effect, which is pretty much like a zoom except every source pixel is only written once, so there's hollow space between pixels when the zoom factor is larger than 1. It's a neat effect and trick :)

#8 LinkoVitch OFFLINE  

LinkoVitch

    River Patroller

  • 2,575 posts
  • Location:Manchester UK

Posted Fri May 18, 2012 10:29 AM

Ahh, thanks for that Zero, that makes a lot of sense!

#9 Atari_Owl OFFLINE  

Atari_Owl

    Stargunner

  • 1,010 posts

Posted Fri May 18, 2012 10:33 AM

I seem to remember the Tech ref actually suggests that a rotation can be done with the blitter by going from a block of adjacent pixels to non adjacent pixels obviously this is likely to leave holes if there is not a size reduction A2->A1 (or is it vice versa.. its been a while since i thought about it)

It can run A2-> A1 or A1->A2 anyway

Maybe MInter was responsible for that?


OH and yes of course a GPU RAM cache substantially improves blitting speed

Edited by Atari_Owl, Fri May 18, 2012 10:40 AM.


#10 JagChris OFFLINE  

JagChris

    River Patroller

  • 3,601 posts
  • Location:Oregon

Posted Fri May 18, 2012 12:59 PM

Has anyone tried the type of technique/trick suggested by Chilly Willy on the Jaguar?

#11 JagChris OFFLINE  

JagChris

    River Patroller

  • 3,601 posts
  • Location:Oregon

Posted Fri May 18, 2012 1:09 PM

Anything claimed by the authors of Battlesphere should be taken not with a grain of salt, but with a whole salt shaker. They've been known to spread hype or plain wrong "facts" in the past to make themselves look good.


Perhaps. But we should keep an open mind about it and seriously look at it.


OH and yes of course a GPU RAM cache substantially improves blitting speed

If this suggestion or Chilly Willy's is able to make Doom run at 320x200 and 20-30fps fairly well then they would be likely candidates for what the trick is.

#12 Zerosquare OFFLINE  

Zerosquare

    River Patroller

  • 2,740 posts
  • Location:France

Posted Fri May 18, 2012 2:31 PM

Perhaps. But we should keep an open mind about it and seriously look at it.

Look into what, exactly? The statement basically boils down to "we've found a neat trick involving the blitter, but we're not telling what it is or what it does.". It's so vague that it could be anything ; for all we known, it may already have been done before or rediscovered since.

And about that "we"... should we assume that you've started coding for the Jaguar now? If so, congrats :)

Edited by Zerosquare, Fri May 18, 2012 2:34 PM.


#13 DrTypo OFFLINE  

DrTypo

    Star Raider

  • Topic Starter
  • 96 posts
  • Location:Paris, France

Posted Fri May 18, 2012 2:48 PM

If this suggestion or Chilly Willy's is able to make Doom run at 320x200 and 20-30fps fairly well then they would be likely candidates for what the trick is.


I don't think any of them is a candidate.
Chilly Willy's trick sure isn't since he's talking about cutting vertical resolution in half (display ~100 lines instead of ~200). So this is not about running Doom in 320x200. ;)
Using GPU RAM as a cache? I'm not sure. It is is mentionned in the Jag Underground Dox from 1997. So it was most likely already known when Battlesphere was in developpement.

Zerosquare's suggestion is a likely candidate. Anyway I'll try for time to time to torture the Blitter.
If I find something, I'll tell you all of course. I mean I'll say: "Behold my superior intelligence!!! I found the Blitter Trick!!! But I won't tell you what it's about!!! Your puny littlle human brains would never understand!!!" :-D

#14 JagChris OFFLINE  

JagChris

    River Patroller

  • 3,601 posts
  • Location:Oregon

Posted Fri May 18, 2012 2:50 PM

You could call it the Blitter Boost™ :)

#15 Zerosquare OFFLINE  

Zerosquare

    River Patroller

  • 2,740 posts
  • Location:France

Posted Fri May 18, 2012 3:18 PM

Using GPU RAM as a cache? I'm not sure. It is is mentionned in the Jag Underground Dox from 1997. So it was most likely already known when Battlesphere was in developpement.

I'm not even sure I'd call that a "trick"; it seems pretty straightforward to me, given that the GPU RAM is the fastest RAM there is.

Edited by Zerosquare, Fri May 18, 2012 3:18 PM.


#16 Gaztee OFFLINE  

Gaztee

    Stargunner

  • 1,731 posts
  • Location:Birmingham, UK

Posted Fri May 18, 2012 3:53 PM

Your puny littlle human brains would never understand!!!" :-D


Somebody has been watching too much Big Bang Theory :thumbsup:

#17 Chilly Willy OFFLINE  

Chilly Willy

    Dragonstomper

  • 747 posts
  • Location:The Land of Enchantment

Posted Fri May 18, 2012 5:41 PM

If this suggestion or Chilly Willy's is able to make Doom run at 320x200 and 20-30fps fairly well then they would be likely candidates for what the trick is.


I don't think any of them is a candidate.
Chilly Willy's trick sure isn't since he's talking about cutting vertical resolution in half (display ~100 lines instead of ~200). So this is not about running Doom in 320x200. ;)
Using GPU RAM as a cache? I'm not sure. It is is mentionned in the Jag Underground Dox from 1997. So it was most likely already known when Battlesphere was in developpement.


Well, it would be 320x200, but every other line would be a repeat of the previous. :-D

Between drawing half the data and freeing half the bandwidth to other things, it's clearly not the blitter trick because you'd get BETTER than what they claimed for Doom. ;)

As to using GPU ram for a cache, I don't see that as possible on a game like Doom where even the floor/ceiling textures are 4K to begin with. Forget about wall textures. So that's not a candidate for the Blitter Trick either.


Zerosquare's suggestion is a likely candidate.


No, that can't be it either or they wouldn't claim it would speed up Doom. Drawing every other pixel isn't going to help Doom any.


Anyway I'll try for time to time to torture the Blitter.
If I find something, I'll tell you all of course. I mean I'll say: "Behold my superior intelligence!!! I found the Blitter Trick!!! But I won't tell you what it's about!!! Your puny littlle human brains would never understand!!!" :-D


:grin:

EDIT: One thing I think maybe worth trying when I get around to it... Doom is primarily rendered as columns. That's not very fast on many systems, so turn it around - render Doom as ROWS at a 90 degree angle, then use the OP to flip it horizontal during display. Rendering rows with the blitter in Doom should be faster than rendering columns. However, that would make the OP use more bandwidth, so I'm not sure if the tradeoff is worth it.

Edited by Chilly Willy, Fri May 18, 2012 5:46 PM.


#18 Atari_Owl OFFLINE  

Atari_Owl

    Stargunner

  • 1,010 posts

Posted Fri May 18, 2012 6:22 PM

Theoretically one might render groups of 4 columns as rows to GPU ram and then blit that out as a column 4 pixels wide in phrase mode

I havent thought if there'd be much benefit to that

Hardly qualifies as a hack or really anything clever though

Edited by Atari_Owl, Fri May 18, 2012 6:26 PM.


#19 Chilly Willy OFFLINE  

Chilly Willy

    Dragonstomper

  • 747 posts
  • Location:The Land of Enchantment

Posted Fri May 18, 2012 10:31 PM

Yeah, there are all sorts of little things you can do, but I don't think we've covered anything that fits the post description. But like zerosquare said above, if/when it comes out, it's likely to be nothing. :)

#20 Atari_Owl OFFLINE  

Atari_Owl

    Stargunner

  • 1,010 posts

Posted Sat May 19, 2012 2:55 AM

I thinl i must have been really tiired when i posted that it wouldnt work anyway

#21 Atari_Owl OFFLINE  

Atari_Owl

    Stargunner

  • 1,010 posts

Posted Sat May 19, 2012 3:57 AM

it'd have to be blitted into the GPU as columns too, but thats ok as it would be in pixel mode anyway due to the scaling

#22 Chilly Willy OFFLINE  

Chilly Willy

    Dragonstomper

  • 747 posts
  • Location:The Land of Enchantment

Posted Sat May 19, 2012 11:30 AM

it'd have to be blitted into the GPU as columns too, but thats ok as it would be in pixel mode anyway due to the scaling


I like that idea - cache four columns so that they can all be blitted at once to ram using the fast copy mode. Even though you're still rendering one column at a time, it's faster to render it to gpu ram than to system ram. If you ran Doom at 240 height, four columns will only take about 2KB for 16-bit/cry mode.




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users