tags:

views:

123

answers:

2

OpenGL allows you to set a logical bit-wise operation (OR, XOR, etc) to execute when writing a fragment out to the framebuffer.

I'd like to perform fast scene voxelization (as seen in a paper by Elmar Eisemann) where I use a single framebuffer pixel to store 32 slices. Unfortunately I'm working in a DirectX 9 environment. Unless I'm missing something, D3D doesn't support bit-wise operations like this.

The first thing that came to mind is additive blending, but this would produce incorrect results. Any ideas?

+1  A: 

No, there isn't an equivalent in DirectX 9.

You can emulate it with shaders though. But it will require Shader Model 4.0, so DirectX 10 (I've done it using GS/PS and texture arrays). I thing DirectX 11 Compute Shaders would make sense now because the implementation will be far more easier and more efficient.

Stringer Bell
A: 

The big problem is that DirectX is setup to handle floats through the pipeline (Up to just before the write to texture). What would you expect a bitwise operation to do between 2 floats? Its unlikely it will do what you expect.

While the cards may well be able to support ints this functionality is "hidden" from you as it is how DirectX works. As a result you couldn't guarantee that a specific card supports it.

What exactly are you trying to achieve? There may be a different way to do what you are after.

Goz