[PATCH 1/4] wined3d: Fix the center offset in get_projection_matrix.

Stefan Dösinger stefan at codeweavers.com
Wed Sep 29 14:42:57 CDT 2021


If we have clip control, viewport_miscpart_cc applies both the half pixel
offset and the filling convention nudge. We always have integer pixel centers
in this <= d3d9-only codepath.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>

---

Taking d3d10+ pixel centers out of consideration here keeps the next patch
simpler because we don't have to account for the situation where we have
to apply the nudge only because we don't have clip control but also
somehow have GL-style pixel centers. It seems like a non-obvious set of
conditions for catching a case we know won't is dead code. Do add an ERR
though because it actually hardwires client lib knowledge into wined3d.
---
 dlls/wined3d/utils.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 4019dd4d812..0a1e0707359 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -5550,12 +5550,16 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
      * driver, but small enough to prevent it from interfering with any
      * anti-aliasing. */
 
+    /* Projection matrices are <= d3d9, which all have integer pixel centers. */
+    if (!(d3d_info->wined3d_creation_flags & WINED3D_PIXEL_CENTER_INTEGER))
+        ERR("Did not expect to enter this codepath without WINED3D_PIXEL_CENTER_INTEGER.\n");
+
     clip_control = d3d_info->clip_control;
     flip = !clip_control && context->render_offscreen;
-    if (!clip_control && d3d_info->wined3d_creation_flags & WINED3D_PIXEL_CENTER_INTEGER)
+    if (!clip_control)
         center_offset = 63.0f / 64.0f;
     else
-        center_offset = -1.0f / 64.0f;
+        center_offset = 0.0f;
 
     if (context->last_was_rhw)
     {
-- 
2.32.0




More information about the wine-devel mailing list