st/nine: Fix multisampling support detection
authorAxel Davy <axel.davy@ens.fr>
Wed, 21 Jan 2015 07:59:05 +0000 (08:59 +0100)
committerAxel Davy <axel.davy@ens.fr>
Thu, 5 Feb 2015 23:07:19 +0000 (00:07 +0100)
Reviewed-by: Tiziano Bacocco <tizbac2@gmail.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/adapter9.c
src/gallium/state_trackers/nine/nine_pipe.h

index e9bb9c08ee9a8576ecdd8459874b66c74c8247c2..069cc03a0317f6a5b5d8b555641cd49c2552f165 100644 (file)
@@ -359,6 +359,7 @@ NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
     struct pipe_screen *screen;
     HRESULT hr;
     enum pipe_format pf;
+    unsigned bind;
 
     DBG("This=%p DeviceType=%s SurfaceFormat=%s Windowed=%i MultiSampleType=%u "
         "pQualityLevels=%p\n", This, nine_D3DDEVTYPE_to_str(DeviceType),
@@ -369,9 +370,14 @@ NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
     if (FAILED(hr))
         return hr;
 
-    pf = d3d9_to_pipe_format_checked_no_bind(screen, SurfaceFormat,
-                                             PIPE_TEXTURE_2D,
-                                             MultiSampleType, FALSE);
+    if (depth_stencil_format(SurfaceFormat))
+        bind = d3d9_get_pipe_depth_format_bindings(SurfaceFormat);
+    else /* render-target */
+        bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_TRANSFER_READ |
+               PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_RENDER_TARGET;
+
+    pf = d3d9_to_pipe_format_checked(screen, SurfaceFormat, PIPE_TEXTURE_2D,
+                                     MultiSampleType, bind, FALSE);
 
     if (pf == PIPE_FORMAT_NONE) {
         DBG("%s with %u samples not available.\n",
index 7295bdf9c6ec25459bb88cdf1cc5d7e39e025d5c..17844d5556b33461022e1dc09247730a9909a155 100644 (file)
@@ -309,31 +309,6 @@ d3d9_to_pipe_format_checked(struct pipe_screen *screen,
     return PIPE_FORMAT_NONE;
 }
 
-/* same that above, but determines binding flags */
-static INLINE enum pipe_format
-d3d9_to_pipe_format_checked_no_bind(struct pipe_screen *screen,
-                                    D3DFORMAT format,
-                                    enum pipe_texture_target target,
-                                    unsigned sample_count,
-                                    boolean srgb)
-{
-    enum pipe_format result;
-    unsigned bindings;
-
-    result = d3d9_to_pipe_format_internal(format);
-    if (result == PIPE_FORMAT_NONE)
-        return PIPE_FORMAT_NONE;
-
-    bindings = util_format_is_depth_or_stencil(result) ?
-        PIPE_BIND_DEPTH_STENCIL : PIPE_BIND_RENDER_TARGET;
-    if (srgb)
-        result = util_format_srgb(result);
-
-    if (format_check_internal(result))
-        return result;
-    return PIPE_FORMAT_NONE;
-}
-
 static INLINE const char *
 d3dformat_to_string(D3DFORMAT fmt)
 {