Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

D3D9 Render to Texture with Multisampling

Tags:

directx

I want to render to a texture using multisampling, then render that to the back buffer using a textured quad (passing it through a pixel shader.) Everything works fine without multisampling but I just can't figure out how to set it up to use multisampling.

I tried CreateDepthStencilSurface() but I don't really know what to do with that surface, or if tat's even what I should be doing.

Please help.

PS - I'm using DX9, Win32 and C++

like image 697
Robert Avatar asked Mar 16 '26 19:03

Robert


1 Answers

You can't, not directly anyway. Here is the regular workaround:

  1. Create a multisample render target using IDirect3DDevice9::CreateRenderTarget
  2. Create a simple texture
  3. Render to your multisample render target
  4. Use IDirect3DDevice9::StretchRect to blit your multisampled content into one of the surfaces of your texture
  5. Now proceed to use that texture as planned.
like image 151
Paul-Jan Avatar answered Mar 22 '26 00:03

Paul-Jan