stupid question,

BitBlt, StretchBlt apies are asynchronous or syncronous functions ? i mean, are thouse function executred by windows in a separate thread or the process wait for the return ? I quite sure is the second one..

thx B7
Posted on 2004-02-10 07:49:42 by Bit7
It strongly depends on your VGA and drivers. On GeForceX, it is asynchronious - and the thread that does the Blt is actually the GPU's thread :) But I've also seen bad nVidia drivers that don't do that by default. In all cases, the way BitBlt works shouldn't bother you at all - think of it as a regular API. The GPU will do its business the best way it can :)
Posted on 2004-02-10 11:15:21 by Ultrano
thx for the info ultrano, so you say it's really a matter of graphic board... And theres a way to detect if the job is done from GPU thread or not ?
Posted on 2004-02-10 14:33:14 by Bit7
I don't think there is. Does it matter though?
Posted on 2004-02-10 18:48:18 by Henk-Jan
Absolutely yes, there is. And it matters. At least for me, since I used it a lot.

1) Create a window with null_brush class style
2) In WndLoop of the window, in WM_PAINT, just do
invoke BeginPaint,hWnd,addr ps
invoke EndPaint,hWnd,addr ps
3) Create two DCs with 2 compatible bitmaps, 800x800 each. Let's say DC1 and DC2
Run in 32-bit mode preferrably.
4) Create a new thread, and in it:
4.1) invoke GetDC,hwnd
4.2) BitBlt from DC2 to DC1
4.3) BitBlt from DC1 to hdc
4.4) ReleaseDC,hwnd,hdc
4.5) Sleep, 20

use System Monitor to see what the cpu usage is. If your BitBlt is done in hardware, then the cpu usage should be less than 20%. Actually with me it's less than 3%. I have a 450MHz K6-2, you may need to calculate the cpu percentage threshold for your cpu speed.
Experience matters, not only what one has read anywhere.
Posted on 2004-02-11 00:39:08 by Ultrano
thx ultrano, that's will be a nice test.
I really needo to know it, since in 35 msec i have to do many things, then reloop, and if BitBlt is synchronous or asyncronous will change the issue.

The problem is that i have to put the hands in otrher guy sw. Anyway, now i see that the functions used to draw are:
DrawDibBegin
DrawDibDraw
StretchDIBBits
I will do the test anyway.

Thx.
Posted on 2004-02-11 01:27:53 by Bit7
I thought he meant if there was a programmatical way to check.
Posted on 2004-02-11 05:23:46 by Henk-Jan