wined3d-CSMT_Main: Initialize full state.

This commit is contained in:
Sebastian Lackner 2017-02-19 18:17:33 +01:00
parent 884a25c8bf
commit c55ebfa2a4
4 changed files with 39 additions and 53 deletions

View File

@ -8400,7 +8400,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for query polls.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Don'\''t call glFinish before swapping.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Use an event to block the worker thread when it is idle.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Unset some objects in state_init_default.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for get_dc / release_dc.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Do not immediately submit stateblock updates.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for update_sub_resource.", 1 },';
@ -8408,6 +8407,7 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then
printf '%s\n' '+ { "Michael Müller", "wined3d: Don'\''t wait for events that have not been issued yet.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Reset context before destruction.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Synchronize before resizing swapchain context array.", 1 },';
printf '%s\n' '+ { "Michael Müller", "wined3d: Set all default state values to zero.", 1 },';
) >> "$patchlist"
fi

View File

@ -1,35 +0,0 @@
From 061c839f5bc943c509341225fa95973767f57664 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 1 Oct 2013 21:30:07 +0200
Subject: wined3d: Unset some objects in state_init_default.
FIXME: Many more are needed.
FIXME2: Is this still needed?
-> Yes, rendering bugs in second level of FarCry.
---
dlls/wined3d/stateblock.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index a823ccb3168..463ccc91561 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1342,7 +1342,15 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
state->sampler_states[i][WINED3D_SAMP_ELEMENT_INDEX] = 0;
/* TODO: Vertex offset in the presampled displacement map. */
state->sampler_states[i][WINED3D_SAMP_DMAP_OFFSET] = 0;
+ state->textures[i] = NULL;
}
+
+ state->index_buffer = NULL;
+ for (i = 0; i < sizeof(state->streams) / sizeof(*state->streams); i++)
+ memset(&state->streams[i], 0, sizeof(state->streams[i]));
+
+ state->shader[WINED3D_SHADER_TYPE_VERTEX] = NULL;
+ state->shader[WINED3D_SHADER_TYPE_PIXEL] = NULL;
}
HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info,
--
2.11.0

View File

@ -0,0 +1,30 @@
From e01ccb1f50492054732c4234a963832581a1aa8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 19 Feb 2017 17:38:00 +0100
Subject: wined3d: Set all default state values to zero.
This patch is necessary as some of the values contain random data which is
especially dangerous when the CS has its own state and the values differ.
The patch fixes geometry errors in the second level of FarCry and color
keying in the Motoracer 2.
---
dlls/wined3d/stateblock.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 463ccc91561..263b200c762 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1358,6 +1358,9 @@ HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl
{
unsigned int i;
+ if (flags & WINED3D_STATE_INIT_DEFAULT)
+ memset(state, 0, sizeof(*state));
+
state->flags = flags;
for (i = 0; i < LIGHTMAP_SIZE; i++)
--
2.11.0

View File

@ -4356,38 +4356,29 @@ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
}
if (stateblock->changed.indices)
@@ -1314,35 +1353,77 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
state->sampler_states[i][WINED3D_SAMP_ELEMENT_INDEX] = 0;
/* TODO: Vertex offset in the presampled displacement map. */
state->sampler_states[i][WINED3D_SAMP_DMAP_OFFSET] = 0;
+#if !defined(STAGING_CSMT)
@@ -1317,32 +1356,68 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
}
}
+#if !defined(STAGING_CSMT)
void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info,
DWORD flags)
+#else /* STAGING_CSMT */
+ state->textures[i] = NULL;
+ }
+
+ state->index_buffer = NULL;
+ for (i = 0; i < sizeof(state->streams) / sizeof(*state->streams); i++)
+ memset(&state->streams[i], 0, sizeof(state->streams[i]));
+
+ state->shader[WINED3D_SHADER_TYPE_VERTEX] = NULL;
+ state->shader[WINED3D_SHADER_TYPE_PIXEL] = NULL;
+}
+
+HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info,
+ const struct wined3d_d3d_info *d3d_info, DWORD flags)
+#endif /* STAGING_CSMT */
{
unsigned int i;
state->flags = flags;
+#if !defined(STAGING_CSMT)
state->flags = flags;
state->fb = fb;
+#else /* STAGING_CSMT */
+ if (flags & WINED3D_STATE_INIT_DEFAULT)
+ memset(state, 0, sizeof(*state));
+
+ state->flags = flags;
+#endif /* STAGING_CSMT */
for (i = 0; i < LIGHTMAP_SIZE; i++)