Stefan Dösinger : wined3d: Do not allocate compressed surfaces with glTexImage2D.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Feb 14 09:25:37 CST 2007
Module: wine
Branch: master
Commit: b90a665d2049d0b2744886395bec3a8d215aaa80
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b90a665d2049d0b2744886395bec3a8d215aaa80
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Tue Feb 13 20:28:25 2007 +0100
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);
More information about the wine-cvs
mailing list