Index: /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c	(revision 43332)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c	(revision 43333)
@@ -340,5 +340,5 @@
 static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_info, GLhandleARB program)
 {
-    GLint i, object_count, source_size;
+    GLint i, object_count;
     GLhandleARB *objects;
     char *source = NULL;
@@ -3966,4 +3966,24 @@
 }
 
+static void generate_texcoord_assignment(struct wined3d_shader_buffer *buffer, IWineD3DVertexShaderImpl *vs, IWineD3DPixelShaderImpl *ps)
+{
+    DWORD map;
+    unsigned int i;
+    char reg_mask[6];
+
+    for (i = 0, map = ps->baseShader.reg_maps.texcoord; map && i < min(8, MAX_REG_TEXCRD); map >>= 1, ++i)
+    {
+        if (!map & 1)
+            continue;
+
+        /* so far we assume that if texcoord_mask has any write flags, they are assigned appropriately with pixel shader */
+        if ((vs->baseShader.reg_maps.texcoord_mask[i]) & WINED3DSP_WRITEMASK_ALL)
+            continue;
+
+        shader_glsl_write_mask_to_str(WINED3DSP_WRITEMASK_ALL, reg_mask);
+        shader_addline(buffer, "gl_TexCoord[%u]%s = gl_MultiTexCoord%u%s;\n", i, reg_mask, i, reg_mask);
+    }
+}
+
 /* GL locking is done by the caller */
 static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer *buffer,
@@ -4003,5 +4023,7 @@
             shader_addline(buffer, "}\n");
         } else {
-            shader_addline(buffer, "void order_ps_input() { /* do nothing */ }\n");
+            shader_addline(buffer, "void order_ps_input() {\n");
+            generate_texcoord_assignment(buffer, vs, ps);
+            shader_addline(buffer, "}\n");
         }
     } else if(ps_major < 3 && vs_major >= 3) {
@@ -4637,4 +4659,12 @@
     GL_EXTCALL(glUseProgramObjectARB(programId));
     checkGLcall("glUseProgramObjectARB(programId)");
+
+#ifdef DEBUG_misha
+    {
+        GLint programIdTest = -1;
+        glGetIntegerv(GL_CURRENT_PROGRAM,  &programIdTest);
+        Assert(programIdTest == programId);
+    }
+#endif
 
     /* Load the vertex and pixel samplers now. The function that finds the mappings makes sure
@@ -4773,4 +4803,11 @@
     GL_EXTCALL(glUseProgramObjectARB(program_id));
     checkGLcall("glUseProgramObjectARB");
+#ifdef DEBUG_misha
+    {
+        GLint programIdTest = -1;
+        glGetIntegerv(GL_CURRENT_PROGRAM,  &programIdTest);
+        Assert(programIdTest == program_id);
+    }
+#endif
 
     /* In case that NP2 texcoord fixup data is found for the selected program, trigger a reload of the
@@ -4795,7 +4832,21 @@
         loc = GL_EXTCALL(glGetUniformLocationARB(*blt_program, "sampler"));
         GL_EXTCALL(glUseProgramObjectARB(*blt_program));
+#ifdef DEBUG_misha
+        {
+            GLint programIdTest = -1;
+            glGetIntegerv(GL_CURRENT_PROGRAM,  &programIdTest);
+            Assert(programIdTest == *blt_program);
+        }
+#endif
         GL_EXTCALL(glUniform1iARB(loc, 0));
     } else {
         GL_EXTCALL(glUseProgramObjectARB(*blt_program));
+#ifdef DEBUG_misha
+        {
+            GLint programIdTest = -1;
+            glGetIntegerv(GL_CURRENT_PROGRAM,  &programIdTest);
+            Assert(programIdTest == *blt_program);
+        }
+#endif
     }
 }
@@ -4813,4 +4864,11 @@
     GL_EXTCALL(glUseProgramObjectARB(program_id));
     checkGLcall("glUseProgramObjectARB");
+#ifdef DEBUG_misha
+    {
+        GLint programIdTest = -1;
+        glGetIntegerv(GL_CURRENT_PROGRAM,  &programIdTest);
+        Assert(programIdTest == program_id);
+    }
+#endif
 }
 
