Matteo Bruni : wined3d: Handle per-vertex point size in the GLSL FFP replacement.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jun 17 10:18:11 CDT 2015


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

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Tue Jun 16 22:45:37 2015 +0200

wined3d: Handle per-vertex point size in the GLSL FFP replacement.

---

 dlls/d3d8/tests/visual.c       | 2 +-
 dlls/d3d9/tests/visual.c       | 2 +-
 dlls/wined3d/context.c         | 3 ++-
 dlls/wined3d/glsl_shader.c     | 5 +++--
 dlls/wined3d/utils.c           | 2 ++
 dlls/wined3d/wined3d_private.h | 3 ++-
 6 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index db9fb79..da20b84 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -6475,7 +6475,7 @@ static void test_pointsize(void)
         {decl, &vs1, &ps1, D3DFVF_XYZ, 32, 32},
         {NULL, &novs, &ps1, D3DFVF_XYZ, 32, 62},
         {decl, &vs1, &nops, D3DFVF_XYZ, 32, 32},
-        /* {NULL, &novs, &nops, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 48}, */
+        {NULL, &novs, &nops, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 48},
         {decl_psize, &vs1_psize, &ps1, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 24},
     };
     static const struct
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index f9cb71c..491f007 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -10325,7 +10325,7 @@ static void pointsize_test(void)
         {&vs1, &ps2_zw, D3DFVF_XYZ, 32, 32, TRUE, FALSE},
         {&vs3, &ps3, D3DFVF_XYZ, 32, 32, FALSE, TRUE},
         {&vs3, &ps3_zw, D3DFVF_XYZ, 32, 32, TRUE, FALSE},
-        /* {&novs, &nops, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 48, FALSE, FALSE}, */
+        {&novs, &nops, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 48, FALSE, FALSE},
         {&vs1_psize, &ps1, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 24, FALSE, FALSE},
         {&vs3_psize, &ps3, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 24, FALSE, TRUE},
     };
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index d88995b..9cc7c11 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2785,6 +2785,7 @@ void context_stream_info_from_declaration(struct wined3d_context *context,
     /* We need to deal with frequency data! */
     struct wined3d_vertex_declaration *declaration = state->vertex_declaration;
     BOOL use_vshader = use_vs(state);
+    BOOL generic_attributes = context->d3d_info->ffp_generic_attributes;
     unsigned int i;
 
     stream_info->use_map = 0;
@@ -2829,7 +2830,7 @@ void context_stream_info_from_declaration(struct wined3d_context *context,
         }
         else
         {
-            if (!element->ffp_valid)
+            if (!generic_attributes && !element->ffp_valid)
             {
                 WARN("Skipping unsupported fixed function element of format %s and usage %s.\n",
                         debug_d3dformat(element->format->id), debug_d3ddeclusage(element->usage));
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index fa96fbe..37a8f87 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -5867,9 +5867,10 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct wined3d_string_buffe
 
     if (settings->point_size)
     {
-        shader_addline(buffer, "gl_PointSize = ffp_point.size / sqrt(ffp_point.c_att"
+        shader_addline(buffer, "gl_PointSize = %s / sqrt(ffp_point.c_att"
                 " + ffp_point.l_att * length(ec_pos.xyz)"
-                " + ffp_point.q_att * dot(ec_pos.xyz, ec_pos.xyz));\n");
+                " + ffp_point.q_att * dot(ec_pos.xyz, ec_pos.xyz));\n",
+                settings->per_vertex_point_size ? "ffp_attrib_psize" : "ffp_point.size");
         shader_addline(buffer, "gl_PointSize = clamp(gl_PointSize, ffp_point.size_min, ffp_point.size_max);\n");
     }
 
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 42df5e6..a9231a8 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4514,6 +4514,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
 
         settings->transformed = 1;
         settings->point_size = state->gl_primitive_type == GL_POINTS;
+        settings->per_vertex_point_size = !!(si->use_map & 1 << WINED3D_FFP_PSIZE);
         if (!state->render_states[WINED3D_RS_FOGENABLE])
             settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
         else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
@@ -4539,6 +4540,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
     settings->lighting = !!state->render_states[WINED3D_RS_LIGHTING];
     settings->localviewer = !!state->render_states[WINED3D_RS_LOCALVIEWER];
     settings->point_size = state->gl_primitive_type == GL_POINTS;
+    settings->per_vertex_point_size = !!(si->use_map & 1 << WINED3D_FFP_PSIZE);
 
     if (state->render_states[WINED3D_RS_COLORVERTEX] && (si->use_map & (1 << WINED3D_FFP_DIFFUSE)))
     {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9dd9443..c184b72 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1894,10 +1894,11 @@ struct wined3d_ffp_vs_settings
     DWORD lighting        : 1;
     DWORD localviewer     : 1;
     DWORD point_size      : 1;
+    DWORD per_vertex_point_size : 1;
     DWORD fog_mode        : 2;
     DWORD texcoords       : 8;  /* MAX_TEXTURES */
     DWORD ortho_fog       : 1;
-    DWORD padding         : 14;
+    DWORD padding         : 13;
 
     DWORD texgen[MAX_TEXTURES];
 };




More information about the wine-cvs mailing list