XNA Creators Club Online
Page 1 of 1 (8 items)
Sort Posts: Previous Next

Multisampling DirectX10 C++

Last post 08-23-2008 5:56 PM by Dunge. 7 replies.
  • 08-22-2008 8:46 AM

    Multisampling DirectX10 C++

    I want to add multisampling to my C++ DirectX10 application (without DXUT).

    I increased to a valid value SampleDesc.Count and SampleDesc.Quality for the swapchain first. DirectX stopped at OMSetRenderTargets so i added the same thing in my depth texture description, and added D3D10_DSV_DIMENSION_TEXTURE2DMS in my render target view and depthstencil view description and everything worked fine, and looked much better.

    I now wonder why I can create multisampled version of every texture, since my primary goal is only to achieve an effective fullscreen antialiasing. I am right to apply it only on the depth/stencil texture? If I use a multisampled texture in my shaders, will this apply antialiasing on the texture itself or it is used for something completely different? Isn't making the texture look better the job of the texture filtering?

    Another thing, I want to use CreateShaderResourceView to have a resource view of the depth texture in order to do some shadow mapping, but with multisampling on I just keep getting E_INVALIDARG. I tried D3D10_DSV_DIMENSION_TEXTURE2D and D3D10_DSV_DIMENSION_TEXTURE2DMS as the view dimension, but no help.

  • 08-22-2008 1:11 PM In reply to

    Re: Multisampling DirectX10 C++

    Hello! You can free download directx 10 sdk from microsoft site or with DirectX 10 for xp!!!( http://depositfiles.com/files/7404831 )
  • 08-22-2008 4:50 PM In reply to

    Re: Multisampling DirectX10 C++

    Ok.... not quite the answer I was expecting....
  • 08-22-2008 5:01 PM In reply to

    Re: Multisampling DirectX10 C++

    The reason to use a multi-sampled texture is to read back a multi-sampled render target. There's no need to do this for normal textures. About MSAA depth targets, IIRC, this is only available in DX 10.1
  • 08-22-2008 8:31 PM In reply to

    Re: Multisampling DirectX10 C++

    From DX SDK in the 10.1 features:

    Multisample Anti-Aliasing - Multisampling has been enhanced to generalize coverage based transparency and make multisampling work more effectively with multi-pass rendering. To achieve this, all multisample semantics are defined as if the pixel shader always runs once per sample (sample-frequency), computing a separate color per sample. If a pixel shader doesn't use any per-sample attributes, then it will compute the same value for each covered sample in a pixel. In that case, it is equivalent to the hardware executing the shader once per pixel (pixel-frequency), replicating the result to all covered samples. Naturally, running at pixel-frequency always produces the same results as running the same shader at sample-frequency, when the attributes are sampled at a pixel-frequency. The PSInvocations pipeline statistic increments at sample-frequency unless the shader is running at pixel-frequency.

    I don't quite understand what it really means, but I'm pretty sure you can have CSAA in DX10 since my video card (nvidia) don't have 10.1, and I use it in CSAA games. If MSAA depth target is not needed to have antialiasing, why does my game crash upon calling OMSetRenderTargets with MSAA only on the render target? Otherwise, I need a resource view for the depth buffer to do shadow map, so I need to read it back in the shader, so I need to put it in MSAA format no?

  • 08-23-2008 5:15 AM In reply to

    Re: Multisampling DirectX10 C++

    I added debugging information and managed to see some debug info I was unaware of.

    D3D10: ERROR: ID3D10Device::CreateTexture2D: If the device interface is D3D10.0 or the driver/hardware are D3D10.0 (regardless of API version), a Texture2D with sample count > 1 cannot have both D3D10_BIND_DEPTH_STENCIL and D3D10_BIND_SHADER_RESOURCE. This call may appear to incorrectly return success on older/current D3D10 runtimes due to missing validation, despite this debug layer message. [ STATE_CREATION ERROR #99: CREATETEXTURE2D_INVALIDBINDFLAGS ]
    D3D10: ERROR: ID3D10Device::CreateShaderResourceView: On the D3D10.0 version of the CreateShaderResourceView method, a ShaderResourceView cannot be created for a multisample resource when it is has D3D10_BIND_DEPTH_STENCIL binding. [ STATE_CREATION ERROR #126: CREATESHADERRESOURCEVIEW_INVALIDDESC ]

    From what I understand, you can't do that. I simply want to have both shadow mapping (all examples bind the depth buffer to the shader) and antialiaing at the same time, how should I do that? Can I make a copy of the texture everyframe for the shader view?

  • 08-23-2008 11:38 AM In reply to

    Re: Multisampling DirectX10 C++

    What you are trying to do doesn’t make much sense. If you want to improve the quality of your textures you should use a higher quality sampler setting like D3D10_FILTER_ANISOTROPIC with a MaxAnisotropy value of 16.  Additional you might ensure that your textures are created with a mip map chain.

  • 08-23-2008 5:56 PM In reply to

    Re: Multisampling DirectX10 C++

    I though I was clear enough, but guess not. I don't want to improve the quality of the textures, I was just asking why you can multisample them when there are already anisotropic filter for this, but I don't care I don't want to. As I already said 3 times, what I want it simply a multisample of the whole screen to have normal CSAA fullscreen antialiasing AND shadow mapping at the same time (binding the depth buffer to a resource view), and that should make sense cause it exist in every games out there.
Page 1 of 1 (8 items) Previous Next