Am 11.02.2019 um 14:48 schrieb Daniel Ansorregui <mailszeros@gmail.com>:

@@ -9879,6 +9883,7 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
            case WINED3D_GL_RES_TYPE_TEX_1D:
                texture_function = "texture1D";
                coord_mask = "x";
+                fetch4 = FALSE;
                break;
            case WINED3D_GL_RES_TYPE_TEX_2D:
                texture_function = "texture2D";
@@ -9887,6 +9892,9 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
            case WINED3D_GL_RES_TYPE_TEX_3D:
                texture_function = "texture3D";
                coord_mask = "xyz";
+                if (fetch4)
+                    FIXME("Unsupported Fetch4 and texture3D sampling");
+                fetch4 = FALSE;
                break;
            case WINED3D_GL_RES_TYPE_TEX_CUBE:
                texture_function = "textureCube";
@@ -9901,11 +9909,24 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
                texture_function = "";
                coord_mask = "xyzw";
                proj = FALSE;
+                fetch4 = FALSE;
I think this is dead code, now that you are filtering for WINED3D_GL_RES_TYPE_TEX_2D or WINED3D_GL_RES_TYPE_TEX_RECT in gen_ffp_frag_op?

        else if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT3)
        {
-            shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ffp_texcoord[%u].xyz);\n",
-                    stage, texture_function, proj ? "Proj" : "", stage, stage);
+            shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ffp_texcoord[%u].xyz%s);\n", stage,
+                    texture_function, proj ? "Proj" : "", stage, stage, offset.buffer);
        }
        else
        {
-            shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ffp_texcoord[%u].%s%s);\n",
-                    stage, texture_function, proj ? "Proj" : "", stage, stage, coord_mask, proj ? "w" : "");
+            shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ffp_texcoord[%u].%s%s", stage,
+                    texture_function, proj ? "Proj" : "", stage, stage, coord_mask, proj ? "w" : "");
+            if (fetch4_proj)
+                shader_addline(buffer, " / ffp_texcoord[%u].w", stage);
+            shader_addline(buffer, "%s);\n", offset.buffer);
Why don't you have to do the manual divide in the WINED3D_PROJECTION_COUNT3 case too? (in that case, divide by /z)? Your code may be right, I am not 100% sure about it.