how to copy the data to depth buffer

Hi, i am just a beginner, so please help me

Actually, I try to copy the values in one ordinary texture to the depth buffer, how could I write the data into the depth buffer? I see the usage of texture has one type "D3DUSAGE_DEPTHSTENCIL", but I don't know how to use it.

I really appreciate if you could give me any suggestions. Thanks!

[366 byte] By [Ethanph] at [2007-12-26]
# 1
You usually fill your depth buffer by rendering primitives that cover the required area at the required depth. What is the effect you're trying to achieve by copying texture colors to a depth buffer?
WessamBahnassi at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 2

Hi, actually I'd like to do some experiment about GPGPU, so not try some special effect :)

I have used pixel shader for this function. Then...another problem, I'd like to read the all depth values from depth buffer out, how could I do?

I guess I could first like this:
device->GetDepthStencilSurface(pSurface);
Then what can I do next? The surface seems unlockable...

Thanks!

Ethanph at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 3
For pixel shader usage, you can output the z coordinate of the vertex in the vertex shader and have the pixel shader interpolator (any of the texcoord registers) interpolate this value across the rasterized triangles. You can then access this value in your pixel shader...
WessamBahnassi at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...