H. Verbeet : wined3d: Bind the surface texture in LoadLocation().

Alexandre Julliard julliard at winehq.org
Thu Jan 3 06:43:39 CST 2008


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

Author: H. Verbeet <hverbeet at gmail.com>
Date:   Wed Jan  2 19:52:56 2008 +0100

wined3d: Bind the surface texture in LoadLocation().

---

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

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 734568a..98ab6b9 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -47,16 +47,14 @@ static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This) {
     IWineD3DSurface_BindTexture((IWineD3DSurface *)This);
 }
 
+/* This call just downloads data, the caller is responsible for activating the
+ * right context and binding the correct texture. */
 static void surface_download_data(IWineD3DSurfaceImpl *This) {
-    IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
-
     if (0 == This->glDescription.textureName) {
         ERR("Surface does not have a texture, but SFLAG_INTEXTURE is set\n");
         return;
     }
 
-    ActivateContext(myDevice, myDevice->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
-
     if(This->Flags & SFLAG_CONVERTED) {
         FIXME("Read back converted textures unsupported, format=%s\n", debug_d3dformat(This->resource.format));
         return;
@@ -64,8 +62,6 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
 
     ENTER_GL();
 
-    surface_bind_and_dirtify(This);
-
     if (This->resource.format == WINED3DFMT_DXT1 ||
             This->resource.format == WINED3DFMT_DXT2 || This->resource.format == WINED3DFMT_DXT3 ||
             This->resource.format == WINED3DFMT_DXT4 || This->resource.format == WINED3DFMT_DXT5) {
@@ -194,6 +190,8 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
     This->Flags |= SFLAG_INSYSMEM;
 }
 
+/* This call just uploads data, the caller is responsible for activating the
+ * right context and binding the correct texture. */
 static void surface_upload_data(IWineD3DSurfaceImpl *This, GLenum internal, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *data) {
     if (This->resource.format == WINED3DFMT_DXT1 ||
             This->resource.format == WINED3DFMT_DXT2 || This->resource.format == WINED3DFMT_DXT3 ||
@@ -250,6 +248,8 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, GLenum internal, GLsi
     }
 }
 
+/* This call just allocates the texture, the caller is responsible for
+ * activating the right context and binding the correct texture. */
 static void surface_allocate_surface(IWineD3DSurfaceImpl *This, GLenum internal, GLsizei width, GLsizei height, GLenum format, GLenum type) {
     BOOL enable_client_storage = FALSE;
     BYTE *mem = NULL;
@@ -3792,6 +3792,9 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D
 
         /* Download the surface to system memory */
         if(This->Flags & SFLAG_INTEXTURE) {
+            ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+            surface_bind_and_dirtify(This);
+
             surface_download_data(This);
         } else {
             read_from_framebuffer(This, rect,
@@ -3807,6 +3810,9 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D
     } else /* if(flag == SFLAG_INTEXTURE) */ {
         d3dfmt_get_conv(This, TRUE /* We need color keying */, TRUE /* We will use textures */, &format, &internal, &type, &convert, &bpp, This->srgb);
 
+        ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+        surface_bind_and_dirtify(This);
+
         if (This->Flags & SFLAG_INDRAWABLE) {
             GLint prevRead;
 




More information about the wine-cvs mailing list