All pastes #912306 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-02-21 08:04 UTC
rendered paste body
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index f1217d9..509aa00 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -38,7 +38,7 @@ static void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4]
 static inline void clear_unused_channels(IWineD3DSurfaceImpl *This);
 
 static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This) {
-    GLint active_texture;
+    GLint active_texture = 0;
 
     /* We don't need a specific texture unit, but after binding the texture the current unit is dirty.
      * Read the unit back instead of switching to 0, this avoids messing around with the state manager's
@@ -48,7 +48,8 @@ static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This) {
      */
     if (GL_SUPPORT(ARB_MULTITEXTURE)) {
         glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
-        active_texture -= GL_TEXTURE0_ARB;
+        if (active_texture == 0) ERR("GL_ACTIVE_TEXTURE cannot be read! Defaulting to 0. \n");
+        else active_texture -= GL_TEXTURE0_ARB;
     } else {
         active_texture = 0;
     }