Jump to content
  • Advertisement
Sign in to follow this  
Malder1

Windows crashes when I use dynamic textures with D3DLOCK_DISCARD flag

This topic is 4830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've wrote simple test using DirectX 8.1 headers to test how dynamic textures works. I've created windowed application, 512x512 one D3DFMT_A8R8G8B8 D3DPOOL_DEFAULT and D3DUSAGE_DYNAMIC texture. Cycle for 100 times, and LockRect/UnLockRect As SDK says I need to use D3DLOCK_DISCARD flag in LockRect. And then I added this flag, my Windows XP SP2 falled to BSOD with restarting and damaging of all files of the project. This test also freezed Windows 2000. So if I correctly wrote my test, I assume that WE SHOULD NOT use D3DLOCK_DISCARD flag. By the way, as SDK says this option means DMA access to texture.

Share this post


Link to post
Share on other sites
Advertisement
That's definitely a driver and/or runtime bug. Win2K/XP drivers should never cause BSOD, even if you abuse them. Create the smallest application possible that reproduces it, test it on different cards/drivers, and mail the IHVs in question the repro + a bug report. And cc directx@microsoft.com.

Share this post


Link to post
Share on other sites

One thing to check for in your own code is accidentally writing outside the boundaries of the locked texture - writing past the end of the memory returned from the Lock(), writing before the beginning of the memory returned from the Lock(), and not paying attention to the Pitch of the memory returned from the Lock().

You'll be able to check that when making the repro application to send to MS and the IHV. If you find you can't get your repro app to cause the same problem, then I'd check for out of range memory writes.

A short amount out of range and a long amount out of range should be fairly easily trappable by the driver, but some medium range writes might go unmissed.

Share this post


Link to post
Share on other sites
Thank you for the response!

Unfortunately this problem easily repeats on 3 different PCs Athlon XP 1600, Athlon XP 1700, Athlon 64 3000, with Windows XP SP2 and Windows 2000 SP3. NVIDIA GeForce 4 Ti 4200, GeForce 2 Ti, GeForce 6800. Different ForceWare drivers.

I've uploaded this test with source code to our web site:
http://www.wnsoft.com/test/DynamicTexturesProblem.zip (900 KB)

When you press the button, it will crash your Windows to BSOD with error in NV4_DISP.DLL (I know it's NVIDIA's DLL).

Also we're programming in Borland Delphi 7 (Pascal), because of this I'm afraid it will difficult to solve this problem.

----------------
1) Initialize windowed 512x512 Direct3D 8.1 mode (we use 8.1 because WinXP supports it widely)
2) I create 512x512 D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT texture
3) LockRect with D3DLOCK_DISCARD, fill the texture, UnLockRect
(Then I click "Button1")
4) Call again LockRect with D3DLOCK_DISCARD and I can fill texture or leave empy code and call immediately UnLockRect - it doesn't matter - p.4 crashes Windows.
So I'm sure that no out of bounds situation, because even if I do nothing between LockRect/UnLockRect it crashes Windows however.
(If I remove D3DLOCK_DISCARD flag, all works fine.)
----------------

Of course, it can be error in headers adapted to Delphi (Pascal), but besides dynamic textures all works fine and no other problem with Direct3D.

p.s. I've sent a copy of this letter to directx@microsoft.com

Thank you again!

[Edited by - Malder1 on August 26, 2005 1:30:51 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!