[PATCH] Upload the whole surface to the framebuffer when LockedRect isn't set because not in all cases flush_to_framebuffer_drawpixels is called because of locking. This fixes GL_INVALID_OPERATION lines in Red Alert and other apps.

Roderick Colenbrander thunderbird2k at gmx.net
Tue Feb 19 14:18:26 CST 2008


---
 dlls/wined3d/surface.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index ca3dea4..f1217d9 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1163,11 +1163,19 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm
         checkGLcall("glBindBufferARB");
     }
 
-    glDrawPixels(This->lockedRect.right - This->lockedRect.left,
-                 (This->lockedRect.bottom - This->lockedRect.top)-1,
-                 fmt, type,
-                 mem + bpp * This->lockedRect.left + pitch * This->lockedRect.top);
-    checkGLcall("glDrawPixels");
+    /* When the surface is locked we only have to refresh the locked part else we need to update the whole image */
+    if(This->Flags & SFLAG_LOCKED) {
+        glDrawPixels(This->lockedRect.right - This->lockedRect.left,
+                     (This->lockedRect.bottom - This->lockedRect.top)-1,
+                     fmt, type,
+                     mem + bpp * This->lockedRect.left + pitch * This->lockedRect.top);
+        checkGLcall("glDrawPixels");
+    } else {
+        glDrawPixels(This->currentDesc.Width,
+                     This->currentDesc.Height,
+                     fmt, type, mem);
+        checkGLcall("glDrawPixels");
+    }
 
     if(This->Flags & SFLAG_PBO) {
         GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
-- 
1.5.3.4


--========GMX286941203457030771084--



More information about the wine-patches mailing list