1
\$\begingroup\$

I'm trying to create a DirectX9 device to copy video frame data from one memory buffer to another while processing it through a HLSL shader. I will need half-float or float precision for each channel. For now, D3DFMT_A32B32G32R32F will do.

I can create the device when passing D3DFMT_X8R8G8B8 in the presentation parameters, but it will fail when passing D3DFMT_A32B32G32R32F. I don't want to display this on the screen nor convert it between formats. Both the source and destination texture buffers have the same format.

How can I create a device that will allow me to display the output into another texture of type D3DFMT_A32B32G32R32F?

\$\endgroup\$
1
\$\begingroup\$

You can use CheckDeviceFormat to determine if a given D3DFORMAT is suitable for the device's backbuffer; it's unlikely that particular format will be.

Instead, try creating the device with any old acceptable backbuffer format (D3DFMT_X8R8G8B8 for example); it doesn't matter since you won't be rendering to it.

Then create a new texture with the desired destination format (D3DFMT_A32B32G32R32F), set it as a render target, and render to that.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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