dlls/wined3d/directx.c -- bugfix

Gerald Pfeifer gerald at pfeifer.com
Fri Nov 30 19:53:10 CST 2007


The max() expression below would not work as expected because 
gl_info->max_combined_samplers is defined as UINT in 
include/wine/wined3d_gl.h, so this looks like a genuine fix.

Gerald

ChangeLog:
Fix handling of a special case in IWineD3DImpl_FillGLCaps() and adjust
type of loop variable.

Index: dlls/wined3d/directx.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/directx.c,v
retrieving revision 1.297
diff -u -3 -p -r1.297 directx.c
--- dlls/wined3d/directx.c	29 Nov 2007 16:32:54 -0000	1.297
+++ dlls/wined3d/directx.c	1 Dec 2007 01:50:43 -0000
@@ -464,7 +464,7 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_
     GLfloat     gl_floatv[2];
     int         major = 1, minor = 0;
     BOOL        return_value = TRUE;
-    int         i;
+    unsigned    i;      
     HDC         hdc;
     unsigned int vidmem=0;
 
@@ -792,7 +792,11 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_
                     FIXME("OpenGL implementation supports %u vertex samplers and %u total samplers\n",
                           gl_info->max_vertex_samplers, gl_info->max_combined_samplers);
                     FIXME("Expected vertex samplers + MAX_TEXTURES(=8) > combined_samplers\n");
-                    gl_info->max_vertex_samplers = max(0, gl_info->max_combined_samplers - MAX_TEXTURES);
+                    if( gl_info->max_combined_samplers > MAX_TEXTURES )
+                        gl_info->max_vertex_samplers =
+                            gl_info->max_combined_samplers - MAX_TEXTURES;
+                    else
+                        gl_info->max_vertex_samplers = 0;
                 }
             } else {
                 gl_info->max_combined_samplers = gl_info->max_fragment_samplers;



More information about the wine-patches mailing list