I'm trying to setup MSAA to remove jittering at the edges of primitives/geometry.
I have set the following :
rsd.IsMultisampleEnabled = true;
...
SampleDescription = new SampleDescription(8, 0),
on my G-Buffer textures and on my depth buffer. But I get the following errors :
D3D11 ERROR: ID3D11Device::CreateDepthStencilView: The base resource was created as a multisample resource. You must specify D3D11_DSV_DIMENSION_TEXTURE2DMS instead of D3D11_DSV_DIMENSION_TEXTURE2D. [ STATE_CREATION ERROR #143: CREATEDEPTHSTENCILVIEW_INVALIDDESC]
D3D11 ERROR: ID3D11Device::CreateDepthStencilView: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #148: CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN]
This doesn't make sense to me, because i don't want to use Texture2DMS, I'm not using the sampling results, nor making my own sampler, I'm just trying to use the built in MSAA. And so for the sake of resolving the error I change my DSV :
DepthStencilViewDescription dsViewDesc = new DepthStencilViewDescription
{
ArraySize = 0,
Format = depthFormat,
Dimension = DepthStencilViewDimension.Texture2DMultisampled,
MipSlice = 0,
Flags = DepthStencilViewFlags.None,
FirstArraySlice = 0,
};
Then I get this error :
D3D11 ERROR: ID3D11DeviceContext::Draw: The Shader Resource View dimension declared in the shader code (TEXTURE2D) does not match the view type bound to slot 1 of the Pixel Shader unit (TEXTURE2DMS). This mismatch is invalid if the shader actually uses the view (e.g. it is not skipped due to shader code branching). [ EXECUTION ERROR #354: DEVICE_DRAW_VIEW_DIMENSION_MISMATCH]
That doesn't make sense to me, because the depth stencil view isn't in shader code ?
Am I doing something wrong here ?
Do I have to use Texture2DMS to use MSAA ?
Should I just use super-sampling ?
Thanks for any help.