Lock() Texture bug due to video card limitation to 256*256 ?
Why in irrlicht 1.3-1.4 function lock() use only 0 level
Why in irrlicht 1.3-1.4 function lock() use only 0 level (first parametr in LockRect in DirectX mode) this could be the reason why we cant lock a texture of 512*512 with some wideo cards.
//! lock function
void* CD3D9Texture::lock()
{
if (!Texture)
return 0;
HRESULT hr;
D3DLOCKED_RECT rect;
if(!IsRenderTarget)
{
hr = Texture->LockRect(0, &rect, 0, 0);
}
else
{
D3DSURFACE_DESC desc;
Texture->GetLevelDesc(0, &desc);
...
...
...
}
if (FAILED(hr))
{
os:rinter::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
return 0;
}
return rect.pBits;
}
//! lock function
void* CD3D9Texture::lock()
{
if (!Texture)
return 0;
HRESULT hr;
D3DLOCKED_RECT rect;
if(!IsRenderTarget)
{
hr = Texture->LockRect(0, &rect, 0, 0);
}
else
{
D3DSURFACE_DESC desc;
Texture->GetLevelDesc(0, &desc);
...
...
...
}
if (FAILED(hr))
{
os:rinter::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
return 0;
}
return rect.pBits;
}
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Because the main texture is to be read and/or changed? I think that level 0 is the texture from which the mipmaps are generated (and stored in higher levels). But in this case the high detail texture is locked and accessed. This behavior has been this way for a very long time and seems to be reasonable.
Compile a debug version of your app. Follow the instructions in the DXSDK docs for enabling D3D Debug, go to DX control panel and enable D3D debug libs, crank the debug level up to max-1 and look at the debug output.
Irrlicht Demos: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=45781