Skip to main content
GameDev.net gamedev.net
🔒 Locked

Buffer Not ressolving

Started by hick18 Sep 5, 2011 at 5:55 PM 1 replies 900+ views
Original Post
hick18
hick18
[color="#1C2837"]I can't seem to get my MS buffer to resolve, the result simply looks like a non-ms render. Here's what I'm doing

-Create Swapchain with no MSAA
-Create RenderTarget with MSAA, and RTView with D3D10_RTV_DIMENSION_TEXTURE2DMS
-Create DepthTarget with MSAA, and DSView with D3D10_DSV_DIMENSION_TEXTURE2DMS
-Bind RenderTargetView and DepthStencilView
-Render Scene
[color="#1C2837"]-Call ResolveSubresource() to resolve RenderTarget resource into Swapchain resource.
[color="#1C2837"]-Call swapchain->Present()

[color="#1C2837"]I dont seem to be getting any errors in the console, and im not sure how I can use PIX to help me out in this scenario, although loading it in PIX does acknowledge that MSAA is being used as I get the option to disable it for pixel history data. Any ideas what I'm doing wrong?

[color="#1c2837"]Samples = 4
[color="#1c2837"]RenderTarget Format = DXGI_FORMAT_R8G8B8A8_UNORM


[color="#1c2837"]DepthTarget Format = DXGI_FORMAT_D32_FLOAT

[color="#1C2837"]RenderTarget
[color="#1c2837"]
D3D10_TEXTURE2D_DESC t2dd;
t2dd.Width = Width;
t2dd.Height = Height;
t2dd.MipLevels = 1;
t2dd.ArraySize = 1;
t2dd.Format = m_Format;
t2dd.SampleDesc.Count = m_Samples;
t2dd.SampleDesc.Quality = 0;
t2dd.Usage = D3D10_USAGE_DEFAULT;
t2dd.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
t2dd.CPUAccessFlags = 0;
t2dd.MiscFlags = ( m_GenerateMipMaps ? D3D10_RESOURCE_MISC_GENERATE_MIPS : 0 );

m_pD3DDevice->CreateTexture2D( &t2dd, 0, &m_pResource );

D3D10_RENDER_TARGET_VIEW_DESC rtvd;
rtvd.Format = m_Format;

if( m_Samples > 1 )
{
rtvd.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
}
else
{
rtvd.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
rtvd.Texture2D.MipSlice = 0;
}

m_pD3DDevice->CreateRenderTargetView( m_pResource, &rtvd, &m_pRTView );

D3D10_SHADER_RESOURCE_VIEW_DESC srvd;
srvd.Format = m_Format;

if( m_Samples > 1 )
{
srvd.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE2DMS;
}
else
{
srvd.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE2D;
srvd.Texture2D.MostDetailedMip = 0;
srvd.Texture2D.MipLevels = t2dd.MipLevels;
}

m_pD3DDevice->CreateShaderResourceView( m_pResource, &srvd, &m_pSRView );



[color="#1c2837"]DepthTarget

[color="#1c2837"]
D3D10_TEXTURE2D_DESC t2dd;
t2dd.Width = Width;
t2dd.Height = Height;
t2dd.MipLevels = 1;
t2dd.ArraySize = 1;
t2dd.Format = DXGI_FORMAT_R32_TYPELESS;
t2dd.SampleDesc.Count = m_Samples;
t2dd.SampleDesc.Quality = 0;
t2dd.Usage = D3D10_USAGE_DEFAULT;
t2dd.BindFlags = D3D10_BIND_DEPTH_STENCIL /*| D3D10_BIND_SHADER_RESOURCE*/;
t2dd.CPUAccessFlags = 0;
t2dd.MiscFlags = 0;

m_pD3DDevice->CreateTexture2D( &t2dd, 0, &m_pResource );

D3D10_DEPTH_STENCIL_VIEW_DESC dsvd;
dsvd.Format = DXGI_FORMAT_D32_FLOAT;

if( m_Samples > 1 )
{
dsvd.ViewDimension = D3D10_DSV_DIMENSION_TEXTURE2DMS;
dsvd.Texture2D.MipSlice = 0;
}
else
{
dsvd.ViewDimension = D3D10_DSV_DIMENSION_TEXTURE2D;
dsvd.Texture2D.MipSlice = 0;
}

m_pD3DDevice->CreateDepthStencilView( m_pResource, &dsvd, &m_pDSView );

MJP
MJP
I've never heard of resolving into the backbuffer. Why don't you just create the swap chain with MSAA?
hick18
hick18
Doesnt a swapchain just contain a number of Texture2D's though?

The reason im doing it this way is so that I can us the MS resource as a shader resource, and I like to keep my swapchain as simply a back buffer as opposed to a shader resource. It may cost more in memory, but it simplifies the setup I have.

So would I now have to add in yet another resource to do what I want?

Render to MS resource
Resolve MS resource into intermediate resource
Draw Screen quad with intermediate resource with shader resource view

or just

Render to MS resource
draw screen quad with shader that resolves MS resource, with the MS resource bound as a shader resource

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.