Skip to main content
gamedev.net
🔒 Locked

Vertex buffer lock returns null

Started by shkin00 5 replies 1.5k views
Original Post
shkin00
shkin00
Hello all

I'm developing an app that is used by ~500 users, and got some bugreports recently from different machines with different GPUs. All of them are about strange behavior of VertexBuffer9.Lock(DISCARD) function - it returns NULL pointer. I've no idea how to reproduce this bug and how to solve it :(

Any ideas what's the problem?

Cheers,
shkin00
Evil Steve
Evil Steve
Are you checking the return value of Lock() to make sure it's not FAILED()? How frequently are you locking the vertex buffer? More than once per frame? How many times with DISCARD per frame?
shkin00
shkin00
Hello Evil Steve

I'm locking it ~50-100 times per frame, 1 DISCARD per 20-30 NOOVERWRITEs.
Lock() always returns S_OK.

Cheers,
shkin00
Evil Steve
Evil Steve
Quote:
Original post by shkin00
I'm locking it ~50-100 times per frame, 1 DISCARD per 20-30 NOOVERWRITEs.
Lock() always returns S_OK.
It sounds like a driver bug that's causing it to return S_OK, but in any case, locking one buffer that many times per frame is probably a bad idea - although technically there's nothing wrong with it that I know of.
Are you able to change your code to only do a single NOOVERWRITE lock per frame?
21st Century Moose
21st Century Moose
Are you specifying a range when you lock with discard? Note from the SDK:
Quote:
Note that locking a buffer with D3DLOCK_DISCARD always discards the entire buffer, specifying a nonzero offset or limited size field does not preserve information in unlocked areas of the buffer.
So if this is the case, then maybe there is a spec conformance problem.
Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
shkin00
shkin00
Quote:
Original post by Evil Steve
Are you able to change your code to only do a single NOOVERWRITE lock per frame?


I'll try to minimize NOOVERWRITE locks, hope it'll help. Thank you for this suggestion :)

Cheers,
shkin00
shkin00
shkin00
Quote:
Original post by mhagain
Are you specifying a range when you lock with discard? Note from the SDK:
Quote:
Note that locking a buffer with D3DLOCK_DISCARD always discards the entire buffer, specifying a nonzero offset or limited size field does not preserve information in unlocked areas of the buffer.
So if this is the case, then maybe there is a spec conformance problem.


Never tried DISCARD locks with ranges :)
Here's my code:
Lock(0, 0, &pBytes, D3DLOCK_DISCARD)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.