Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to implement a render abstraction over Direct3D9, and one of the functions I'm implementing is clearing a render target, which includes a depth buffer. However, the IDirect3DDevice9::ColorFill method I've been using doesn't seem to be able to clear depth buffers. Is the only means to clear depth buffers to use Clear() to clear depth buffers which have been bound to the rendering pipeline?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Clear() is the only way.

To understand why, you need to consider that Direct3D is an abstraction layer itself over the underlying hardware to present a way for you to code against them all. If you dig a little deeper behind the scenes on depth in particular, you start to discover that each manufacturer is free to implement (and therefore optimise) depth as they choose, as long as they adhere to the interface presented.

The link here describes a little about some of the different techniques that have been used, it seems to date from 2002 so things will have advanced since then, but it gives you an idea of why they hide the underlying implementation from you. The Wikipedia link on HyperZ here also talks a little about some of the optimisation methods used and the efficiencies they get from them.

share|improve this answer
1  
Suddenly, I'm feeling rather glad that I don't have to implement these functions. –  DeadMG Feb 26 '12 at 4:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.