[PATCH 1/1] wined3d: Swap the container's texture name in flip_surface().

Henri Verbeet hverbeet at codeweavers.com
Fri Nov 22 09:22:16 CST 2013


This fixes a regression introduced by commit
afe5ceb7292c494e14bb1417d0e22234c0610b47. I think flip_surface() is really
ugly and fragile, but unfortunately I don't think I'll be able to fix that
before wine-1.7.7.
---
 dlls/wined3d/surface.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 878b848..c43d630 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -4016,6 +4016,10 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
 
 void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back)
 {
+    if (front->container->level_count != 1 || front->container->layer_count != 1
+            || back->container->level_count != 1 || back->container->layer_count != 1)
+        ERR("Flip between surfaces %p and %p not supported.\n", front, back);
+
     /* Flip the surface contents */
     /* Flip the DC */
     {
@@ -4060,6 +4064,14 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back)
     {
         GLuint tmp;
 
+        tmp = back->container->texture_rgb.name;
+        back->container->texture_rgb.name = front->container->texture_rgb.name;
+        front->container->texture_rgb.name = tmp;
+
+        tmp = back->container->texture_srgb.name;
+        back->container->texture_srgb.name = front->container->texture_srgb.name;
+        front->container->texture_srgb.name = tmp;
+
         tmp = back->rb_multisample;
         back->rb_multisample = front->rb_multisample;
         front->rb_multisample = tmp;
-- 
1.7.10.4




More information about the wine-patches mailing list