Sign in to follow this  

Freezing problem

This topic is 4711 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 have a managed DX9.0c program that, on some systems (seemingly those with worse video cards, but I haven't tested enough to be sure of that), freezes on reaching this line: ib=new IndexBuffer(typeof(int),indices.Length,device,Usage.WriteOnly,Pool.Default); Doesn't throw an exception or anything, the program just stops responding (if I terminate the program, the debugger tells me there was an AccessViolationException). I know for certain that indices.Length and device are both the right values. The size of the index buffer is less than 100, which seems like a small size to me. My guess would be that it has to do with the Usage and Pool values, but I don't really know what to change. Any ideas what I'm doing wrong?

Share this post


Link to post
Share on other sites
Quote:
seemingly those with worse video cards

Care do define "worse"? are we talking the old 4mb jobs from years and years ago, or are we talking about last years model?

Any correlation in what hardware fails (e.g. all of a certain chipset/manufacturer/driver)?

Quote:
My guess would be that it has to do with the Usage and Pool values

I'm not aware of these two parameters being particularly dependent on hardware/driver support. For the most part they're more of a hint to the device so that it can more optimally arrange the data in memory for later use.

Have you tried changing them around? Seeing if different combinations work?

You mention an AccessViolationException, I'm no managed code guru, but depending on what the documentation says I'd read that as meaning you have a problem with the memory somewhere. That is, maybe internally it's having problems allocating this buffer and/or the driver is tripping over somewhere. Might not actually be your applications fault..

hth
Jack

Share this post


Link to post
Share on other sites
By worse, I basically meant the sort of bargain jobs they put into computers that aren't really meant for gaming. It happens on my roommate's machine, which has an ATI radeon eighty-something-hundred (8500 maybe?). Works fine on my radeon 9600 mobile, and there's a couple people with X800 cards and really good machines that have an entirely different class of problems with it.

I did try a bunch of combinations of Usage and Pool, though there are more possible combinations than I could possibly test. I used the ones that seemed most reasonable based on the docs.

If it's just a Manged DirectX thing, I suppose I can try doing this without the index buffer and just take the performance hit.

Share this post


Link to post
Share on other sites
hmm, well I'd be amazed if the cards you listed had problems with index buffers, makes me inclined to think that its something else thats going wrong that's not showing itself until this piece of code.

Have you tried upgrading the various drivers and libraries - see if (at least the older cards) are showing drivers bugs?

Also, have you tried using the debug runtimes and ramped up the debug output? you might well get some hints from the runtime as to something it doesn't like.


Quote:
If it's just a Manged DirectX thing, I suppose I can try doing this without the index buffer and just take the performance hit.

I strongly suggest you look a bit further into this issue - if you're getting sporadic unexplained errors across a variety of platforms then you might well hit a similar problem later on. Solving it now could be beneficial in the long run...

hth
Jack

Share this post


Link to post
Share on other sites
Solved it. Sorry to bump this, but just so this thread contains a solution if anyone else has the same problem and goes searching for it:

After quite a lot of debugging, I finally determined there were two problems: one, I had specified the wrong maximum number of vertices to the vertex buffer (I don't know why that caused a freeze on the line it did, at all). Two, some video cards do not like 32 indices, and should be given 16 bit ones instead. 16 bits are more than enough for what I'm doing, so that's okay.

Share this post


Link to post
Share on other sites
Quote:
Original post by _Flecko
Two, some video cards do not like 32 indices, and should be given 16 bit ones instead. 16 bits are more than enough for what I'm doing, so that's okay.


Just check the MaxVertexIndex member of the D3DCAPS9 structure. If it's value is greater than 0x0000FFFF, 32-bit indices are supported.

Share this post


Link to post
Share on other sites
Quote:
Just check the MaxVertexIndex member of the D3DCAPS9 structure. If it's value is greater than 0x0000FFFF, 32-bit indices are supported.

I don't have the right documentation/tools to hand, but you also check for device support of D3DFMT_INDEX32 and D3DRTYPE_INDEXBUFFER using IDirect3D9::CheckDeviceFormat( ).

hth
Jack

Share this post


Link to post
Share on other sites

This topic is 4711 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this