Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am working on a Direct3D rendering application that uses a lot of texture RAM. I notice that if I allocate a Pool.Default volume texture:

   _texture = new VolumeTexture(device, size.Width, size.Height, size.Depth, 1, Usage.None, Format.L16, Pool.Default);

my process's system memory decreases by the same amount I allocate on the video card. I think this is unexpected. This texture is supposed to be video-memory only.

Effectively this means I can not use all texture RAM on high end video cards, I can not afford to lose a whole gigabyte of system RAM. We're short on adress space as it is....

Is there anybody who knows what's happening here? Are there ways to prevent this from happening?

This was seen on Windows 7 64 bit from a 32 bit process, using Directx 9c, with several different nVidia cards. The process is marked as /LARGEADRESSAWARE to make sure we get as much as adress space as possible.

You may have guessed by now that I am not writing a game.... but I assume the Direct3D experts are here to be found.... And I can imagine this issue affects games as much as it affects us...

EDIT:

This appears to happen only with Volume Textures. If I allocate 2D textures of the same size it does not happen. By default my volume textures were 32megabytes each. If I make them smaller (I tried down to 2megabytes each), There are still blocks being allocated. According to VMMap, each texture gets a 32 meg block in my process, flagged as "Read/Write/WriteCombine".

The fact that they are labeled as "WriteCombine" makes me really curious, no other block of memory is labeled like that.

share|improve this question
    
This is indeed unexpected. I'm curious, are you preloading the texture at a later stage? Or simply using it completely empty? –  Michael Kissner Sep 17 '11 at 22:08
    
That code appears to be C#; are you using Managed DirectX or SlimDX (and if the former, are you aware that the API is deprecated)? –  Josh Petrie Sep 17 '11 at 23:34
    
Does this only happen with volume textures? –  Adam Sep 18 '11 at 0:31
    
@josh: oh yeah, i am using slimdx. Should have included that. –  jdv-Jan de Vaan Sep 18 '11 at 9:20
    
@MichaelKissner: We are allocating blocks in advance in a standard format, and recycle them for different data. The memory pressure increases when I allocate it, and it never goes away. –  jdv-Jan de Vaan Sep 18 '11 at 10:14
show 2 more comments

1 Answer

Specifying the default pool does not instruct Direct3D to put the resource on the GPU. It instructs Direct3D to put the resource in the best pool for the usage you specified for the resource.

The task manager is a very poor way of measuring performance, in general. It's possible the allocation is transient and done by the D3D API in order to transfer some data to or from the card (as allocation of default pool resources can evict managed pool resources as needed to satisfy the request).

Also note that on Windows 7, you'll be using the WDDM which can virtualize GPU memory (although generally I think you shouldn't see issues with this unless you are using the *Ex variant of the device, which I don't believe Managed DirectX can create).

share|improve this answer
    
Thanks for the info. I am not relying solely on the task manager, i can see the allocated blocks also in vmmap (a sysinternals tool). –  jdv-Jan de Vaan Sep 18 '11 at 9:26
    
Okay good. SlimDX doesn't do any allocations (of note) in the VolumeTexture ctors either, so this must be something the native API is doing. I'm not sure why though. Have you considered asked on the DirectXDev mailing list? discussms.hosting.lsoft.com/SCRIPTS/WA-MSD.EXE?A0=DIRECTXDEV –  Josh Petrie Sep 18 '11 at 16:48
    
Thanks for the mailing list pointer. I will try that if I don't get any more answers here. This is the first forum where I took this issue so far. And thanks for SlimDX, by the way. –  jdv-Jan de Vaan Sep 18 '11 at 18:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.