Texture profile being changed behind the scenes?
by ArchieMD User · in Torque 3D Professional · 01/26/2010 (6:57 pm) · 1 replies
I have a texture on which I call lock & unlock every frame.
Occasionally (say every 100 frames +- a bunch) acquiring the lock will fail. I temporarily removed the d3d9assert from the LockRect call, replacing it with
This allowed me to find another fun anomaly...
My texture is not defined as a render target, yet, every once in a while,
1) How could the texture profile change "on it's own" (I'm not modifying it)
2) What's up with locks in Torque? I'm only locking at a time when nothing else should be writing to it or even reading it (in prepRender). Even when the lock fails, the "locked rect" data structure written to by LockRect is valid (it should be NULL according to D3D specs)
3) D3D specs say locking should (only?) be used on Dynamic textures. If I declare a Dynamic texture in Torque, locking it will FAIL every time. It has to be Static in order for locking to succeed the majority of the time.
Can someone explain what's going on here?
Occasionally (say every 100 frames +- a bunch) acquiring the lock will fail. I temporarily removed the d3d9assert from the LockRect call, replacing it with
HRESULT res = get2DTex()->LockRect(mipLevel, &mLockRect, inRect ? &r : NULL, 0);
if(res == D3D_OK)
mLocked = true;
else
{
return NULL;
mLocked = false;
}This allowed me to find another fun anomaly...
My texture is not defined as a render target, yet, every once in a while,
if( mProfile->isRenderTarget() )returns true, causing more stuff to get screwed up.
1) How could the texture profile change "on it's own" (I'm not modifying it)
2) What's up with locks in Torque? I'm only locking at a time when nothing else should be writing to it or even reading it (in prepRender). Even when the lock fails, the "locked rect" data structure written to by LockRect is valid (it should be NULL according to D3D specs)
3) D3D specs say locking should (only?) be used on Dynamic textures. If I declare a Dynamic texture in Torque, locking it will FAIL every time. It has to be Static in order for locking to succeed the majority of the time.
Can someone explain what's going on here?
Torque 3D Owner ArchieMD User
ArchieMD
I'm talking about locking in
Another problem, even if lockRect fails, you're still setting
, which would crash the subsequent unlock call (if the assert didn't already cause it to crash).