[10/10] WineD3D: Do not allocate compressed surfaces with
glTexImage2D
Stefan Dösinger
stefan at codeweavers.com
Tue Feb 13 13:28:25 CST 2007
Allocating compressed textures with glTexImage2D causes issues with fglrx,
macos drivers and the open source radeon driver. glCompressedTexImage does
not accept NULL pointers like glTexImage2D does, so surface_allocate_surface
does nothing for compressed textures and surface_upload_data always
respecifies the texture
-------------- next part --------------
From fbc8ecf4b043b3cd316327801d58e0e7bb1f7f8f Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Wed, 31 Jan 2007 13:57:51 +0100
Subject: [PATCH] WineD3D: Do not allocate compressed surfaces with glTexImage2D
---
dlls/wined3d/surface.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index ffdc55d..149ec02 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -168,8 +168,12 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, GLsizei width, GLsize
} else {
TRACE("(%p) : Calling glCompressedTexSubImage2D w %d, h %d, data %p\n", This, width, height, data);
ENTER_GL();
- GL_EXTCALL(glCompressedTexSubImage2DARB(This->glDescription.target, This->glDescription.level, 0, 0, width, height,
- This->glDescription.glFormatInternal, This->resource.size, data));
+ /* glCompressedTexSubImage2D for uploading and glTexImage2D for allocating does not work well on some drivers(r200 dri, MacOS ATI driver)
+ * glCompressedTexImage2D does not accept NULL pointers. So for compressed textures surface_allocate_surface does nothing, and this
+ * function uses glCompressedTexImage2D instead of the SubImage call
+ */
+ GL_EXTCALL(glCompressedTexImage2DARB(This->glDescription.target, This->glDescription.level, This->glDescription.glFormatInternal,
+ width, height, 0 /* border */, This->resource.size, data));
checkGLcall("glCompressedTexSubImage2D");
LEAVE_GL();
}
@@ -186,6 +190,14 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, GLenum internal,
TRACE("(%p) : Creating surface (target %#x) level %d, d3d format %s, internal format %#x, width %d, height %d, gl format %#x, gl type=%#x\n", This,
This->glDescription.target, This->glDescription.level, debug_d3dformat(This->resource.format), internal, width, height, format, type);
+ 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) {
+ /* glCompressedTexImage2D does not accept NULL pointers, so we cannot allocate a compressed texture without uploading data */
+ TRACE("Not allocating compressed surfaces, surface_upload_data will specify them\n");
+ return;
+ }
+
ENTER_GL();
glTexImage2D(This->glDescription.target, This->glDescription.level, internal, width, height, 0, format, type, NULL);
--
1.4.4.3
More information about the wine-patches
mailing list