hi there ;

sorry this is not a 100% win32asm question but i have a big problem with this :

I have a application written in Blitzbasic3d . (DX)
I load in this Game 2 Images an give the 2 MemoryPointer from the Images to a DLL.
In this DLL i copy these Images in ASM !

Now the Problem

If i read the Images i need 1600 ms

If i write the Images back i need 20 ms


I am shure the copyroutine is ok .

Other Coders have the same Problem in c++

I dont know why i have this big speed-differenz.

I gues the image's are in the Ram from my Graphicscart. (not shure)

But if so what can i do to make a faster Readaccess ?

any tricks in asm here ?

thx panno
(sorry for my poor english)
Posted on 2003-12-25 11:00:47 by Panno
Hi, Panno.
I'm not really experienced in 3D programming yet, but AFAIK you should NOT read video memory, just write to it. It is a limitation in the hardware, not your copy routines. For that reason, you should use an offline surface to do all of your drawing, and then blit it to the screen surface.
Hope that answers your questions. :)
Posted on 2003-12-26 11:38:31 by QvasiModo
Yes
Rule number 1 in modern video cards graphics:
NEVER NEVER NEVER read from video memory!

it is sad but it is true
Posted on 2003-12-26 14:56:51 by BogdanOntanu
thx @all

@bogdan : i must read,i must read, i must read ;)


ok thx for your reply's
Posted on 2003-12-27 04:01:48 by Panno
Why is that so?
Posted on 2003-12-27 04:10:17 by roticv
If your algo requires you to read from video memory, there's surely a better way to do it. ;)
Try to adapt your algo (or get a new one) so you don't have to read video memory.
Posted on 2003-12-27 12:46:28 by QvasiModo
You can NOT read because it is 100xslower and will make your application stand still
besides it will disturb video board's render pipeline (if you are also doing 3D)

If you need to read then make a backbuffer in system RAM, write your image/render to both video ram
and this backbuffer, but when reading read from this buffer instead :D

You could also use the ::Blt to read from video ram to video ram (but not to system ram).
And this way you can not access each individual pixel via ::Lock

Unless you intend to make your own video board there is no other solution.
And If there is i will sure like to hear about it :grin:
Posted on 2003-12-27 13:33:56 by BogdanOntanu
Like Bogdan said, reading VRAM forces both the CPU and GPU to serialize in other words the CPU will have to wait for the GPU to finish its operations before it can get the go ahead to access VRAM.
Posted on 2003-12-27 13:36:42 by x86asm
why i must reading


blitzbasic3d is my main programm and will always load images and textures in vram

i cant say : store images to sysram

ok no problem now i know the error in "my" source ;)

is the a way to stopped the gpu if i make a access ?
hm
Posted on 2003-12-27 14:27:12 by Panno

i cant say : store images to sysram


And why not?

use DDSCAPS_SYSTEMMEMORY when creating surfaces ...
Posted on 2003-12-27 14:51:48 by BogdanOntanu
create a back Buffer Surface, read/write to it and finally flip it to the primary surface (DirectX)
Posted on 2003-12-27 15:53:56 by wizzra
Dont know many things about DX ?

DX using with asm ? uhh sounds bad



Thx for replys
Posted on 2003-12-28 12:50:10 by Panno