views:

257

answers:

2

Hi, guys, I am developing a tool drawing primitves with DX9 in my XP-32.

When create vertex buffer and index buffer, there could be some error of creation failed.

Return code could be D3DERR_OUTOFVIDEOMEMORY or E_OUTOFMEMORY.

I am not sure what the difference of them.

I use VideoMemory tool in DX sample to check the memory, and it reports 1024MB.

Does that mean if I create a bunch of managed resource more than 1024MB, it will report D3DERR_OUTOFVIDEOMEMORY?

If there is no more free virtual space memory in process and malloc fail, DX9 will report E_OUTOFMEMORY?

+1  A: 

D3DERR_OUTOFVIDEOMEMORY is a directx memory error...not necessarily related to video memory, it could memory occupied for holding a scene or drawing an image, as you have found out if there is not enough memory for your process you will get E_OUTOFMEMORY. The latter refers to the memory that is assigned to your process being exhausted. You did not say what operating system/hardware spec you have, best bet would be to look into getting a system memory upgrade if you're running low on resources..

Edit: Some laptops/netbooks have a graphics adapter that is 'fitted with system memory', ok these graphics cards are not serious for the likes of 'Beyond Call of Duty' and other top end games...the graphics card actually steal some memory from the main board thus inflating the amount of RAM that is available to the graphics controllers. They are fine if you are doing word processing/emailing and so on...but at the cost of the system ram which is gobbled by the controller a la 'Integrated graphics controller'...

Hope this helps, Best regards, Tom.

tommieb75
Thanks. My system is XP 32 bit with D3D9. From D3D Video Memory sample, it shows hMonitor Device Name: \\.\DISPLAY1 GetVideoMemoryViaDirectDraw dwAvailableVidMem: 627 MB (658096128) GetVideoMemoryViaDxDiag n/a GetVideoMemoryViaWMI dwAdapterRAM: 640 MB (671088640) GetVideoMemoryViaDXGI n/a GetVideoMemoryViaD3D9 dwAvailableTextureMem: 1109 MB (1162870784)
Buzz
When I create vertex/index buffer near 1109 MB, D3D will return E_OUTOFMEMORY error. But total process memory usage is only 1.3GB, not high.And when I try to lock a existed d3d buffer object to read its content under a critical memory environment where process already used 1.7GB, sometimes Lock will fail and report E_OUTOFMEMORY. It seems E_OUTOFMEMORY could happened in many situations. I am confused.
Buzz
+1  A: 

E_OUTOFMEMORY means that DirectX was unable to allocate (ie through malloc or new) the block of memory you requested.

D3DERR_OUTOFVIDEOMEMORY means that DirectX was unable to allocate (ie out of the pool of memory, either on the gfx card or reserved in main memory) the block of memory you requested.

Caveat: Drivers might lie.

Goz