Merge pull request #44 from GloriousEggroll/upstream

wined3d-CSMT_Main: 9999-IfDefined fix
This commit is contained in:
GloriousEggroll 2018-02-19 20:45:38 -05:00 committed by GitHub
commit aec386ceb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,38 +6,11 @@ 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
+++ b/dlls/wined3d/cs.c
@@ -400,6 +400,9 @@ struct wined3d_cs_update_sub_resource
@@ -405,6 +405,9 @@ struct wined3d_cs_update_sub_resource
unsigned int sub_resource_idx;
struct wined3d_box box;
struct wined3d_sub_resource_data data;
@ -47,7 +20,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
};
struct wined3d_cs_add_dirty_texture_region
@@ -2247,6 +2250,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2255,6 +2258,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
unsigned int slice_pitch)
{
struct wined3d_cs_update_sub_resource *op;
@ -101,19 +74,21 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP);
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
@@ -2260,8 +2310,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2268,8 +2318,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
wined3d_resource_acquire(resource);
cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP);
- /* The data pointer may go away, so we need to wait until it is read.
- * Copying the data may be faster if it's small. */
+#if !defined(STAGING_CSMT)
/* The data pointer may go away, so we need to wait until it is read.
* Copying the data may be faster if it's small. */
+ /* The data pointer may go away, so we need to wait until it is read.
+ * Copying the data may be faster if it's small. */
+#endif /* STAGING_CSMT */
cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP);
}
@@ -2640,6 +2692,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_GENERATE_MIPS */ wined3d_cs_exec_generate_mips,
@@ -2450,6 +2504,14 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_GENERATE_MIPMAPS */ wined3d_cs_exec_generate_mipmaps,
};
+#if defined(STAGING_CSMT)
@ -123,10 +98,11 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+}
+
+#endif /* STAGING_CSMT */
+
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
{
if (size > (cs->data_size - cs->end))
@@ -2693,6 +2752,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
@@ -2503,6 +2565,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
static const struct wined3d_cs_ops wined3d_cs_st_ops =
{
@ -136,7 +112,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
wined3d_cs_st_require_space,
wined3d_cs_st_submit,
wined3d_cs_st_finish,
@@ -2726,6 +2788,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
@@ -2536,6 +2601,22 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
wined3d_cs_queue_submit(&cs->queue[queue_id], cs);
}
@ -155,10 +131,11 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+}
+
+#endif /* STAGING_CSMT */
+
static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs)
{
size_t queue_size = ARRAY_SIZE(queue->data);
@@ -2787,6 +2864,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
@@ -2597,6 +2678,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
return packet->data;
}
@ -175,7 +152,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
{
if (cs->thread_id == GetCurrentThreadId())
@@ -2806,6 +2893,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
@@ -2616,6 +2707,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
{
@ -299,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);
@ -314,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 */
@ -609,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;
}
@ -633,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;
@ -649,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
{