Matteo Bruni : wined3d: Output all the texture coordinates in the FFP replacement VS when there are enough varyings.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Oct 7 10:00:49 CDT 2015


Module: wine
Branch: master
Commit: 09eda02b6896f5fe4ca7db5e1c13cbc67f8118e8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=09eda02b6896f5fe4ca7db5e1c13cbc67f8118e8

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Tue Oct  6 14:24:22 2015 +0200

wined3d: Output all the texture coordinates in the FFP replacement VS when there are enough varyings.

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>

---

 dlls/wined3d/glsl_shader.c     | 12 ++++++------
 dlls/wined3d/utils.c           | 11 +++++++++--
 dlls/wined3d/wined3d_private.h |  4 ++--
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index f38111f..5dfe0fa 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -6803,7 +6803,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
         struct glsl_ffp_vertex_shader *ffp_shader;
         struct wined3d_ffp_vs_settings settings;
 
-        wined3d_ffp_get_vs_settings(state, &context->stream_info, &settings);
+        wined3d_ffp_get_vs_settings(context, state, &settings);
         ffp_shader = shader_glsl_find_ffp_vertex_shader(priv, gl_info, &settings);
         vs_id = ffp_shader->id;
         vs_list = &ffp_shader->linked_programs;
@@ -7971,11 +7971,11 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context,
 
         context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_TEXMATRIX;
 
-        /* Because of settings->texcoords, we have to always regenerate the
-         * vertex shader on a vdecl change.
-         * TODO: Just always output all the texcoords when there are enough
-         * varyings available to drop the dependency. */
-        context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
+        /* Because of settings->texcoords, we have to regenerate the vertex
+         * shader on a vdecl change if there aren't enough varyings to just
+         * always output all the texture coordinates. */
+        if (gl_info->limits.glsl_varyings < wined3d_max_compat_varyings(gl_info))
+            context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
 
         if (use_ps(state)
                 && state->shader[WINED3D_SHADER_TYPE_PIXEL]->reg_maps.shader_version.major == 1
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 41e72fe..9c4fdd9 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4825,9 +4825,12 @@ const struct wine_rb_functions wined3d_ffp_frag_program_rb_functions =
     ffp_frag_program_key_compare,
 };
 
-void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct wined3d_stream_info *si,
-        struct wined3d_ffp_vs_settings *settings)
+void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
+        const struct wined3d_state *state, struct wined3d_ffp_vs_settings *settings)
 {
+    const struct wined3d_stream_info *si = &context->stream_info;
+    const struct wined3d_gl_info *gl_info = context->gl_info;
+    const struct wined3d_d3d_info *d3d_info = context->d3d_info;
     unsigned int coord_idx, i;
 
     if (si->position_transformed)
@@ -4851,6 +4854,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
                 settings->texcoords |= 1u << i;
             settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
         }
+        if (d3d_info->limits.varying_count >= wined3d_max_compat_varyings(gl_info))
+            settings->texcoords = (1u << MAX_TEXTURES) - 1;
         return;
     }
 
@@ -4900,6 +4905,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
             settings->texcoords |= 1u << i;
         settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
     }
+    if (d3d_info->limits.varying_count >= wined3d_max_compat_varyings(gl_info))
+        settings->texcoords = (1u << MAX_TEXTURES) - 1;
 
     settings->light_type = 0;
     for (i = 0; i < MAX_ACTIVE_LIGHTS; ++i)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d147199..3071726 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1939,8 +1939,8 @@ struct wined3d_ffp_vs_desc
     struct wined3d_ffp_vs_settings settings;
 };
 
-void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct wined3d_stream_info *si,
-        struct wined3d_ffp_vs_settings *settings) DECLSPEC_HIDDEN;
+void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
+        const struct wined3d_state *state, struct wined3d_ffp_vs_settings *settings) DECLSPEC_HIDDEN;
 
 struct wined3d
 {




More information about the wine-cvs mailing list