Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411516 Posts in 69380 Topics- by 58436 Members - Latest Member: GlitchyPSI

May 01, 2024, 09:31:44 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)D3D9 problem (for you DirectX gurus out there)
Pages: [1]
Print
Author Topic: D3D9 problem (for you DirectX gurus out there)  (Read 1486 times)
Crimsontide
Level 5
*****


View Profile
« on: April 26, 2010, 10:04:39 PM »

I've been playing around with D3D9 and came across a peculiar problem. I was rendering a very simple test scene that was working fine, till I enabled z-buffering. With z buffering enabled the app refused to draw anything (but the device->Clear(...) seems to go through).

I loaded up PIX to see what was going on. Funny thing is, in PIX the render output is showing what I would expect to see. All device states are as they should be, all render calls/resources/ect... all work/are there, depth buffer is showing accurate depth values. In fact according to PIX it should work perfectly.

I googled everything I could think of in relation to z buffers and/or PIX and found nothing useful.

So my questions are, 1st is it normal for PIX output to differ from actual on-screen output? And any ideas what could cause enabling of z buffering to cause a model not to draw (a depth stencil surface was created, EnableAutoDepthStencil in D3DPRESENT_PARAMETERS is true, D3DRS_ZENABLE set to D3DZB_TRUE, D3DRS_ZFUNC set to D3DCMP_ALWAYS, double checked all device capabilities, viewport is set)?
Logged
Will Vale
Level 4
****



View Profile WWW
« Reply #1 on: April 27, 2010, 01:05:55 AM »

It sounds like you have most of the usual things covered. A couple of things you could try though:

* Are you using the debug or release D3D runtime? Try switching to the other one. (I imagine you're on release since PIX usually behaves badly for me with debug. Try turning up the debug output level too.

* Do you have any settings in your card vendor's control panel (i.e. not the Windows one) set differently to the defaults? Sometimes they mess with things.

* Are you using two video cards? (Crossfire/SLI) - sometimes that doesn't work as advertised.

* Are you clearing the depth buffer by passing 1.0 and the appropriate bit to Clear()?

* Have you got stencil enabled by mistake?

* Have you tried the reference rasterizer? (If you do, it helps to make the window much smaller so you don't have to wait ages for a frame to draw).

I don't know if that's an exhaustive list, but maybe it'll help. Best of luck!

Will

Logged
drChengele
Level 2
**


if (status = UNDER_ATTACK) launch_nukes();


View Profile
« Reply #2 on: April 27, 2010, 02:24:59 AM »

Will Vale covered most of what I wanted to say.

I haven't worked in PIX so I can't help you there, but if rendering fails even if you only have one model on screen, then it probably has something to do with the way you are calling your Clear() function.

Here's another thing: try setting D3DRS_ZWRITEENABLE to FALSE and check if it renders then. If that is the case, then you know there is something wrong with setting up or clearing the depth buffer. Even though D3DCMP_ALWAYS should pass all tests you can still get funky results if you didn't set up the matrices right (for example, setting 0.0 for near plane instead of 1.0 in the projection matrix), etc. etc.
Logged

Praetor
Currently working on : tactical battles.
Crimsontide
Level 5
*****


View Profile
« Reply #3 on: April 27, 2010, 08:29:39 AM »

Thx for the ideas.  I tried with the reference rasterizer and it works.  So I'm guessing its just something to do with the nvidia drivers (tried it on 3 different cards, but they were all nvidia)??  Any idea where this sort of weird errata might be documented?
Logged
Crimsontide
Level 5
*****


View Profile
« Reply #4 on: April 27, 2010, 09:05:47 AM »

Ok it seems after turning up the debug warning level on DirectX (ty will Smiley I was setting my viewport wrong.  It was such a silly error...
Logged
Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #5 on: April 27, 2010, 02:04:36 PM »

Those are the kind of errors we like. Hard errors we don't like.
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic