Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / General Programming / DirectX blitting speed Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
Jan Niestadt

July 30, 1999, 06:29 AM

Hi everyone,

I'm just toying around with a prototype for a simple 2D tile-based game using DirectX.
I was wondering what's the fastest way to blit tiles to the screen.. Currently I just use
the Blt function (BltFast is only 10-20% faster and only when using the HEL). All my tiles
are in separate surfaces.

The demo I have written runs fine in 16-bit fullscreen or windowed mode, but 32-bit windowed
mode runs unbearably slow. Of course, twice the data are transferred in this mode..
But I tried running Jazz Jackrabbit 2 shareware ( in 32-bit windowed
mode and it runs as smooth as can be!

First I thought the Win16-lock had something to do with it (constantly locking/unlocking
surfaces) but I ruled that out by writing a function that locks the surfaces once and blits
tiles by manually memcpy'ing the data between the two buffers; this runs very slow in all
modes, so the Win16 lock obviously isn't the limiting factor..

I am obviously missing something here.. Does anyone know how to speed things up in 32-bit mode?

Jan Niestadt

July 30, 1999, 06:55 AM

>>The demo I have written runs fine in 16-bit fullscreen or windowed mode, but 32-bit windowed
>>mode runs unbearably slow.

Okay, that was fast. Problem solved. Looking back, I should've realized this:

I had my desktop in 1024x768 resolution with 32bpp. So my primary surface was 1024x768x4 =
over 3 Megs.. I also had a backbuffer of 640x480x4.. over 1 Meg. Now if you know that my video
card has 4 Mb RAM you will get the picture: my backbuffer was created in system memory
because there wasn't any room in video memory; my tiles however were small and could still fit
in video mem. So my demo was happily blitting tiles from vidmem to my backbuffer in sysmem.
Not surprising it was slow.

I guess everyone makes this mistake once.. maybe someone who hasn't yet will read this and be warned!

This thread contains 2 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.