Re: Windows crashes when I use dynamic textures with D3DLOCK_DISCARD f



"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


.



Relevant Pages

  • Re: FVF Problem: Can two textures use the same texture coordinates
    ... the FVF with D3DFVF_TEX1 flag but two textures in the same vertex? ... coordinate value, may I assign the second texture to use the first ... > your second texture stage to read from coordinate set 0... ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: FVF Problem: Can two textures use the same texture coordinates
    ... The FVF flags describe data in your vertex to D3D. ... your second texture stage to read from coordinate set 0... ... Is it possible or I must use the FVF with D3DFVF_TXT1 flag? ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Threading & LockRect?
    ... LockRect() to copy the bits to a Texture surface in "SystemMem". ... rendering with v-sync on to minimize tearing. ... I've tried the "NoSysLock" flag with no help. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: texture in contiguous memory filled by DMA
    ... D3DUSAGE_DYNAMIC flag for textures creation hints the driver that this one ... the pitch parameter when locking and filling the texture. ... Palettized textures have been dropped by IHVs for a while now. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: A 3D mesh and texture.
    ... No one does one texture per polygon. ... rendering use some sort of directVolume Renderingtechnique. ... quality iso-surfaces by means of direct volume rendering and I'm aware ... interpolation has to be applied. ...
    (comp.graphics.api.opengl)

Loading