Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualjajcek

Posted 21 January 2013 - 06:23 AM

Hi,

 

I remember that it was quite easy to turn it on in DirectX 9.0, but unfortunately I can't make it working with DX11. The MSDN says:

 

 

"The settings of the MultisampleEnable and AntialiasedLineEnable members apply only to multisample antialiasing (MSAA) render targets (that is, render targets with sample counts greater than 1)."

 

therefore we can deduce that we have to change appropriate properties in the rasterizer (MultisampleEnable and AntialiasedLineEnable) and increase the SampleDesc.Count value for a render target, so my changes are like this:

 

main render target:

 

D3D11_TEXTURE2D_DESC _depthBufferDesc;
ZeroMemory( &_depthBufferDesc, sizeof( D3D11_TEXTURE2D_DESC ) );
_depthBufferDesc.Width = uScreenWidth;
_depthBufferDesc.Height = uScreenHeight;
_depthBufferDesc.MipLevels = 1;
_depthBufferDesc.ArraySize = 1;
_depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
_depthBufferDesc.SampleDesc.Count = 2; // increased value to 2
_depthBufferDesc.SampleDesc.Quality = 0;
_depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
_depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
_depthBufferDesc.CPUAccessFlags = 0;
_depthBufferDesc.MiscFlags = 0;


_result = m_device->CreateTexture2D( &_depthBufferDesc, NULL, &m_depthStencilBuffer );
if( FAILED( _result ) ) {
return false;
}

 

rasterizer:

 

D3D11_RASTERIZER_DESC _rasterDesc;
_rasterDesc.AntialiasedLineEnable = true; // changed to true
_rasterDesc.CullMode = D3D11_CULL_BACK;
_rasterDesc.DepthBias = 0;
_rasterDesc.DepthBiasClamp = 0.0f;
_rasterDesc.DepthClipEnable = true;
_rasterDesc.FillMode = D3D11_FILL_SOLID;
_rasterDesc.FrontCounterClockwise = false;
_rasterDesc.MultisampleEnable = true; // changed to true
_rasterDesc.ScissorEnable = false;
_rasterDesc.SlopeScaledDepthBias = 0.0f;


_result = m_device->CreateRasterizerState( &_rasterDesc, &m_rasterState );
if( FAILED( _result ) ) {
return false;
}

 

however it fails while creating depth stencil view:

 

D3D11_DEPTH_STENCIL_VIEW_DESC _depthStencilViewDesc;
ZeroMemory( &_depthStencilViewDesc, sizeof( D3D11_DEPTH_STENCIL_VIEW_DESC ) );
_depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
_depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
_depthStencilViewDesc.Texture2D.MipSlice = 0;


_result = m_device->CreateDepthStencilView( m_depthStencilBuffer, &_depthStencilViewDesc, &m_depthStencilView );
if( FAILED( _result ) ) {
return false;
}

 

why? I tried to increase the Count value in the swap chain but then I have just black screen and nothing more.

 

Thank you for some help.


#3jajcek

Posted 21 January 2013 - 06:19 AM

Hi,

 

I remember that it was quite easy to turn it on in DirectX 9.0, but unfortunately I can't make it working with DX11. The MSDN says:

 

 

The settings of the MultisampleEnable and AntialiasedLineEnable members apply only to multisample antialiasing (MSAA) render targets (that is, render targets with sample counts greater than 1).

 

therefore we can deduce that we have to change appropriate properties in the rasterizer (MultisampleEnable and AntialiasedLineEnable) and increase the SampleDesc.Count value for a render target, so my changes are like this:

 

main render target:


D3D11_TEXTURE2D_DESC _depthBufferDesc; ZeroMemory( &_depthBufferDesc, sizeof( D3D11_TEXTURE2D_DESC ) ); _depthBufferDesc.Width = uScreenWidth; _depthBufferDesc.Height = uScreenHeight; _depthBufferDesc.MipLevels = 1; _depthBufferDesc.ArraySize = 1; _depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; _depthBufferDesc.SampleDesc.Count = 2; // here I have increased the value to 2 _depthBufferDesc.SampleDesc.Quality = 0; _depthBufferDesc.Usage = D3D11_USAGE_DEFAULT; _depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; _depthBufferDesc.CPUAccessFlags = 0; _depthBufferDesc.MiscFlags = 0; _result = m_device->CreateTexture2D( &_depthBufferDesc, NULL, &m_depthStencilBuffer ); if( FAILED( _result ) ) {     return false; }

 

rasterizer:


D3D11_RASTERIZER_DESC _rasterDesc; _rasterDesc.AntialiasedLineEnable = true; // changed to true _rasterDesc.CullMode = D3D11_CULL_BACK; _rasterDesc.DepthBias = 0; _rasterDesc.DepthBiasClamp = 0.0f; _rasterDesc.DepthClipEnable = true; _rasterDesc.FillMode = D3D11_FILL_SOLID; _rasterDesc.FrontCounterClockwise = false; _rasterDesc.MultisampleEnable = true; // changed to true _rasterDesc.ScissorEnable = false; _rasterDesc.SlopeScaledDepthBias = 0.0f; _result = m_device->CreateRasterizerState( &_rasterDesc, &m_rasterState ); if( FAILED( _result ) ) { return false; } m_deviceContext->RSSetState( m_rasterState );

however it fails while creating depth stencil view:

 


D3D11_DEPTH_STENCIL_VIEW_DESC _depthStencilViewDesc; ZeroMemory( &_depthStencilViewDesc, sizeof( D3D11_DEPTH_STENCIL_VIEW_DESC ) ); _depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; _depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; _depthStencilViewDesc.Texture2D.MipSlice = 0; _result = m_device->CreateDepthStencilView( m_depthStencilBuffer, &_depthStencilViewDesc, &m_depthStencilView ); if( FAILED( _result ) ) { return false; }

why? I tried to increase the Count value in the swap chain but then I have just black screen and nothing more.

 

Thank you for some help.


#2jajcek

Posted 21 January 2013 - 06:18 AM

Hi,

I remember that it was quite easy to turn it on in DirectX 9.0, but unfortunately I can't make it working with DX11. The MSDN says:
 

The settings of the MultisampleEnable and AntialiasedLineEnable members apply only to multisample antialiasing (MSAA) render targets (that is, render targets with sample counts greater than 1).

therefore we can deduce that we have to change appropriate properties in the rasterizer (MultisampleEnable and AntialiasedLineEnable) and increase the SampleDesc.Count value for a render target, so my changes are like this:

main render target:

D3D11_TEXTURE2D_DESC _depthBufferDesc;ZeroMemory( &_depthBufferDesc, sizeof( D3D11_TEXTURE2D_DESC ) );_depthBufferDesc.Width = uScreenWidth;_depthBufferDesc.Height = uScreenHeight;_depthBufferDesc.MipLevels = 1;_depthBufferDesc.ArraySize = 1;_depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;_depthBufferDesc.SampleDesc.Count = 2; // here I have increased the value to 2_depthBufferDesc.SampleDesc.Quality = 0;_depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;_depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;_depthBufferDesc.CPUAccessFlags = 0;_depthBufferDesc.MiscFlags = 0;_result = m_device->CreateTexture2D( &_depthBufferDesc, NULL, &m_depthStencilBuffer );if( FAILED( _result ) ) {    return false;}

rasterizer:

D3D11_RASTERIZER_DESC _rasterDesc;_rasterDesc.AntialiasedLineEnable = true; // changed to true_rasterDesc.CullMode = D3D11_CULL_BACK;_rasterDesc.DepthBias = 0;_rasterDesc.DepthBiasClamp = 0.0f;_rasterDesc.DepthClipEnable = true;_rasterDesc.FillMode = D3D11_FILL_SOLID;_rasterDesc.FrontCounterClockwise = false;_rasterDesc.MultisampleEnable = true; // changed to true_rasterDesc.ScissorEnable = false;_rasterDesc.SlopeScaledDepthBias = 0.0f;_result = m_device->CreateRasterizerState( &_rasterDesc, &m_rasterState );if( FAILED( _result ) ) {return false;}m_deviceContext->RSSetState( m_rasterState );

however it fails while creating depth stencil view:

D3D11_DEPTH_STENCIL_VIEW_DESC _depthStencilViewDesc;ZeroMemory( &_depthStencilViewDesc, sizeof( D3D11_DEPTH_STENCIL_VIEW_DESC ) );_depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;_depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;_depthStencilViewDesc.Texture2D.MipSlice = 0;_result = m_device->CreateDepthStencilView( m_depthStencilBuffer, &_depthStencilViewDesc, &m_depthStencilView );if( FAILED( _result ) ) {return false;}

why? I tried to increase the Count value in the swap chain but then I have just black screen and nothing more.

 

Thank you for some help.


#1jajcek

Posted 21 January 2013 - 06:16 AM

Hi,

 

I remember that it was quite easy to turn it on in DirectX 9.0, but unfortunately I can't make it working with DX11. The MSDN says:

 

 

The settings of the MultisampleEnable and AntialiasedLineEnable members apply only to multisample antialiasing (MSAA) render targets (that is, render targets with sample counts greater than 1).

 

therefore we can deduce that we have to change appropriate properties in the rasterizer (MultisampleEnable and AntialiasedLineEnable) and increase the SampleDesc.Count value for a render target, so my changes are like this:

 

main render target:

D3D11_TEXTURE2D_DESC _depthBufferDesc;
ZeroMemory( &_depthBufferDesc, sizeof( D3D11_TEXTURE2D_DESC ) );
_depthBufferDesc.Width = uScreenWidth;
_depthBufferDesc.Height = uScreenHeight;
_depthBufferDesc.MipLevels = 1;
_depthBufferDesc.ArraySize = 1;
_depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
_depthBufferDesc.SampleDesc.Count = 2; // here I have increased the value to 2
_depthBufferDesc.SampleDesc.Quality = 0;
_depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
_depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
_depthBufferDesc.CPUAccessFlags = 0;
_depthBufferDesc.MiscFlags = 0;


_result = m_device->CreateTexture2D( &_depthBufferDesc, NULL, &m_depthStencilBuffer );
if( FAILED( _result ) ) {
    return false;
}

 

rasterizer:

D3D11_RASTERIZER_DESC _rasterDesc;
_rasterDesc.AntialiasedLineEnable = true; // changed to true
_rasterDesc.CullMode = D3D11_CULL_BACK;
_rasterDesc.DepthBias = 0;
_rasterDesc.DepthBiasClamp = 0.0f;
_rasterDesc.DepthClipEnable = true;
_rasterDesc.FillMode = D3D11_FILL_SOLID;
_rasterDesc.FrontCounterClockwise = false;
_rasterDesc.MultisampleEnable = true; // changed to true
_rasterDesc.ScissorEnable = false;
_rasterDesc.SlopeScaledDepthBias = 0.0f;


_result = m_device->CreateRasterizerState( &_rasterDesc, &m_rasterState );
if( FAILED( _result ) ) {
return false;
}


m_deviceContext->RSSetState( m_rasterState );

 

however it fails while creating depth stencil view:

 

D3D11_DEPTH_STENCIL_VIEW_DESC _depthStencilViewDesc;
ZeroMemory( &_depthStencilViewDesc, sizeof( D3D11_DEPTH_STENCIL_VIEW_DESC ) );
_depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
_depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
_depthStencilViewDesc.Texture2D.MipSlice = 0;


_result = m_device->CreateDepthStencilView( m_depthStencilBuffer, &_depthStencilViewDesc, &m_depthStencilView );
if( FAILED( _result ) ) {
return false;
}

why? I tried to increase the Count value in the swap chain but then I have just black screen and nothing more.

 


PARTNERS