[PATCH 2/5] wined3d: Limit the number of multisample levels reported by wined3d_check_device_multisample_type().

Matteo Bruni matteo.mystral at gmail.com
Tue Dec 15 14:39:22 CST 2015


2015-12-15 11:10 GMT+01:00 Henri Verbeet <hverbeet at gmail.com>:
> On 14 December 2015 at 23:37, Matteo Bruni <mbruni at codeweavers.com> wrote:
>> @@ -4426,7 +4428,7 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
>>      if (quality_levels)
>>      {
>>          if (multisample_type == WINED3D_MULTISAMPLE_NON_MASKABLE)
>> -            *quality_levels = gl_info->limits.samples;
>> +            *quality_levels = wined3d_log2i(gl_info->limits.samples);
>>          else
>>              *quality_levels = 1;
>>      }
> I'm not sure this really makes sense. It may make sense to limit the
> number of non-maskable quality levels to 8, similar to how we limit
> e.g. shader constants and render targets for d3d9, although that would
> need a test and a comment. I don't see how you can justify the
> wined3d_log2i().

It seems to roughly match native, where higher quality levels for
WINED3D_MULTISAMPLE_NON_MASKABLE generally mean an increased number of
samples per pixel (at least going by the output of DX9FSAAViewer, from
bug 12652) and sample counts often go up by powers-of-two. That's not
always the case of course but it seems like we can use the idea as a
possible valid implementation of WINED3D_MULTISAMPLE_NON_MASKABLE.

Anyway I just realized this patch is missing the related changes to
surface_prepare_rb(), as-is the patch doesn't make sense... Something
like the attached patch is what I intended.

Actually there is also another option. Hardcoding the quality levels
count to 1 might be acceptable? We might then just always pick
MAX_SAMPLES (or maybe 2) as the samples count for
WINED3D_MULTISAMPLE_NON_MASKABLE renderbuffers.
-------------- next part --------------
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 4b4209a..e022e19 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -4414,6 +4414,8 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
 
     gl_info = &wined3d->adapters[adapter_idx].gl_info;
 
+    /* FIXME: Make use of ARB_internalformat_query2 NUM_SAMPLE_COUNTS and
+     * SAMPLES queries to give sensible results. */
     if (multisample_type > gl_info->limits.samples)
     {
         TRACE("Returning not supported.\n");
@@ -4426,7 +4428,7 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
     if (quality_levels)
     {
         if (multisample_type == WINED3D_MULTISAMPLE_NON_MASKABLE)
-            *quality_levels = gl_info->limits.samples;
+            *quality_levels = wined3d_log2i(gl_info->limits.samples);
         else
             *quality_levels = 1;
     }
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index f8a1ba1..70c856e 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2887,7 +2887,7 @@ static void surface_prepare_rb(struct wined3d_surface *surface, const struct win
          * AMD has a similar feature called Enhanced Quality Anti-Aliasing (EQAA),
          * but it does not have an equivalent OpenGL extension. */
         if (surface->resource.multisample_type == WINED3D_MULTISAMPLE_NON_MASKABLE)
-            samples = surface->resource.multisample_quality;
+            samples = 1 << (surface->resource.multisample_quality + 1);
         else
             samples = surface->resource.multisample_type;
 


More information about the wine-devel mailing list