[PATCH 5/5] wined3d: Use renderbuffers when resolving multisample textures with conversion.

Józef Kucia jkucia at codeweavers.com
Fri Feb 16 08:13:33 CST 2018


Direct3D 9 allows blits from multisample resources to non-multisample
resources with scaling or format conversion. In OpenGL, we resolve
multisample texture to the renderbuffer associated with the texture
before doing the actual blit with scaling/format conversion.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/wined3d/surface.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 1f5a98a2fee0..5cb9cda7b6e6 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -350,6 +350,15 @@ static void surface_depth_blt_fbo(const struct wined3d_device *device,
     context_release(context);
 }
 
+static BOOL is_multisample_location(const struct wined3d_texture *texture, DWORD location)
+{
+    if (location == WINED3D_LOCATION_RB_MULTISAMPLE)
+        return TRUE;
+    if (location != WINED3D_LOCATION_TEXTURE_RGB && location != WINED3D_LOCATION_TEXTURE_SRGB)
+        return FALSE;
+    return texture->target == GL_TEXTURE_2D_MULTISAMPLE || texture->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
+}
+
 /* Blit between surface locations. Onscreen on different swapchains is not supported.
  * Depth / stencil is not supported. Context activation is done by the caller. */
 static void surface_blt_fbo(const struct wined3d_device *device,
@@ -392,7 +401,7 @@ static void surface_blt_fbo(const struct wined3d_device *device,
     }
 
     /* Resolve the source surface first if needed. */
-    if (src_location == WINED3D_LOCATION_RB_MULTISAMPLE
+    if (is_multisample_location(src_texture, src_location)
             && (src_texture->resource.format->id != dst_texture->resource.format->id
                 || abs(src_rect.bottom - src_rect.top) != abs(dst_rect.bottom - dst_rect.top)
                 || abs(src_rect.right - src_rect.left) != abs(dst_rect.right - dst_rect.left)))
-- 
2.13.6




More information about the wine-devel mailing list