Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

BeanDog

How to do fast ASM blt? -no asm xp

This topic is 6671 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You know, I am always reading things like, "Yeah, BltFast is the best unless you do the fast ASM blit." and such. Well, HOW DO YOU DO A FAST ASM BLIT? I''ve tried and it is REALLY slow! (Believe me, you don''t want to see my code) Please help me out, I need a really fast full-screen regular blit, no effects or anything. ~BenDilts( void );

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Seriously, what''s the point? What could you possibly be trying to do that BltFast isn''t fast enough? It''s fast enough for 99% of game developers.

Share this post


Link to post
Share on other sites
quote:
Original post by BeanDog

You know, I am always reading things like, "Yeah, BltFast is the best unless you do the fast ASM blit." and such. Well, HOW DO YOU DO A FAST ASM BLIT? I''ve tried and it is REALLY slow! (Believe me, you don''t want to see my code)

Please help me out, I need a really fast full-screen regular blit, no effects or anything.

~BenDilts( void );






Share this post


Link to post
Share on other sites
ASM Blits means that you copy pixels to the screen 32-bits at a time using only ASM registers - no references to memory except to where the bitmap is located and the video memory address (0xA0000000). I''m guessing you''re copying pixels to the screen ONE at a time, using something like REP MOVSB. You can copy four pixels at a time using REP MOVSD, for the B is for Byte, and the D is for Double Word. Processors these days can do both in the same amount of time, therefore quadrupling blitting speed.

-Ender Wiggin

Share this post


Link to post
Share on other sites
I''ve found the mmx instructions to be slightly faster (copy 8 bytes instead of 4). It depends a bit on the processor though. Also in DirectX your video memory address may not be 0xA0000000. You can only access the primary surface''s memory directly if you''re in exclusive mode (as far as I know). Otherwise you''ll have to blt to a client surface or some other secondary surface in video memory. If you need to get a pointer for something in video memory use Lock.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

"Yeah, BltFast is the best unless you do the fast ASM blit."



BeanDog,

Nothing is faster than a hardware blt (Bltfast), and asm IS software, no
matter how you slice it.

Share this post


Link to post
Share on other sites
Most cards don't support blting from system to video. So if the surface you want to copy from is in system memory it's faster to use asm.

Edited by - blue-lightning on June 17, 2000 10:47:59 AM

Share this post


Link to post
Share on other sites
Anonymous Poster : BltFast doesn''t always work in hardware btw, and certainly won''t be in hardware if, as possibly mentioned, the surface the guys wants to copy is in system memory. And furthermore, there''s nothing directx does that you can''t do with ASM anyway, even bltfast.

My personal advice:
Use bltfast if you are copying hardware->hardware memory.
Use ASM if you are copying system->hardware memory. Preferably with the MMX instructions (still they aren''t that much faster because of the 32-bit bus or something like that)

Share this post


Link to post
Share on other sites
Bltfast is damn slow for RAM->VRAM and RAM->RAM.
I''ve made some benchmarking here. Blitting 128x128 image, 1000 times RAM->RAM. Look the results:
BltFast : 270 ms
My MMX blit routine : 32 ms

The best thing to do is, write your own asm blitters, blit all sprites to an RAM back surface. After all done, you blit this back surface to the Ddraw primary surface located at VRAM.
John Carmack used this approach on Quake.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!