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/adapter9.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/adapter9.c')
-rw-r--r-- | src/gallium/state_trackers/nine/adapter9.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c index fbbc586204a..09bfa3989ff 100644 --- a/src/gallium/state_trackers/nine/adapter9.c +++ b/src/gallium/state_trackers/nine/adapter9.c @@ -401,16 +401,30 @@ NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This, bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; pf = d3d9_to_pipe_format_checked(screen, SurfaceFormat, PIPE_TEXTURE_2D, + 0, PIPE_BIND_SAMPLER_VIEW, FALSE, FALSE); + + if (pf == PIPE_FORMAT_NONE && SurfaceFormat != D3DFMT_NULL) { + DBG("%s not available.\n", d3dformat_to_string(SurfaceFormat)); + return D3DERR_INVALIDCALL; + } + + pf = d3d9_to_pipe_format_checked(screen, SurfaceFormat, PIPE_TEXTURE_2D, MultiSampleType, bind, FALSE, FALSE); - if (pf == PIPE_FORMAT_NONE) { + if (pf == PIPE_FORMAT_NONE && SurfaceFormat != D3DFMT_NULL) { DBG("%s with %u samples not available.\n", d3dformat_to_string(SurfaceFormat), MultiSampleType); return D3DERR_NOTAVAILABLE; } - if (pQualityLevels) - *pQualityLevels = 1; /* gallium doesn't have quality levels */ + if (pQualityLevels) { + /* NONMASKABLE MultiSampleType might have more than one quality level, + * while MASKABLE MultiSampleTypes have only one level. + * Advertise quality levels and map each level to a sample count. */ + (void ) d3dmultisample_type_check(screen, SurfaceFormat, + &MultiSampleType, D3DMULTISAMPLE_16_SAMPLES, pQualityLevels); + DBG("advertising %u quality levels\n", *pQualityLevels); + } return D3D_OK; } |