Stefan Dösinger : wined3d: Support framebuffer reading from texture_rectangle sources.

Alexandre Julliard julliard at winehq.org
Thu Apr 24 06:23:08 CDT 2008


Module: wine
Branch: master
Commit: 1c9f1f8ddd5fa7ab8cae6dc510b01087895f8ffb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1c9f1f8ddd5fa7ab8cae6dc510b01087895f8ffb

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Wed Apr 23 02:48:55 2008 +0200

wined3d: Support framebuffer reading from texture_rectangle sources.

---

 dlls/wined3d/device.c          |    2 +-
 dlls/wined3d/surface.c         |   26 +++++++++++++++++++-------
 dlls/wined3d/wined3d_private.h |    1 +
 3 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 33f4180..89eb835 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -663,7 +663,7 @@ static HRESULT  WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
     object->glDescription.level            = Level;
 
     /* Flags */
-    object->Flags      = 0;
+    object->Flags      = SFLAG_NORMCOORD; /* Default to normalized coords */
     object->Flags     |= Discard ? SFLAG_DISCARD : 0;
     object->Flags     |= (WINED3DFMT_D16_LOCKABLE == Format) ? SFLAG_LOCKABLE : 0;
     object->Flags     |= Lockable ? SFLAG_LOCKABLE : 0;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 7d4eea9..a52e822 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -626,6 +626,11 @@ void WINAPI IWineD3DSurfaceImpl_SetGlTextureDesc(IWineD3DSurface *iface, UINT te
         IWineD3DSurface_ModifyLocation(iface, SFLAG_INTEXTURE, FALSE);
         IWineD3DSurface_AddDirtyRect(iface, NULL);
     }
+    if(target == GL_TEXTURE_RECTANGLE_ARB && This->glDescription.target != target) {
+        This->Flags &= ~SFLAG_NORMCOORD;
+    } else if(This->glDescription.target == GL_TEXTURE_RECTANGLE_ARB && target != GL_TEXTURE_RECTANGLE_ARB) {
+        This->Flags |= SFLAG_NORMCOORD;
+    }
     This->glDescription.textureName = textureName;
     This->glDescription.target      = target;
     This->Flags &= ~SFLAG_ALLOCATED;
@@ -2845,15 +2850,22 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
     }
     checkGLcall("glEnd and previous");
 
-    left = (float) srect->x1 / (float) Src->pow2Width;
-    right = (float) srect->x2 / (float) Src->pow2Width;
+    left = srect->x1;
+    right = srect->x2;
 
     if(upsidedown) {
-        top = (float) (Src->currentDesc.Height - srect->y1) / (float) Src->pow2Height;
-        bottom = (float) (Src->currentDesc.Height - srect->y2) / (float) Src->pow2Height;
+        top = Src->currentDesc.Height - srect->y1;
+        bottom = Src->currentDesc.Height - srect->y2;
     } else {
-        top = (float) (Src->currentDesc.Height - srect->y2) / (float) Src->pow2Height;
-        bottom = (float) (Src->currentDesc.Height - srect->y1) / (float) Src->pow2Height;
+        top = Src->currentDesc.Height - srect->y2;
+        bottom = Src->currentDesc.Height - srect->y1;
+    }
+
+    if(Src->Flags & SFLAG_NORMCOORD) {
+        left /= Src->pow2Width;
+        right /= Src->pow2Width;
+        top /= Src->pow2Height;
+        bottom /= Src->pow2Height;
     }
 
     /* draw the source texture stretched and upside down. The correct surface is bound already */
@@ -3774,7 +3786,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
             This->glDescription.target = GL_TEXTURE_RECTANGLE_ARB;
             This->pow2Width  = This->currentDesc.Width;
             This->pow2Height = This->currentDesc.Height;
-            This->Flags &= ~SFLAG_NONPOW2;
+            This->Flags &= ~(SFLAG_NONPOW2 | SFLAG_NORMCOORD);
         }
 
         /* No oversize, gl rect is the full texture size */
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index bdad91b..2404505 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1365,6 +1365,7 @@ void get_drawable_size_fbo(IWineD3DSurfaceImpl *This, UINT *width, UINT *height)
 #define SFLAG_CLIENT      0x00010000 /* GL_APPLE_client_storage is used on that texture */
 #define SFLAG_ALLOCATED   0x00020000 /* A gl texture is allocated for this surface */
 #define SFLAG_PBO         0x00040000 /* Has a PBO attached for speeding up data transfers for dynamically locked surfaces */
+#define SFLAG_NORMCOORD   0x00080000   /* Set if the GL texture coords are normalized(non-texture rectangle) */
 
 /* In some conditions the surface memory must not be freed:
  * SFLAG_OVERSIZE: Not all data can be kept in GL




More information about the wine-cvs mailing list