diff options
author | Patrick Rudolph <[email protected]> | 2016-09-22 17:03:17 +0200 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-10-10 23:43:51 +0200 |
commit | 60624be2033f06b414cf76794c2f3b061dc28332 (patch) | |
tree | a85df52e8af5b9299206723db714da8f8d0851c1 /src/gallium/state_trackers/nine/swapchain9.c | |
parent | 8a50b1244fcb77334dc9d8e470061cd5f9537375 (diff) |
st/nine: Implement MSAA quality levels
Advertise quality levels:
Each supported multisample count matches to one quality level.
The application doesn't know how much samples each quality level has.
For that reason it's not possible to set the multisample mask.
Return errors on quality level missmatch.
Fixes several old games not having multisample support until now.
Fix for issue #73.
Signed-off-by: Patrick Rudolph <[email protected]>
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/swapchain9.c')
-rw-r--r-- | src/gallium/state_trackers/nine/swapchain9.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c index fcda9c7837e..86c9be66ae6 100644 --- a/src/gallium/state_trackers/nine/swapchain9.c +++ b/src/gallium/state_trackers/nine/swapchain9.c @@ -120,6 +120,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, BOOL has_present_buffers = FALSE; int depth; unsigned i, oldBufferCount, newBufferCount; + D3DMULTISAMPLE_TYPE multisample_type; DBG("This=%p pParams=%p\n", This, pParams); user_assert(pParams != NULL, E_POINTER); @@ -204,15 +205,26 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, newBufferCount = pParams->BackBufferCount + (pParams->SwapEffect != D3DSWAPEFFECT_COPY); + multisample_type = pParams->MultiSampleType; + + /* Map MultiSampleQuality to MultiSampleType */ + hr = d3dmultisample_type_check(This->screen, pParams->BackBufferFormat, + &multisample_type, + pParams->MultiSampleQuality, + NULL); + if (FAILED(hr)) { + return hr; + } + pf = d3d9_to_pipe_format_checked(This->screen, pParams->BackBufferFormat, - PIPE_TEXTURE_2D, pParams->MultiSampleType, + PIPE_TEXTURE_2D, multisample_type, PIPE_BIND_RENDER_TARGET, FALSE, FALSE); if (This->actx->linear_framebuffer || (pf != PIPE_FORMAT_B8G8R8X8_UNORM && pf != PIPE_FORMAT_B8G8R8A8_UNORM) || pParams->SwapEffect != D3DSWAPEFFECT_DISCARD || - pParams->MultiSampleType >= 2 || + multisample_type >= 2 || (This->actx->ref && This->actx->ref == This->screen)) has_present_buffers = TRUE; @@ -239,7 +251,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, desc.Type = D3DRTYPE_SURFACE; desc.Pool = D3DPOOL_DEFAULT; desc.MultiSampleType = pParams->MultiSampleType; - desc.MultiSampleQuality = 0; + desc.MultiSampleQuality = pParams->MultiSampleQuality; desc.Width = pParams->BackBufferWidth; desc.Height = pParams->BackBufferHeight; @@ -279,7 +291,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, for (i = 0; i < newBufferCount; ++i) { tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; - tmplt.nr_samples = pParams->MultiSampleType; + tmplt.nr_samples = multisample_type; if (!has_present_buffers) tmplt.bind |= NINE_BIND_PRESENTBUFFER_FLAGS; tmplt.format = d3d9_to_pipe_format_checked(This->screen, @@ -297,6 +309,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, if (pParams->Flags & D3DPRESENTFLAG_LOCKABLE_BACKBUFFER) resource->flags |= NINE_RESOURCE_FLAG_LOCKABLE; if (This->buffers[i]) { + NineSurface9_SetMultiSampleType(This->buffers[i], desc.MultiSampleType); NineSurface9_SetResourceResize(This->buffers[i], resource); if (has_present_buffers) pipe_resource_reference(&resource, NULL); @@ -336,7 +349,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, * If it fails with PIPE_BIND_SAMPLER_VIEW, then the app check for texture support * would fail too, so we are fine. */ tmplt.bind |= PIPE_BIND_SAMPLER_VIEW; - tmplt.nr_samples = pParams->MultiSampleType; + tmplt.nr_samples = multisample_type; tmplt.format = d3d9_to_pipe_format_checked(This->screen, pParams->AutoDepthStencilFormat, PIPE_TEXTURE_2D, @@ -362,6 +375,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, return D3DERR_OUTOFVIDEOMEMORY; } if (This->zsbuf) { + NineSurface9_SetMultiSampleType(This->zsbuf, desc.MultiSampleType); NineSurface9_SetResourceResize(This->zsbuf, resource); pipe_resource_reference(&resource, NULL); } else { |