[PATCH 1/5] wined3d: Slightly offset the viewport in the ARB_clip_control case.

Matteo Bruni mbruni at codeweavers.com
Thu Oct 6 17:57:49 CDT 2016


Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
Match the preexisting behavior of the non-ARB_clip_control codepath,
mostly for the top-left filling convention point mentioned in
get_projection_matrix().

 dlls/wined3d/directx.c | 2 +-
 dlls/wined3d/state.c   | 4 +++-
 dlls/wined3d/utils.c   | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 5d91981..98b05c1 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3862,7 +3862,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, DWORD
 
         gl_info->gl_ops.gl.p_glGetIntegerv(GL_VIEWPORT_SUBPIXEL_BITS, &subpixel_bits);
         TRACE("Viewport supports %d subpixel bits.\n", subpixel_bits);
-        if (!subpixel_bits)
+        if (subpixel_bits < 8)
             gl_info->supported[ARB_VIEWPORT_ARRAY] = FALSE;
     }
     if (gl_info->supported[ARB_CLIP_CONTROL] && !gl_info->supported[ARB_VIEWPORT_ARRAY])
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 0333dd4..71f47d6 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4653,8 +4653,10 @@ static void viewport_miscpart_cc(struct wined3d_context *context,
 {
     const struct wined3d_rendertarget_view *depth_stencil = state->fb->depth_stencil;
     const struct wined3d_rendertarget_view *target = state->fb->render_targets[0];
+    /* See get_projection_matrix() in utils.c for a discussion about those
+     * values. */
     float pixel_center_offset = context->device->wined3d->flags
-            & WINED3D_PIXEL_CENTER_INTEGER ? 0.5f : 0.0f;
+            & WINED3D_PIXEL_CENTER_INTEGER ? 63.0f / 128.0f : -1.0f / 128.0f;
     const struct wined3d_gl_info *gl_info = context->gl_info;
     struct wined3d_viewport vp = state->viewport;
     unsigned int width, height;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index e65907a..8e83040 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4502,8 +4502,8 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
      * here besides the projection transformation itself:
      *   - We need to flip along the y-axis in case of offscreen rendering.
      *   - OpenGL Z range is {-Wc,...,Wc} while D3D Z range is {0,...,Wc}.
-     *   - D3D coordinates refer to pixel centers while GL coordinates refer
-     *     to pixel corners.
+     *   - <= D3D9 coordinates refer to pixel centers while GL coordinates
+     *     refer to pixel corners.
      *   - D3D has a top-left filling convention. We need to maintain this
      *     even after the y-flip mentioned above.
      * In order to handle the last two points, we translate by
-- 
2.7.3




More information about the wine-patches mailing list