diff -urN wine-1.7.3-orig/dlls/wined3d/glsl_shader.c wine-1.7.3/dlls/wined3d/glsl_shader.c
--- wine-1.7.3-orig/dlls/wined3d/glsl_shader.c	2013-09-28 03:32:14 +0900
+++ wine-1.7.3/dlls/wined3d/glsl_shader.c	2013-10-10 06:52:24 +0900
@@ -2603,15 +2603,16 @@
 
     shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src0_param);
 
+    /* NB: -1e10 is a workaround for http://bugs.winehq.org/show_bug.cgi?id=34266 */
     if (dst_size > 1)
     {
-        shader_addline(buffer, "vec%u(log2(abs(%s))));\n",
-                dst_size, src0_param.param_str);
+        shader_addline(buffer, "mix(vec%u(log2(abs(%s))), vec%u(0.0), equal(vec%u(%s), vec%u(0.0))));\n",
+                dst_size, src0_param.param_str, dst_size, dst_size, src0_param.param_str, dst_size);
     }
     else
     {
-        shader_addline(buffer, "log2(abs(%s)));\n",
-                src0_param.param_str);
+        shader_addline(buffer, "%s == 0.0 ? -1.0e10 : log2(abs(%s)));\n",
+                src0_param.param_str, src0_param.param_str);
     }
 }
 
@@ -2776,15 +2777,16 @@
     mask_size = shader_glsl_get_write_mask_size(write_mask);
     shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_3, &src_param);
 
+    /* NB: 1e10 is a workaround for http://bugs.winehq.org/show_bug.cgi?id=34266 */
     if (mask_size > 1)
     {
-        shader_addline(ins->ctx->buffer, "vec%u(1.0 / %s));\n",
-                mask_size, src_param.param_str);
+        shader_addline(ins->ctx->buffer, "mix(vec%u(1.0 / %s), vec%u(0.0), equal(vec%u(%s), vec%u(0.0))));\n",
+                mask_size, src_param.param_str, mask_size, mask_size, src_param.param_str, mask_size);
     }
     else
     {
-        shader_addline(ins->ctx->buffer, "1.0 / %s);\n",
-                src_param.param_str);
+        shader_addline(ins->ctx->buffer, "%s == 0.0 ? 1.0e10 : 1.0 / %s);\n",
+                src_param.param_str, src_param.param_str);
     }
 }
 
@@ -2800,15 +2802,16 @@
 
     shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_3, &src_param);
 
+    /* NB: 1e10 is a workaround for http://bugs.winehq.org/show_bug.cgi?id=34266 */
     if (mask_size > 1)
     {
-        shader_addline(buffer, "vec%u(inversesqrt(abs(%s))));\n",
-                mask_size, src_param.param_str);
+        shader_addline(buffer, "mix(vec%u(inversesqrt(abs(%s))), vec%u(0.0), equal(vec%u(%s), vec%u(0.0))));\n",
+                mask_size, src_param.param_str, mask_size, mask_size, src_param.param_str, mask_size);
     }
     else
     {
-        shader_addline(buffer, "inversesqrt(abs(%s)));\n",
-                src_param.param_str);
+        shader_addline(buffer, "%s == 0.0 ? 1.0e10 : inversesqrt(abs(%s)));\n",
+                src_param.param_str, src_param.param_str);
     }
 }
 
@@ -4346,7 +4349,8 @@
 
     shader_buffer_clear(buffer);
 
-    shader_addline(buffer, "#version 120\n");
+    /* NB: 120 -> 130 for http://bugs.winehq.org/show_bug.cgi?id=34266 workaround */
+    shader_addline(buffer, "#version 130\n");
 
     if (ps_major < 3)
     {
@@ -4497,7 +4501,8 @@
     priv_ctx.cur_ps_args = args;
     priv_ctx.cur_np2fixup_info = np2fixup_info;
 
-    shader_addline(buffer, "#version 120\n");
+    /* NB: 120 -> 130 for http://bugs.winehq.org/show_bug.cgi?id=34266 workaround */
+    shader_addline(buffer, "#version 130\n");
 
     if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
         shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n");
@@ -4556,7 +4561,8 @@
     /* Create the hw GLSL shader program and assign it as the shader->prgId */
     GLhandleARB shader_obj = GL_EXTCALL(glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB));
 
-    shader_addline(buffer, "#version 120\n");
+    /* NB: 120 -> 130 for http://bugs.winehq.org/show_bug.cgi?id=34266 workaround */
+    shader_addline(buffer, "#version 130\n");
 
     if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
         shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n");
@@ -4627,7 +4633,8 @@
 
     shader_id = GL_EXTCALL(glCreateShaderObjectARB(GL_GEOMETRY_SHADER_ARB));
 
-    shader_addline(buffer, "#version 120\n");
+    /* NB: 120 -> 130 for http://bugs.winehq.org/show_bug.cgi?id=34266 workaround */
+    shader_addline(buffer, "#version 130\n");
 
     if (gl_info->supported[ARB_GEOMETRY_SHADER4])
         shader_addline(buffer, "#extension GL_ARB_geometry_shader4 : enable\n");
