mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
wined3d-CSMT_Main: initial patch corrections
This commit is contained in:
parent
669232e38f
commit
15d6ebeab2
@ -6,10 +6,39 @@ 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;
|
||||
@ -19,7 +48,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;
|
||||
@ -73,19 +102,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)
|
||||
@ -95,10 +126,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 =
|
||||
{
|
||||
@ -108,7 +140,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);
|
||||
}
|
||||
|
||||
@ -127,10 +159,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;
|
||||
}
|
||||
|
||||
@ -147,7 +180,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 =
|
||||
{
|
||||
@ -271,14 +304,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
|
||||
@@ -2461,7 +2461,11 @@ static BOOL surface_load_texture(struct
|
||||
@@ -2410,7 +2410,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.conv_byte_count || conversion) && texture->sub_resources[sub_resource_idx].buffer_object)
|
||||
if ((format.convert || conversion) && texture->sub_resources[sub_resource_idx].buffer_object)
|
||||
+#else /* STAGING_CSMT */
|
||||
+ if ((format.conv_byte_count || conversion) && texture->sub_resources[sub_resource_idx].buffer)
|
||||
+ if ((format.convert || conversion) && texture->sub_resources[sub_resource_idx].buffer)
|
||||
+#endif /* STAGING_CSMT */
|
||||
{
|
||||
TRACE("Removing the pbo attached to surface %p.\n", surface);
|
||||
@ -286,9 +319,9 @@ 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
|
||||
@@ -476,7 +476,11 @@ static void swapchain_gl_present(struct
|
||||
if (swapchain->render_to_fbo)
|
||||
@@ -483,7 +483,11 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
|
||||
swapchain_blit(swapchain, context, src_rect, dst_rect);
|
||||
}
|
||||
|
||||
+#if !defined(STAGING_CSMT)
|
||||
if (swapchain->num_contexts > 1)
|
||||
@ -573,12 +606,27 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
|
||||
wined3d_cs_init_object(resource->device->cs, wined3d_unordered_access_view_cs_init, view);
|
||||
|
||||
return WINED3D_OK;
|
||||
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
|
||||
--- a/dlls/wined3d/wined3d_main.c
|
||||
+++ b/dlls/wined3d/wined3d_main.c
|
||||
@@ -72,7 +72,11 @@ static CRITICAL_SECTION wined3d_wndproc_cs = {&wined3d_wndproc_cs_debug, -1, 0,
|
||||
* where appropriate. */
|
||||
struct wined3d_settings wined3d_settings =
|
||||
{
|
||||
+#if !defined(STAGING_CSMT)
|
||||
FALSE, /* No multithreaded CS by default. */
|
||||
+#else /* STAGING_CSMT */
|
||||
+ TRUE, /* Multithreaded CS by default. */
|
||||
+#endif /* STAGING_CSMT */
|
||||
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
|
||||
@@ -2898,6 +2898,16 @@ struct wined3d_dummy_textures
|
||||
GLuint tex_2d_ms_array;
|
||||
};
|
||||
@@ -2860,6 +2860,16 @@ static inline BOOL wined3d_dualblend_enabled(const struct wined3d_state *state,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+#if defined(STAGING_CSMT)
|
||||
+struct wined3d_gl_bo
|
||||
@ -593,7 +641,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
#define WINED3D_UNMAPPED_STAGE ~0u
|
||||
|
||||
/* Multithreaded flag. Removed from the public header to signal that
|
||||
@@ -2998,6 +3008,12 @@ LRESULT device_process_message(struct wi
|
||||
@@ -2971,6 +2981,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;
|
||||
@ -606,7 +654,7 @@ 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)
|
||||
{
|
||||
@@ -3188,7 +3204,11 @@ struct wined3d_texture
|
||||
@@ -3158,7 +3174,11 @@ struct wined3d_texture
|
||||
|
||||
unsigned int map_count;
|
||||
DWORD locations;
|
||||
@ -618,7 +666,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
} sub_resources[1];
|
||||
};
|
||||
|
||||
@@ -3504,6 +3524,9 @@ struct wined3d_cs_queue
|
||||
@@ -3474,6 +3494,9 @@ struct wined3d_cs_queue
|
||||
|
||||
struct wined3d_cs_ops
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user