summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/surface9.c
diff options
context:
space:
mode:
authorPatrick Rudolph <[email protected]>2016-09-22 17:03:17 +0200
committerAxel Davy <[email protected]>2016-10-10 23:43:51 +0200
commit60624be2033f06b414cf76794c2f3b061dc28332 (patch)
treea85df52e8af5b9299206723db714da8f8d0851c1 /src/gallium/state_trackers/nine/surface9.c
parent8a50b1244fcb77334dc9d8e470061cd5f9537375 (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/surface9.c')
-rw-r--r--src/gallium/state_trackers/nine/surface9.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
index ffa8c2af1bd..dc31bb93786 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -58,6 +58,7 @@ NineSurface9_ctor( struct NineSurface9 *This,
struct pipe_surface *surf;
struct pipe_context *pipe = pParams->device->pipe;
bool allocate = !pContainer && pDesc->Format != D3DFMT_NULL;
+ D3DMULTISAMPLE_TYPE multisample_type;
DBG("This=%p pDevice=%p pResource=%p Level=%u Layer=%u pDesc=%p\n",
This, pParams->device, pResource, Level, Layer, pDesc);
@@ -82,6 +83,18 @@ NineSurface9_ctor( struct NineSurface9 *This,
This->data = (uint8_t *)user_buffer;
+ multisample_type = pDesc->MultiSampleType;
+
+ /* Map MultiSampleQuality to MultiSampleType */
+ hr = d3dmultisample_type_check(pParams->device->screen,
+ pDesc->Format,
+ &multisample_type,
+ pDesc->MultiSampleQuality,
+ NULL);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
/* TODO: this is (except width and height) duplicate from
* container info (in the pContainer case). Some refactoring is
* needed to avoid duplication */
@@ -92,7 +105,7 @@ NineSurface9_ctor( struct NineSurface9 *This,
This->base.info.depth0 = 1;
This->base.info.last_level = 0;
This->base.info.array_size = 1;
- This->base.info.nr_samples = pDesc->MultiSampleType;
+ This->base.info.nr_samples = multisample_type;
This->base.info.usage = PIPE_USAGE_DEFAULT;
This->base.info.bind = PIPE_BIND_SAMPLER_VIEW; /* StretchRect */
@@ -721,7 +734,7 @@ NineSurface9_SetResourceResize( struct NineSurface9 *This,
This->desc.Width = This->base.info.width0 = resource->width0;
This->desc.Height = This->base.info.height0 = resource->height0;
- This->desc.MultiSampleType = This->base.info.nr_samples = resource->nr_samples;
+ This->base.info.nr_samples = resource->nr_samples;
This->stride = nine_format_get_stride(This->base.info.format,
This->desc.Width);