Sign in to follow this  

Problem Creating Texture on Intel

This topic is 4077 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone, I am using D3DXCreateTexture to create textures for a 2D Game I am writing. when the game starts for the first time I try to allocate as much memory as I can in the Default Pool to determine the memory size, and set the default settings for the game. (i.e. high, medium, or low graphics details depending on the local video memory size). Now the code is working perfectly on all my machines. but when Tested on a laptop (having this video card: Intel(R) 82852/82855 GM/GME Graphics Controller 64MB, 8MB local and the others are non local AGP memory), in the test phase it allows me to allocate up to 37MB of textures. Code for that: --------------------------------------------------------- LPDIRECT3DTEXTURE8 pTexturesArray[1024]; // test to 1 GB video memory ZeroMemory(pTexturesArray,sizeof(pTexturesArray)); DWORD dwMemSize = 0,dwVerifiedMemSize = 0; for(int iIndex = 0; iIndex < 1024; iIndex++) { HRESULT hr = D3DXCreateTexture( pD3DDevice, 512, 512, 1, 0,D3DFMT_A8R8G8B8,D3DPOOL_DEFAULT ,&pTexturesArray[iIndex]); if(hr != D3D_OK) break; D3DSURFACE_DESC d3dSurfaceDesc; pTexturesArray[iIndex]->GetLevelDesc(0,&d3dSurfaceDesc); dwMemSize += d3dSurfaceDesc.Size; } for(int i = 0; i < iIndex; i++) SafeRelease(pTexturesArray[i]); --------------------------------------------------------- But when I run the game it fails to create the textures when I am above 18MB.(in the game I am Using Managed pool instead of Default pool, so I've added the managed pool to the test too). I even tried a code that fills those created textures while testing. and nothing changed. What do you think? anybody faced a similar problem? Thanks in advance for your help George Younes.

Share this post


Link to post
Share on other sites
What you're doing doesn't strike me as a particularly good idea. Direct3D is intentionally vague about how much VRAM available (check the GetAvailableTextureMem() function) as there is little guarantee as to how much you can use it.

Even under XP the GPU might be a shared resource (e.g. multiple windowed-mode applications) and its not too uncommon for the driver to be doing stuff behind the scenes that may not make sense to the application developer.

For IGP's like most (all?) of the Intel variants you may well not be using dedicated VRAM even if the marketing material says it is - it could be shared SysRAM for example. The fact that you can allocate almost exactly half of the detected amount in the managed pool might fit with this - D3D keeps at least a SysRAM "shadow" and possibly a real VRAM resource. If D3D is actually storing both copies then that conveniently matches up...

There isn't an easy way to do what you want - even if you use things like WMI or DDI to query the hardware you're bound to find numerous special/fringe cases like this.

hth
Jack

Share this post


Link to post
Share on other sites
Hy,
thanks for the reply, well I've fixed the problem by downloading the lastest driver from intel for that video card. well I am not using that GetAvailableTextureMem because it didnt make any sence on that intel machine. It always return 60MB free and it only lets me allocate 19MB. that's why I try to allocate as much as I can, then when the game starts it knows the limit of the memory.

Cheers,
George Younes.

Share this post


Link to post
Share on other sites
How much RAM is on that machine? Remember that the display RAM is taken from system RAM. It may be that you're running out of RAM. It's possible that the latest driver pre-allocated the RAM, which leaves less for other things, but leaves that RAM for 3D. Just a guess as to what may be happening.

Share this post


Link to post
Share on other sites

This topic is 4077 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this