[PATCH 1/3] wined3d: Don't shift geometry for d3d10/11.
Stefan Dösinger
stefan at codeweavers.com
Thu Aug 5 12:56:56 CDT 2021
This fixes stay lines in World of Tanks' GameFace UI parts. The Metal backend
doesn't have an offset like this either.
Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
---
Other than fixing the todo_wine in test_fractional_viewport, this also fixes a
failure in d3d11's test_depth_bias that happens when viewport_array is not
supported.
I am not entirely sure what the -1 / 64 in get_projection_matrix was meant
for. AFAIU get_projection_matrix isn't called for d3d10+, so the path will
be entered for d3d9 when we have ARB_CLIP_CONTROL. In this case we don't
need to account for the half pixel offset (hence not setting it to 63/64),
and I also don't see a reason to nudge for filling rules in the proj matrix
and not by adjusting the values in viewport_miscpart_cc.
---
dlls/d3d11/tests/d3d11.c | 1 -
dlls/wined3d/state.c | 2 +-
dlls/wined3d/utils.c | 2 +-
dlls/wined3d/wined3d_private.h | 2 +-
4 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 6073fae26d9..1f797da1646 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -28153,7 +28153,6 @@ static void test_fractional_viewports(void)
ok(compare_float(v->x, expected.x, 0) && compare_float(v->y, expected.y, 0),
"Got fragcoord {%.8e, %.8e}, expected {%.8e, %.8e} at (%u, %u), offset %.8e.\n",
v->x, v->y, expected.x, expected.y, x, y, viewport_offsets[i]);
- todo_wine
ok(compare_float(v->z, expected.z, 2) && compare_float(v->w, expected.w, 2),
"Got texcoord {%.8e, %.8e}, expected {%.8e, %.8e} at (%u, %u), offset %.8e.\n",
v->z, v->w, expected.z, expected.w, x, y, viewport_offsets[i]);
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 8316269afcf..b94c04a79b4 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4233,7 +4233,7 @@ static void viewport_miscpart_cc(struct wined3d_context *context,
const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
/* See get_projection_matrix() in utils.c for a discussion about those values. */
float pixel_center_offset = context->d3d_info->wined3d_creation_flags
- & WINED3D_PIXEL_CENTER_INTEGER ? 63.0f / 128.0f : -1.0f / 128.0f;
+ & WINED3D_PIXEL_CENTER_INTEGER ? 63.0f / 128.0f : 0.0f;
struct wined3d_viewport vp[WINED3D_MAX_VIEWPORTS];
GLdouble depth_ranges[2 * WINED3D_MAX_VIEWPORTS];
GLfloat viewports[4 * WINED3D_MAX_VIEWPORTS];
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 4019dd4d812..69c6f073e96 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -5555,7 +5555,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
if (!clip_control && d3d_info->wined3d_creation_flags & WINED3D_PIXEL_CENTER_INTEGER)
center_offset = 63.0f / 64.0f;
else
- center_offset = -1.0f / 64.0f;
+ center_offset = 0.0f;
if (context->last_was_rhw)
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 86eae149306..0bf9e01ba42 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -5662,7 +5662,7 @@ static inline void shader_get_position_fixup(const struct wined3d_context *conte
if (context->d3d_info->wined3d_creation_flags & WINED3D_PIXEL_CENTER_INTEGER)
center_offset = 63.0f / 64.0f;
else
- center_offset = -1.0f / 64.0f;
+ center_offset = 0.0f;
for (i = 0; i < fixup_count; ++i)
{
--
2.31.1
More information about the wine-devel
mailing list