wined3d-CSMT_Main: patch corrections-2

This commit is contained in:
gloriouseggroll 2018-02-19 20:23:28 -05:00
parent 15d6ebeab2
commit 8030515325

View File

@ -6,34 +6,6 @@ Based on patches by:
Sebastian Lackner <sebastian@fds-team.de>
Stefan Dösinger <stefan@codeweavers.com>
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1219,6 +1219,9 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
const struct wined3d_box *box, const void *data)
{
UINT offset, size;
+#if defined(STAGING_CSMT)
+ DWORD flags = 0;
+#endif /* STAGING_CSMT */
HRESULT hr;
BYTE *ptr;
@@ -1233,7 +1236,14 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
size = buffer->resource.size;
}
+#if !defined(STAGING_CSMT)
if (FAILED(hr = wined3d_buffer_map(buffer, offset, size, &ptr, 0)))
+#else /* STAGING_CSMT */
+ if (offset == 0 && size == buffer->resource.size)
+ flags = WINED3D_MAP_DISCARD;
+
+ if (FAILED(hr = wined3d_buffer_map(buffer, offset, size, &ptr, flags)))
+#endif /* STAGING_CSMT */
return hr;
memcpy(ptr, data, size);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 2f77c7b0b7..e8bb63ef3b 100644
--- a/dlls/wined3d/cs.c
@ -304,14 +276,14 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2410,7 +2410,11 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
@@ -2309,7 +2461,11 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
/* Don't use PBOs for converted surfaces. During PBO conversion we look at
* WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is
* getting called. */
+#if !defined(STAGING_CSMT)
if ((format.convert || conversion) && texture->sub_resources[sub_resource_idx].buffer_object)
if ((format.conv_byte_count || conversion) && texture->sub_resources[sub_resource_idx].buffer_object)
+#else /* STAGING_CSMT */
+ if ((format.convert || conversion) && texture->sub_resources[sub_resource_idx].buffer)
+ if ((format.conv_byte_count || conversion) && texture->sub_resources[sub_resource_idx].buffer)
+#endif /* STAGING_CSMT */
{
TRACE("Removing the pbo attached to surface %p.\n", surface);
@ -319,12 +291,13 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -483,7 +483,11 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
@@ -471,7 +475,11 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
if (swapchain->render_to_fbo)
swapchain_blit(swapchain, context, src_rect, dst_rect);
}
- if (swapchain->num_contexts > 1)
+#if !defined(STAGING_CSMT)
if (swapchain->num_contexts > 1)
+ if (swapchain->num_contexts > 1)
+#else /* STAGING_CSMT */
+ if (swapchain->num_contexts > 1 && !wined3d_settings.cs_multithreaded)
+#endif /* STAGING_CSMT */
@ -614,17 +587,17 @@ diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
struct wined3d_settings wined3d_settings =
{
+#if !defined(STAGING_CSMT)
FALSE, /* No multithreaded CS by default. */
+ FALSE, /* No multithreaded CS by default. */
+#else /* STAGING_CSMT */
+ TRUE, /* Multithreaded CS by default. */
TRUE, /* Multithreaded CS by default. */
+#endif /* STAGING_CSMT */
FALSE, /* explicit_gl_version */
MAKEDWORD_VERSION(1, 0), /* Default to legacy OpenGL */
TRUE, /* Use of GLSL enabled by default */
ORM_FBO, /* Use FBOs to do offscreen rendering */
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2860,6 +2860,16 @@ static inline BOOL wined3d_dualblend_enabled(const struct wined3d_state *state,
@@ -2882,6 +2882,17 @@ static inline BOOL wined3d_dualblend_enabled(const struct wined3d_state *state,
return FALSE;
}
@ -638,10 +611,11 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
+};
+
+#endif /* STAGING_CSMT */
#define WINED3D_UNMAPPED_STAGE ~0u
/* Multithreaded flag. Removed from the public header to signal that
@@ -2971,6 +2981,12 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
+
struct wined3d_dummy_textures
{
GLuint tex_2d;
@@ -2973,6 +3007,12 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
@ -654,19 +628,20 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -3158,7 +3174,11 @@ struct wined3d_texture
@@ -3161,7 +3203,11 @@ struct wined3d_texture
unsigned int map_count;
DWORD locations;
- GLuint buffer_object;
+#if !defined(STAGING_CSMT)
GLuint buffer_object;
+ GLuint buffer_object;
+#else /* STAGING_CSMT */
+ struct wined3d_gl_bo *buffer;
+#endif /* STAGING_CSMT */
} sub_resources[1];
};
@@ -3474,6 +3494,9 @@ struct wined3d_cs_queue
@@ -3476,6 +3522,9 @@ struct wined3d_cs_queue
struct wined3d_cs_ops
{