Re: Windows crashes when I use dynamic textures with D3DLOCK_DISCARD f
- From: "Alexander Gräf" <Graef@xxxxxxxxxxxxxxxx>
- Date: Sun, 28 Aug 2005 21:27:39 +0200
"Igor Kokarev" <IgorKokarev@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im
Newsbeitrag news:0F78F019-8F3E-4377-94FA-74656A398B5B@xxxxxxxxxxxxxxxx
> So if I correctly wrote my test, I assume that WE SHOULD NOT use
> D3DLOCK_DISCARD flag for stability reasons. By the way, as SDK says this
> option means DMA access to texture.
No, "we" *should* use D3DLOCK_DISCARD for performance reasons and for
dynamic textures. Please update your SDK, your DirectX-version and your
display drivers to a more recent version. I'm using dynamic textures:
=============================
HRESULT hr;
// Create the texture
hr=pDevice->CreateTexture(
uiWidth, // Width of the textures
uiHeight, // Height of the texture
1, // Number of levels
D3DUSAGE_DYNAMIC, // Usage of the texture
FormatProvider::D3DFormat, // Format of the texture
D3DPOOL_DEFAULT, // Memory pool
&m_pTexture, // ptr to returned texture
NULL); // Reserved
if (FAILED(hr)) return hr;
D3DLOCKED_RECT d3dLockedRect;
hr=m_pTexture->LockRect(0, &d3dLockedRect, NULL, D3DLOCK_DISCARD);
if (FAILED(hr)) return hr;
// ... write to texture buffer goes here
hr=m_pTexture->UnlockRect(0);
if (FAILED(hr)) return hr;
// ... rendering with new texture goes here
=============================
.... and they work stable and fast. The D3DLOCK_DISCARD flag tells DirectX,
"you can stick with rendering the texture, simply give me a new, empty one
so I can write down my image". This allows you to write the texture buffer
and render it at the same time, without collisions. Without that flag, your
request for locking would have to wait until the graphic card has finished
using the texture for rendering. Drawback: Higher memory consumption, no
partial locking (!!!).
Regards, Alexander Gräf
.
- Follow-Ups:
- Re: Windows crashes when I use dynamic textures with D3DLOCK_DISCA
- From: Igor Kokarev
- Re: Windows crashes when I use dynamic textures with D3DLOCK_DISCA
- References:
- Windows crashes when I use dynamic textures with D3DLOCK_DISCARD f
- From: Igor Kokarev
- Windows crashes when I use dynamic textures with D3DLOCK_DISCARD f
- Prev by Date: Tearing in Direct3D with TFT/LCD-Display
- Next by Date: Re: Windows crashes when I use dynamic textures with D3DLOCK_DISCA
- Previous by thread: Windows crashes when I use dynamic textures with D3DLOCK_DISCARD f
- Next by thread: Re: Windows crashes when I use dynamic textures with D3DLOCK_DISCA
- Index(es):
Relevant Pages
|
Loading