1
\$\begingroup\$

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?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Suddenly, I'm feeling rather glad that I don't have to implement these functions. \$\endgroup\$
    – DeadMG
    Commented Feb 26, 2012 at 4:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .