From 1bed10abee7d2439a5c7358596c860c454f06b53 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Fri, 7 Oct 2016 00:57:49 +0200 Subject: [PATCH] wined3d: Slightly offset the viewport in the ARB_clip_control case. Signed-off-by: Matteo Bruni Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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 5d91981d169..98b05c1ef13 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 0333dd46098..71f47d695ec 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 e65907acbb6..8e83040dc7e 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.11.4.GIT