=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Keep GL_UNPACK_CLIENT_STORAGE_APPLE off by default.

Alexandre Julliard julliard at winehq.org
Mon Aug 19 14:33:00 CDT 2013


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Aug 19 10:52:31 2013 +0200

wined3d: Keep GL_UNPACK_CLIENT_STORAGE_APPLE off by default.

This is cleaner than the other way around and avoids side effects in
code that wasn't written with client storage in mind. Contrary to the
original intention, it also means fewer client storage toggle calls.

---

 dlls/wined3d/arb_program_shader.c |   12 ------------
 dlls/wined3d/context.c            |    7 -------
 dlls/wined3d/device.c             |   26 --------------------------
 dlls/wined3d/surface.c            |   17 ++++++++---------
 dlls/wined3d/volume.c             |    6 ------
 5 files changed, 8 insertions(+), 60 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 84c24cc..032ff14 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7102,12 +7102,6 @@ static void upload_palette(const struct wined3d_surface *surface, struct wined3d
 
     d3dfmt_p8_init_palette(surface, table, colorkey);
 
-    if (gl_info->supported[APPLE_CLIENT_STORAGE])
-    {
-        gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
-        checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
-    }
-
     if (!priv->palette_texture)
         gl_info->gl_ops.gl.p_glGenTextures(1, &priv->palette_texture);
 
@@ -7124,12 +7118,6 @@ static void upload_palette(const struct wined3d_surface *surface, struct wined3d
     /* TODO: avoid unneeded uploads in the future by adding some SFLAG_PALETTE_DIRTY mechanism */
     gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, table);
 
-    if (gl_info->supported[APPLE_CLIENT_STORAGE])
-    {
-        gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
-        checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
-    }
-
     /* Switch back to unit 0 in which the 2D texture will be stored. */
     context_active_texture(context, gl_info, 0);
 }
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index f09f1f7..123e9b1 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1564,13 +1564,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ALIGNMENT, device->surface_alignment);
     checkGLcall("glPixelStorei(GL_UNPACK_ALIGNMENT, device->surface_alignment);");
 
-    if (gl_info->supported[APPLE_CLIENT_STORAGE])
-    {
-        /* Most textures will use client storage if supported. Exceptions are
-         * non-native power of 2 textures and textures in DIB sections. */
-        gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
-        checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
-    }
     if (gl_info->supported[ARB_VERTEX_BLEND])
     {
         /* Direct3D always uses n-1 weights for n world matrices and uses
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7d532dd..1db04b4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -871,13 +871,6 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
      * We emulate this by creating dummy textures and binding them
      * to each texture stage when the currently set D3D texture is NULL. */
 
-    if (gl_info->supported[APPLE_CLIENT_STORAGE])
-    {
-        /* The dummy texture does not have client storage backing */
-        gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
-        checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
-    }
-
     count = min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers);
     for (i = 0; i < count; ++i)
     {
@@ -941,13 +934,6 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_
             }
         }
     }
-
-    if (gl_info->supported[APPLE_CLIENT_STORAGE])
-    {
-        /* Re-enable because if supported it is enabled by default */
-        gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
-        checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
-    }
 }
 
 /* Context activation is done by the caller. */
@@ -4648,12 +4634,6 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
 
             context = context_acquire(device, NULL);
 
-            if (gl_info->supported[APPLE_CLIENT_STORAGE])
-            {
-                gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
-                checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
-            }
-
             invalidate_active_texture(device, context);
             /* Create a new cursor texture */
             gl_info->gl_ops.gl.p_glGenTextures(1, &device->cursorTexture);
@@ -4664,12 +4644,6 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
             checkGLcall("glTexImage2D");
             HeapFree(GetProcessHeap(), 0, mem);
 
-            if (gl_info->supported[APPLE_CLIENT_STORAGE])
-            {
-                gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
-                checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
-            }
-
             context_release(context);
         }
         else
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 83ff41f..c5dd301 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -694,7 +694,6 @@ static void surface_release_client_storage(struct wined3d_surface *surface)
     struct wined3d_context *context = context_acquire(surface->resource.device, NULL);
     const struct wined3d_gl_info *gl_info = context->gl_info;
 
-    gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
     if (surface->texture_name)
     {
         surface_bind_and_dirtify(surface, context, FALSE);
@@ -707,7 +706,6 @@ static void surface_release_client_storage(struct wined3d_surface *surface)
         gl_info->gl_ops.gl.p_glTexImage2D(surface->texture_target, surface->texture_level,
                 GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
     }
-    gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
 
     context_release(context);
 
@@ -2642,7 +2640,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
 static void surface_allocate_surface(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
         const struct wined3d_format *format, BOOL srgb)
 {
-    BOOL enable_client_storage = FALSE;
+    BOOL disable_client_storage = FALSE;
     GLsizei width = surface->pow2Width;
     GLsizei height = surface->pow2Height;
     const BYTE *mem = NULL;
@@ -2685,10 +2683,7 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
              * SFLAG_CONVERTED: The conversion destination memory is freed after loading the surface
              * allocatedMemory == NULL: Not defined in the extension. Seems to disable client storage effectively
              */
-            gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
-            checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
             surface->flags &= ~SFLAG_CLIENT;
-            enable_client_storage = TRUE;
         }
         else
         {
@@ -2699,6 +2694,10 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
              * PBO. Instead use heapMemory, but get the alignment right. */
             mem = (BYTE *)(((ULONG_PTR)surface->resource.heapMemory
                     + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
+
+            gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
+            checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
+            disable_client_storage = TRUE;
         }
     }
 
@@ -2715,10 +2714,10 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
         checkGLcall("glTexImage2D");
     }
 
-    if (enable_client_storage)
+    if (disable_client_storage)
     {
-        gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
-        checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
+        gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
+        checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
     }
 }
 
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index a9cbafe..b4a8c64 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -92,12 +92,6 @@ void volume_load(const struct wined3d_volume *volume, struct wined3d_context *co
             volume->resource.width, volume->resource.height, volume->resource.depth,
             0, format->glFormat, format->glType, volume->resource.allocatedMemory));
     checkGLcall("glTexImage3D");
-
-    /* When adding code releasing volume->resource.allocatedMemory to save
-     * data keep in mind that GL_UNPACK_CLIENT_STORAGE_APPLE is enabled by
-     * default if supported(GL_APPLE_client_storage). Thus do not release
-     * volume->resource.allocatedMemory if GL_APPLE_client_storage is
-     * supported. */
 }
 
 /* Do not call while under the GL lock. */




More information about the wine-cvs mailing list