Game Development Community

[Fixed] Direct3D9 error got me stumped

by Joshua Leeming · in Torque 3D Professional · 12/05/2012 (11:57 pm) · 3 replies

Hi all,

I'm currently trying to track down an issue whereby I get:

Direct3D9: (ERROR) :Lock is not supported for textures allocated with POOL_DEFAULT unless they are marked D3DUSAGE_DYNAMIC.

It's not occurring when I use the executable in the full or empty templates, and I can use it to run the afx demo no problems.

However it occurs when I use it as part of another project I'm working on, and only when I get Cur. D3DDevice ref count=2 instead of ref=1 (which is every time for this project)

Throwing it out to the community hoping for any ideas

Attempting to create GFX device: NVIDIA GeForce GT 330M (D3D9)
Device created, setting adapter and enumerating modes
   Cur. D3DDevice ref count=2

All projects pick up the same devices:

GFX Init:
   Direct 3D (version 9.x) device found
   Direct 3D (version 9.x) device found
   Direct 3D (version 9.x) device found
   Null device found

card info:

Attempting to create GFX device: NVIDIA GeForce GT 330M (D3D9)
Device created, setting adapter and enumerating modes
   Cur. D3DDevice ref count=1
   Pix version detected: 3.000000
   Vert version detected: 3.000000
   Maximum number of simultaneous samplers: 16
   Number of simultaneous render targets: 4
   Hardware occlusion query detected: Yes
   Using Direct3D9Ex: No
WMIVideoInfo: DxDiag initialized
Initializing GFXCardProfiler (D3D9)
   o Chipset : 'GeForce GT 330M'
   o Card    : 'GeForce GT 330M'
   o Version : '8.16.0011.8880'
   - Scanning card capabilities...
GFXCardProfiler (D3D9) - Setting capability 'autoMipMapLevel' to 1.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureWidth' to 8192.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureHeight' to 8192.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureSize' to 8192.
GFXCardProfiler (D3D9) - Setting capability 'lerpDetailBlend' to 1.
GFXCardProfiler (D3D9) - Setting capability 'fourStageDetailBlend' to 1.
   - Loading card profiles...
      - Loaded card profile core/profile/D3D9.cs
      - No card profile core/profile/D3D9.GeForceGT330M.cs exists
      - No card profile core/profile/D3D9.GeForceGT330M.GeForceGT330M.cs exists
      - No card profile core/profile/D3D9.GeForceGT330M.GeForceGT330M.81600118880.cs exists



EDIT: After numerous other 'oddities' with my machine such as skype crashing whenever I received video, I did a full refresh - problem has resolved itself.

#1
12/06/2012 (7:31 am)
Are you creating 2 rendering devices on purpose? It sounds like you maybe getting an error because of that. I know the docs say if you create 2 devices from a single DX object that you can get extreme performance issues so maybe it can cause other issues too.
#2
12/06/2012 (1:58 pm)
Hi Tim, not on purpose no which is the frustrating part.

I only have the one call to createCanvas in this project:

function createCanvas()
{
   // Don't duplicate the canvas.
   if(isObject(Canvas))
   {
      error("Cannot instantiate more than one canvas!");
      return;
   }     
   return new GuiCanvas(Canvas);
}

Maybe I could put a check/assert into the code somewhere
#3
12/06/2012 (4:28 pm)
Yeah I would try debugging the C++ function that creates the device and see if why it's being called twice.