mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Rebase against 52ba1b498a9694daf804c9aea99c788bb4e753a3.
This commit is contained in:
parent
8988a92bee
commit
a7ae280480
@ -1,4 +1,4 @@
|
||||
From d94124650cd292dfdc364c43f117d35eecce39bf Mon Sep 17 00:00:00 2001
|
||||
From 5be4173b6c3e89b1d9267679cd392a7343088a52 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Tue, 8 Jun 2021 09:10:37 +1000
|
||||
Subject: [PATCH] ntdll: Avoid implicit cast of interface pointer.
|
||||
@ -8,27 +8,27 @@ Subject: [PATCH] ntdll: Avoid implicit cast of interface pointer.
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index b7531c1bdb7..97c5b741776 100644
|
||||
index 34b332a613c..111c851b43b 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -3162,7 +3162,7 @@ NTSTATUS virtual_clear_tls_index( ULONG index )
|
||||
@@ -3016,7 +3016,7 @@ NTSTATUS virtual_clear_tls_index( ULONG index )
|
||||
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
|
||||
LIST_FOR_EACH_ENTRY( thread_data, &teb_list, struct ntdll_thread_data, entry )
|
||||
{
|
||||
- TEB *teb = CONTAINING_RECORD( thread_data, TEB, GdiTebBatch );
|
||||
+ TEB *teb = CONTAINING_RECORD( (GDI_TEB_BATCH *)thread_data, TEB, GdiTebBatch );
|
||||
teb->TlsSlots[index] = 0;
|
||||
}
|
||||
server_leave_uninterrupted_section( &virtual_mutex, &sigset );
|
||||
@@ -3176,7 +3176,7 @@ NTSTATUS virtual_clear_tls_index( ULONG index )
|
||||
#ifdef _WIN64
|
||||
WOW_TEB *wow_teb = get_wow_teb( teb );
|
||||
if (wow_teb) wow_teb->TlsSlots[index] = 0;
|
||||
@@ -3034,7 +3034,7 @@ NTSTATUS virtual_clear_tls_index( ULONG index )
|
||||
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
|
||||
LIST_FOR_EACH_ENTRY( thread_data, &teb_list, struct ntdll_thread_data, entry )
|
||||
{
|
||||
- TEB *teb = CONTAINING_RECORD( thread_data, TEB, GdiTebBatch );
|
||||
+ TEB *teb = CONTAINING_RECORD( (GDI_TEB_BATCH *)thread_data, TEB, GdiTebBatch );
|
||||
if (teb->TlsExpansionSlots) teb->TlsExpansionSlots[index] = 0;
|
||||
}
|
||||
server_leave_uninterrupted_section( &virtual_mutex, &sigset );
|
||||
#ifdef _WIN64
|
||||
WOW_TEB *wow_teb = get_wow_teb( teb );
|
||||
if (wow_teb)
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
@ -1,181 +0,0 @@
|
||||
From e5d31156ca6648bd60221943163142e6d3d7fcf2 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Thu, 17 Jun 2021 22:37:49 -0500
|
||||
Subject: [PATCH] wined3d: Introduce a prepare_upload_bo device context
|
||||
operation and use it to upload sub-resource data.
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/wined3d/buffer.c | 2 +-
|
||||
dlls/wined3d/cs.c | 54 ++++++++++++++++++++++++++++++++++
|
||||
dlls/wined3d/device.c | 3 +-
|
||||
dlls/wined3d/texture.c | 2 +-
|
||||
dlls/wined3d/wined3d_private.h | 6 ++++
|
||||
5 files changed, 64 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
|
||||
index 7fc150878f0..554331051f1 100644
|
||||
--- a/dlls/wined3d/buffer.c
|
||||
+++ b/dlls/wined3d/buffer.c
|
||||
@@ -1063,7 +1063,7 @@ static void wined3d_buffer_init_data(struct wined3d_buffer *buffer,
|
||||
if (buffer->flags & WINED3D_BUFFER_USE_BO)
|
||||
{
|
||||
wined3d_box_set(&box, 0, 0, resource->size, 1, 0, 1);
|
||||
- device->cs->c.ops->update_sub_resource(&device->cs->c, resource,
|
||||
+ wined3d_device_context_emit_update_sub_resource(&device->cs->c, resource,
|
||||
0, &box, data->data, data->row_pitch, data->slice_pitch);
|
||||
}
|
||||
else
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 47bc36d4cc0..a3124a229e1 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -2649,6 +2649,40 @@ done:
|
||||
wined3d_resource_release(resource);
|
||||
}
|
||||
|
||||
+void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_context *context,
|
||||
+ struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
|
||||
+ const void *data, unsigned int row_pitch, unsigned int slice_pitch)
|
||||
+{
|
||||
+ struct wined3d_const_bo_address src_addr;
|
||||
+ void *map_ptr;
|
||||
+
|
||||
+ if ((map_ptr = context->ops->prepare_upload_bo(context, resource, sub_resource_idx, box,
|
||||
+ row_pitch, slice_pitch, WINED3D_MAP_WRITE, &src_addr)))
|
||||
+ {
|
||||
+ struct wined3d_cs_update_sub_resource *op;
|
||||
+
|
||||
+ wined3d_format_copy_data(resource->format, data, row_pitch, slice_pitch, map_ptr, row_pitch, slice_pitch,
|
||||
+ box->right - box->left, box->bottom - box->top, box->back - box->front);
|
||||
+
|
||||
+ op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
|
||||
+ op->resource = resource;
|
||||
+ op->sub_resource_idx = sub_resource_idx;
|
||||
+ op->box = *box;
|
||||
+ op->addr = src_addr;
|
||||
+ op->row_pitch = row_pitch;
|
||||
+ op->slice_pitch = slice_pitch;
|
||||
+
|
||||
+ wined3d_device_context_acquire_resource(context, resource);
|
||||
+
|
||||
+ wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ context->ops->update_sub_resource(context, resource, sub_resource_idx, box, data, row_pitch, slice_pitch);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void wined3d_cs_update_sub_resource(struct wined3d_device_context *context,
|
||||
struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
|
||||
const void *data, unsigned int row_pitch, unsigned int slice_pitch)
|
||||
@@ -2946,12 +2980,21 @@ static void wined3d_cs_st_finish(struct wined3d_device_context *context, enum wi
|
||||
{
|
||||
}
|
||||
|
||||
+static void *wined3d_cs_prepare_upload_bo(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
+ unsigned int sub_resource_idx, const struct wined3d_box *box, unsigned int row_pitch,
|
||||
+ unsigned int slice_pitch, uint32_t flags, struct wined3d_const_bo_address *address)
|
||||
+{
|
||||
+ /* FIXME: We would like to return mapped or newly allocated memory here. */
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
static const struct wined3d_device_context_ops wined3d_cs_st_ops =
|
||||
{
|
||||
wined3d_cs_st_require_space,
|
||||
wined3d_cs_st_submit,
|
||||
wined3d_cs_st_finish,
|
||||
wined3d_cs_st_push_constants,
|
||||
+ wined3d_cs_prepare_upload_bo,
|
||||
wined3d_cs_map,
|
||||
wined3d_cs_unmap,
|
||||
wined3d_cs_update_sub_resource,
|
||||
@@ -3080,6 +3123,7 @@ static const struct wined3d_device_context_ops wined3d_cs_mt_ops =
|
||||
wined3d_cs_mt_submit,
|
||||
wined3d_cs_mt_finish,
|
||||
wined3d_cs_mt_push_constants,
|
||||
+ wined3d_cs_prepare_upload_bo,
|
||||
wined3d_cs_map,
|
||||
wined3d_cs_unmap,
|
||||
wined3d_cs_update_sub_resource,
|
||||
@@ -3353,6 +3397,15 @@ static void wined3d_deferred_context_push_constants(struct wined3d_device_contex
|
||||
FIXME("context %p, p %#x, start_idx %u, count %u, constants %p, stub!\n", context, p, start_idx, count, constants);
|
||||
}
|
||||
|
||||
+static void *wined3d_deferred_context_prepare_upload_bo(struct wined3d_device_context *context,
|
||||
+ struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
|
||||
+ unsigned int row_pitch, unsigned int slice_pitch, uint32_t flags, struct wined3d_const_bo_address *address)
|
||||
+{
|
||||
+ FIXME("context %p, resource %p, sub_resource_idx %u, box %p, flags %#x, address %p, stub!\n",
|
||||
+ context, resource, sub_resource_idx, box, flags, address);
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static HRESULT wined3d_deferred_context_map(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
unsigned int sub_resource_idx, void **map_ptr, const struct wined3d_box *box, unsigned int flags)
|
||||
{
|
||||
@@ -3430,6 +3483,7 @@ static const struct wined3d_device_context_ops wined3d_deferred_context_ops =
|
||||
wined3d_deferred_context_submit,
|
||||
wined3d_deferred_context_finish,
|
||||
wined3d_deferred_context_push_constants,
|
||||
+ wined3d_deferred_context_prepare_upload_bo,
|
||||
wined3d_deferred_context_map,
|
||||
wined3d_deferred_context_unmap,
|
||||
wined3d_deferred_context_update_sub_resource,
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 96657141419..e37bf46594c 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4679,7 +4679,8 @@ void CDECL wined3d_device_context_update_sub_resource(struct wined3d_device_cont
|
||||
return;
|
||||
}
|
||||
|
||||
- context->ops->update_sub_resource(context, resource, sub_resource_idx, box, data, row_pitch, depth_pitch);
|
||||
+ wined3d_device_context_emit_update_sub_resource(context, resource,
|
||||
+ sub_resource_idx, box, data, row_pitch, depth_pitch);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_resolve_sub_resource(struct wined3d_device_context *context,
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 62f38a1d592..c1247fbc56b 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -4350,7 +4350,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
{
|
||||
wined3d_texture_get_level_box(*texture, i % (*texture)->level_count, &box);
|
||||
- device->cs->c.ops->update_sub_resource(&device->cs->c, &(*texture)->resource,
|
||||
+ wined3d_device_context_emit_update_sub_resource(&device->cs->c, &(*texture)->resource,
|
||||
i, &box, data[i].data, data[i].row_pitch, data[i].slice_pitch);
|
||||
}
|
||||
}
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 87c83d555e4..d85720e48b2 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -4700,6 +4700,9 @@ struct wined3d_device_context_ops
|
||||
void (*finish)(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id);
|
||||
void (*push_constants)(struct wined3d_device_context *context, enum wined3d_push_constants p,
|
||||
unsigned int start_idx, unsigned int count, const void *constants);
|
||||
+ void *(*prepare_upload_bo)(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
+ unsigned int sub_resource_idx, const struct wined3d_box *box, unsigned int row_pitch,
|
||||
+ unsigned int slice_pitch, uint32_t flags, struct wined3d_const_bo_address *address);
|
||||
HRESULT (*map)(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
unsigned int sub_resource_idx, void **map_ptr, const struct wined3d_box *box, unsigned int flags);
|
||||
HRESULT (*unmap)(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
@@ -4851,6 +4854,9 @@ void wined3d_device_context_emit_set_vertex_declaration(struct wined3d_device_co
|
||||
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
|
||||
void wined3d_device_context_emit_set_viewports(struct wined3d_device_context *context, unsigned int viewport_count,
|
||||
const struct wined3d_viewport *viewports) DECLSPEC_HIDDEN;
|
||||
+void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_context *context,
|
||||
+ struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
|
||||
+ const void *data, unsigned int row_pitch, unsigned int slice_pitch) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource)
|
||||
{
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,207 +0,0 @@
|
||||
From 2df1209afb01d15b18a6c34a6c4450d9b0ca9ffe Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 17:44:22 -0500
|
||||
Subject: [PATCH] wined3d: Implement
|
||||
wined3d_deferred_context_prepare_upload_bo().
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/wined3d/cs.c | 64 ++++++++++++++++++++++++++++++++--
|
||||
dlls/wined3d/resource.c | 30 +++++++++-------
|
||||
dlls/wined3d/wined3d_private.h | 3 ++
|
||||
3 files changed, 81 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index a3124a229e1..80636943069 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -26,6 +26,13 @@ WINE_DECLARE_DEBUG_CHANNEL(fps);
|
||||
|
||||
#define WINED3D_INITIAL_CS_SIZE 4096
|
||||
|
||||
+struct wined3d_deferred_upload
|
||||
+{
|
||||
+ struct wined3d_resource *resource;
|
||||
+ unsigned int sub_resource_idx;
|
||||
+ void *sysmem;
|
||||
+};
|
||||
+
|
||||
struct wined3d_command_list
|
||||
{
|
||||
LONG refcount;
|
||||
@@ -38,6 +45,9 @@ struct wined3d_command_list
|
||||
SIZE_T resource_count;
|
||||
struct wined3d_resource **resources;
|
||||
|
||||
+ SIZE_T upload_count;
|
||||
+ struct wined3d_deferred_upload *uploads;
|
||||
+
|
||||
/* List of command lists queued for execution on this command list. We might
|
||||
* be the only thing holding a pointer to another command list, so we need
|
||||
* to hold a reference here (and in wined3d_deferred_context) as well. */
|
||||
@@ -48,9 +58,13 @@ struct wined3d_command_list
|
||||
static void wined3d_command_list_destroy_object(void *object)
|
||||
{
|
||||
struct wined3d_command_list *list = object;
|
||||
+ SIZE_T i;
|
||||
|
||||
TRACE("list %p.\n", list);
|
||||
|
||||
+ for (i = 0; i < list->upload_count; ++i)
|
||||
+ wined3d_free_sysmem(list->uploads[i].sysmem);
|
||||
+
|
||||
heap_free(list->resources);
|
||||
heap_free(list->data);
|
||||
heap_free(list);
|
||||
@@ -3343,6 +3357,9 @@ struct wined3d_deferred_context
|
||||
SIZE_T resource_count, resources_capacity;
|
||||
struct wined3d_resource **resources;
|
||||
|
||||
+ SIZE_T upload_count, uploads_capacity;
|
||||
+ struct wined3d_deferred_upload *uploads;
|
||||
+
|
||||
/* List of command lists queued for execution on this context. A command
|
||||
* list can be the only thing holding a pointer to another command list, so
|
||||
* we need to hold a reference here and in wined3d_command_list as well. */
|
||||
@@ -3401,9 +3418,44 @@ static void *wined3d_deferred_context_prepare_upload_bo(struct wined3d_device_co
|
||||
struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
|
||||
unsigned int row_pitch, unsigned int slice_pitch, uint32_t flags, struct wined3d_const_bo_address *address)
|
||||
{
|
||||
- FIXME("context %p, resource %p, sub_resource_idx %u, box %p, flags %#x, address %p, stub!\n",
|
||||
- context, resource, sub_resource_idx, box, flags, address);
|
||||
- return false;
|
||||
+ struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
|
||||
+ const struct wined3d_format *format = resource->format;
|
||||
+ struct wined3d_deferred_upload *upload;
|
||||
+ void *sysmem;
|
||||
+ size_t size;
|
||||
+
|
||||
+ size = (box->back - box->front - 1) * slice_pitch
|
||||
+ + ((box->bottom - box->top - 1) / format->block_height) * row_pitch
|
||||
+ + ((box->right - box->left + format->block_width - 1) / format->block_width) * format->block_byte_count;
|
||||
+
|
||||
+ if (!(flags & WINED3D_MAP_WRITE))
|
||||
+ {
|
||||
+ WARN("Flags %#x are not valid on a deferred context.\n", flags);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (flags & ~(WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD))
|
||||
+ {
|
||||
+ FIXME("Unhandled flags %#x.\n", flags);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (!wined3d_array_reserve((void **)&deferred->uploads, &deferred->uploads_capacity,
|
||||
+ deferred->upload_count + 1, sizeof(*deferred->uploads)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (!(sysmem = wined3d_allocate_sysmem(size)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ upload = &deferred->uploads[deferred->upload_count++];
|
||||
+ upload->resource = resource;
|
||||
+ wined3d_resource_incref(resource);
|
||||
+ upload->sub_resource_idx = sub_resource_idx;
|
||||
+ upload->sysmem = sysmem;
|
||||
+
|
||||
+ address->buffer_object = 0;
|
||||
+ address->addr = sysmem;
|
||||
+ return sysmem;
|
||||
}
|
||||
|
||||
static HRESULT wined3d_deferred_context_map(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
@@ -3527,6 +3579,12 @@ void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *conte
|
||||
|
||||
for (i = 0; i < deferred->resource_count; ++i)
|
||||
wined3d_resource_decref(deferred->resources[i]);
|
||||
+
|
||||
+ for (i = 0; i < deferred->upload_count; ++i)
|
||||
+ {
|
||||
+ wined3d_resource_decref(deferred->uploads[i].resource);
|
||||
+ wined3d_free_sysmem(deferred->uploads[i].sysmem);
|
||||
+ }
|
||||
heap_free(deferred->resources);
|
||||
|
||||
wined3d_state_destroy(deferred->c.state);
|
||||
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
|
||||
index f37c313e023..8e4be0e0315 100644
|
||||
--- a/dlls/wined3d/resource.c
|
||||
+++ b/dlls/wined3d/resource.c
|
||||
@@ -334,24 +334,33 @@ void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
|
||||
wined3d_cs_emit_preload_resource(resource->device->cs, resource);
|
||||
}
|
||||
|
||||
-static BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource)
|
||||
+void *wined3d_allocate_sysmem(SIZE_T size)
|
||||
{
|
||||
void **p;
|
||||
- SIZE_T align = RESOURCE_ALIGNMENT - 1 + sizeof(*p);
|
||||
+ static const SIZE_T align = RESOURCE_ALIGNMENT - 1 + sizeof(*p);
|
||||
void *mem;
|
||||
|
||||
- if (!(mem = heap_alloc_zero(resource->size + align)))
|
||||
+ if (!(mem = heap_alloc_zero(size + align)))
|
||||
{
|
||||
ERR("Failed to allocate system memory.\n");
|
||||
- return FALSE;
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
+ TRACE("Allocated %lu bytes at %p.\n", size, mem);
|
||||
p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1;
|
||||
*p = mem;
|
||||
|
||||
- resource->heap_memory = ++p;
|
||||
+ return ++p;
|
||||
+}
|
||||
|
||||
- return TRUE;
|
||||
+void wined3d_free_sysmem(void *mem)
|
||||
+{
|
||||
+ void **p = mem;
|
||||
+
|
||||
+ if (!p)
|
||||
+ return;
|
||||
+
|
||||
+ heap_free(*(--p));
|
||||
}
|
||||
|
||||
BOOL wined3d_resource_prepare_sysmem(struct wined3d_resource *resource)
|
||||
@@ -359,17 +368,12 @@ BOOL wined3d_resource_prepare_sysmem(struct wined3d_resource *resource)
|
||||
if (resource->heap_memory)
|
||||
return TRUE;
|
||||
|
||||
- return wined3d_resource_allocate_sysmem(resource);
|
||||
+ return !!(resource->heap_memory = wined3d_allocate_sysmem(resource->size));
|
||||
}
|
||||
|
||||
void wined3d_resource_free_sysmem(struct wined3d_resource *resource)
|
||||
{
|
||||
- void **p = resource->heap_memory;
|
||||
-
|
||||
- if (!p)
|
||||
- return;
|
||||
-
|
||||
- heap_free(*(--p));
|
||||
+ wined3d_free_sysmem(resource->heap_memory);
|
||||
resource->heap_memory = NULL;
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index d85720e48b2..074927a9e99 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -4151,6 +4151,9 @@ void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DEC
|
||||
#define RESOURCE_ALIGNMENT 16
|
||||
#define WINED3D_CONSTANT_BUFFER_ALIGNMENT 16
|
||||
|
||||
+void *wined3d_allocate_sysmem(SIZE_T size) DECLSPEC_HIDDEN;
|
||||
+void wined3d_free_sysmem(void *mem) DECLSPEC_HIDDEN;
|
||||
+
|
||||
#define WINED3D_LOCATION_DISCARDED 0x00000001
|
||||
#define WINED3D_LOCATION_SYSMEM 0x00000002
|
||||
#define WINED3D_LOCATION_BUFFER 0x00000008
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,29 +0,0 @@
|
||||
From 6fcb4ea61ecad68704e7793e56d69c5144e96716 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 17:32:26 -0500
|
||||
Subject: [PATCH] d3d11: Forbid map types other than DISCARD and NOOVERWRITE on
|
||||
a deferred context.
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/d3d11/device.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 56f34c70ea1..d043af7051a 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -744,6 +744,10 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_context_Map(ID3D11DeviceContext1 *
|
||||
if (map_flags)
|
||||
FIXME("Ignoring map_flags %#x.\n", map_flags);
|
||||
|
||||
+ if (context->type != D3D11_DEVICE_CONTEXT_IMMEDIATE
|
||||
+ && map_type != D3D11_MAP_WRITE_DISCARD && map_type != D3D11_MAP_WRITE_NO_OVERWRITE)
|
||||
+ return E_INVALIDARG;
|
||||
+
|
||||
wined3d_resource = wined3d_resource_from_d3d11_resource(resource);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,350 +0,0 @@
|
||||
From 9cdb51692c64f5837504751096fe5af065c34473 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 17:05:09 -0500
|
||||
Subject: [PATCH] wined3d: Use context->ops->prepare_upload_bo() in
|
||||
wined3d_device_context_map() if possible.
|
||||
|
||||
This has the notable effect of implementing maps on deferred contexts.
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/d3d11/tests/d3d11.c | 57 +++++++++++++-------------
|
||||
dlls/wined3d/cs.c | 73 +++++++++++++++++++++++++++-------
|
||||
dlls/wined3d/device.c | 38 ++++++++++++++++--
|
||||
dlls/wined3d/wined3d_private.h | 5 +++
|
||||
4 files changed, 126 insertions(+), 47 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index 67ac37703e4..8442191b83c 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -33059,21 +33059,13 @@ static void test_deferred_context_map(void)
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE, 0, &map_desc);
|
||||
- todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &map_desc);
|
||||
todo_wine ok(hr == D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map_desc);
|
||||
- todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
- if (hr != S_OK)
|
||||
- {
|
||||
- ID3D11Buffer_Release(buffer2);
|
||||
- ID3D11Buffer_Release(buffer);
|
||||
- ID3D11DeviceContext_Release(deferred);
|
||||
- release_test_context(&test_context);
|
||||
- return;
|
||||
- }
|
||||
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
map_data = map_desc.pData;
|
||||
/* The previous contents of map_data are undefined and may in practice be
|
||||
* uninitialized garbage. */
|
||||
@@ -33122,13 +33114,14 @@ static void test_deferred_context_map(void)
|
||||
ID3D11DeviceContext_Unmap(immediate, (ID3D11Resource *)buffer, 0);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &map_desc);
|
||||
- ok(hr == D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD, "Got unexpected hr %#x.\n", hr);
|
||||
+ todo_wine ok(hr == D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map_desc);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
map_data = map_desc.pData;
|
||||
for (i = 0; i < ARRAY_SIZE(data); ++i)
|
||||
map_data[i] = 2 * i;
|
||||
+ memcpy(data, map_data, sizeof(data));
|
||||
ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_READ, 0, &map_desc);
|
||||
@@ -33141,32 +33134,38 @@ static void test_deferred_context_map(void)
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &map_desc);
|
||||
- ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
- map_data = map_desc.pData;
|
||||
- for (i = 0; i < ARRAY_SIZE(data); ++i)
|
||||
+ if (hr == S_OK)
|
||||
{
|
||||
- ok(map_data[i] == 2 * i, "Got unexpected value %.8e at %u.\n", map_data[i], i);
|
||||
- if (i % 2)
|
||||
- map_data[i] = 3 * i;
|
||||
- }
|
||||
- memcpy(data, map_data, sizeof(data));
|
||||
+ map_data = map_desc.pData;
|
||||
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
|
||||
+ {
|
||||
+ ok(map_data[i] == 2 * i, "Got unexpected value %.8e at %u.\n", map_data[i], i);
|
||||
+ if (i % 2)
|
||||
+ map_data[i] = 3 * i;
|
||||
+ }
|
||||
+ memcpy(data, map_data, sizeof(data));
|
||||
|
||||
- ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
|
||||
+ ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
|
||||
+ }
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &map_desc);
|
||||
- ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
- map_data = map_desc.pData;
|
||||
- for (i = 0; i < ARRAY_SIZE(data); ++i)
|
||||
+ if (hr == S_OK)
|
||||
{
|
||||
- ok(map_data[i] == data[i], "Got unexpected value %.8e at %u.\n", map_data[i], i);
|
||||
- if (i % 3)
|
||||
- map_data[i] = 4 * i;
|
||||
- }
|
||||
- memcpy(data, map_data, sizeof(data));
|
||||
+ map_data = map_desc.pData;
|
||||
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
|
||||
+ {
|
||||
+ ok(map_data[i] == data[i], "Got unexpected value %.8e at %u.\n", map_data[i], i);
|
||||
+ if (i % 3)
|
||||
+ map_data[i] = 4 * i;
|
||||
+ }
|
||||
+ memcpy(data, map_data, sizeof(data));
|
||||
|
||||
- ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
|
||||
+ ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
|
||||
+ }
|
||||
|
||||
hr = ID3D11DeviceContext_FinishCommandList(deferred, FALSE, &list);
|
||||
ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 80636943069..c70606ad036 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -31,6 +31,7 @@ struct wined3d_deferred_upload
|
||||
struct wined3d_resource *resource;
|
||||
unsigned int sub_resource_idx;
|
||||
void *sysmem;
|
||||
+ struct wined3d_box box;
|
||||
};
|
||||
|
||||
struct wined3d_command_list
|
||||
@@ -2663,6 +2664,29 @@ done:
|
||||
wined3d_resource_release(resource);
|
||||
}
|
||||
|
||||
+void wined3d_device_context_upload_bo(struct wined3d_device_context *context,
|
||||
+ struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
|
||||
+ const struct wined3d_const_bo_address *addr, unsigned int row_pitch, unsigned int slice_pitch)
|
||||
+{
|
||||
+ struct wined3d_cs_update_sub_resource *op;
|
||||
+
|
||||
+ TRACE("context %p, resource %p, sub_resource_idx %u, box %s, addr %s, row_pitch %u, slice_pitch %u.\n",
|
||||
+ context, resource, sub_resource_idx, debug_box(box), debug_const_bo_address(addr), row_pitch, slice_pitch);
|
||||
+
|
||||
+ op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
|
||||
+ op->resource = resource;
|
||||
+ op->sub_resource_idx = sub_resource_idx;
|
||||
+ op->box = *box;
|
||||
+ op->addr = *addr;
|
||||
+ op->row_pitch = row_pitch;
|
||||
+ op->slice_pitch = slice_pitch;
|
||||
+
|
||||
+ wined3d_device_context_acquire_resource(context, resource);
|
||||
+
|
||||
+ wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
+}
|
||||
+
|
||||
void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_context *context,
|
||||
struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
|
||||
const void *data, unsigned int row_pitch, unsigned int slice_pitch)
|
||||
@@ -2673,23 +2697,9 @@ void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_conte
|
||||
if ((map_ptr = context->ops->prepare_upload_bo(context, resource, sub_resource_idx, box,
|
||||
row_pitch, slice_pitch, WINED3D_MAP_WRITE, &src_addr)))
|
||||
{
|
||||
- struct wined3d_cs_update_sub_resource *op;
|
||||
-
|
||||
wined3d_format_copy_data(resource->format, data, row_pitch, slice_pitch, map_ptr, row_pitch, slice_pitch,
|
||||
box->right - box->left, box->bottom - box->top, box->back - box->front);
|
||||
-
|
||||
- op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
- op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
|
||||
- op->resource = resource;
|
||||
- op->sub_resource_idx = sub_resource_idx;
|
||||
- op->box = *box;
|
||||
- op->addr = src_addr;
|
||||
- op->row_pitch = row_pitch;
|
||||
- op->slice_pitch = slice_pitch;
|
||||
-
|
||||
- wined3d_device_context_acquire_resource(context, resource);
|
||||
-
|
||||
- wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ wined3d_device_context_upload_bo(context, resource, sub_resource_idx, box, &src_addr, row_pitch, slice_pitch);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3002,6 +3012,12 @@ static void *wined3d_cs_prepare_upload_bo(struct wined3d_device_context *context
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+static bool wined3d_cs_get_upload_bo(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
+ unsigned int sub_resource_idx, struct wined3d_box *box, struct wined3d_const_bo_address *address)
|
||||
+{
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static const struct wined3d_device_context_ops wined3d_cs_st_ops =
|
||||
{
|
||||
wined3d_cs_st_require_space,
|
||||
@@ -3009,6 +3025,7 @@ static const struct wined3d_device_context_ops wined3d_cs_st_ops =
|
||||
wined3d_cs_st_finish,
|
||||
wined3d_cs_st_push_constants,
|
||||
wined3d_cs_prepare_upload_bo,
|
||||
+ wined3d_cs_get_upload_bo,
|
||||
wined3d_cs_map,
|
||||
wined3d_cs_unmap,
|
||||
wined3d_cs_update_sub_resource,
|
||||
@@ -3138,6 +3155,7 @@ static const struct wined3d_device_context_ops wined3d_cs_mt_ops =
|
||||
wined3d_cs_mt_finish,
|
||||
wined3d_cs_mt_push_constants,
|
||||
wined3d_cs_prepare_upload_bo,
|
||||
+ wined3d_cs_get_upload_bo,
|
||||
wined3d_cs_map,
|
||||
wined3d_cs_unmap,
|
||||
wined3d_cs_update_sub_resource,
|
||||
@@ -3452,12 +3470,36 @@ static void *wined3d_deferred_context_prepare_upload_bo(struct wined3d_device_co
|
||||
wined3d_resource_incref(resource);
|
||||
upload->sub_resource_idx = sub_resource_idx;
|
||||
upload->sysmem = sysmem;
|
||||
+ upload->box = *box;
|
||||
|
||||
address->buffer_object = 0;
|
||||
address->addr = sysmem;
|
||||
return sysmem;
|
||||
}
|
||||
|
||||
+static bool wined3d_deferred_context_get_upload_bo(struct wined3d_device_context *context,
|
||||
+ struct wined3d_resource *resource, unsigned int sub_resource_idx,
|
||||
+ struct wined3d_box *box, struct wined3d_const_bo_address *address)
|
||||
+{
|
||||
+ struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
|
||||
+ int i = deferred->upload_count;
|
||||
+
|
||||
+ while (i--)
|
||||
+ {
|
||||
+ struct wined3d_deferred_upload *upload = &deferred->uploads[i];
|
||||
+
|
||||
+ if (upload->resource == resource && upload->sub_resource_idx == sub_resource_idx)
|
||||
+ {
|
||||
+ *box = upload->box;
|
||||
+ address->buffer_object = 0;
|
||||
+ address->addr = upload->sysmem;
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static HRESULT wined3d_deferred_context_map(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
unsigned int sub_resource_idx, void **map_ptr, const struct wined3d_box *box, unsigned int flags)
|
||||
{
|
||||
@@ -3536,6 +3578,7 @@ static const struct wined3d_device_context_ops wined3d_deferred_context_ops =
|
||||
wined3d_deferred_context_finish,
|
||||
wined3d_deferred_context_push_constants,
|
||||
wined3d_deferred_context_prepare_upload_bo,
|
||||
+ wined3d_deferred_context_get_upload_bo,
|
||||
wined3d_deferred_context_map,
|
||||
wined3d_deferred_context_unmap,
|
||||
wined3d_deferred_context_update_sub_resource,
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index e37bf46594c..774c77d1374 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4833,7 +4833,10 @@ HRESULT CDECL wined3d_device_context_map(struct wined3d_device_context *context,
|
||||
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags)
|
||||
{
|
||||
struct wined3d_sub_resource_desc desc;
|
||||
+ struct wined3d_const_bo_address addr;
|
||||
+ unsigned int row_pitch, slice_pitch;
|
||||
struct wined3d_box b;
|
||||
+ void *map_ptr;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("context %p, resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n",
|
||||
@@ -4878,18 +4881,47 @@ HRESULT CDECL wined3d_device_context_map(struct wined3d_device_context *context,
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
+ wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||
+
|
||||
+ if ((map_ptr = context->ops->prepare_upload_bo(context, resource,
|
||||
+ sub_resource_idx, box, row_pitch, slice_pitch, flags, &addr)))
|
||||
+ {
|
||||
+ TRACE("Returning upload bo %s, data %p, row pitch %u, slice pitch %u.\n",
|
||||
+ debug_const_bo_address(&addr), map_ptr, row_pitch, slice_pitch);
|
||||
+ map_desc->data = map_ptr;
|
||||
+ map_desc->row_pitch = row_pitch;
|
||||
+ map_desc->slice_pitch = slice_pitch;
|
||||
+ return WINED3D_OK;
|
||||
+ }
|
||||
+
|
||||
if (SUCCEEDED(hr = context->ops->map(context, resource, sub_resource_idx, &map_desc->data, box, flags)))
|
||||
- wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx,
|
||||
- &map_desc->row_pitch, &map_desc->slice_pitch);
|
||||
+ {
|
||||
+ map_desc->row_pitch = row_pitch;
|
||||
+ map_desc->slice_pitch = slice_pitch;
|
||||
+ }
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_context_unmap(struct wined3d_device_context *context,
|
||||
struct wined3d_resource *resource, unsigned int sub_resource_idx)
|
||||
{
|
||||
+ struct wined3d_const_bo_address addr;
|
||||
+ struct wined3d_box box;
|
||||
+
|
||||
TRACE("context %p, resource %p, sub_resource_idx %u.\n", context, resource, sub_resource_idx);
|
||||
|
||||
- return context->ops->unmap(context, resource, sub_resource_idx);
|
||||
+ if (context->ops->get_upload_bo(context, resource, sub_resource_idx, &box, &addr))
|
||||
+ {
|
||||
+ unsigned int row_pitch, slice_pitch;
|
||||
+
|
||||
+ wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||
+ wined3d_device_context_upload_bo(context, resource, sub_resource_idx, &box, &addr, row_pitch, slice_pitch);
|
||||
+ return WINED3D_OK;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return context->ops->unmap(context, resource, sub_resource_idx);
|
||||
+ }
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_issue_query(struct wined3d_device_context *context,
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 074927a9e99..e10a2d48f23 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -4706,6 +4706,8 @@ struct wined3d_device_context_ops
|
||||
void *(*prepare_upload_bo)(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
unsigned int sub_resource_idx, const struct wined3d_box *box, unsigned int row_pitch,
|
||||
unsigned int slice_pitch, uint32_t flags, struct wined3d_const_bo_address *address);
|
||||
+ bool (*get_upload_bo)(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
+ unsigned int sub_resource_idx, struct wined3d_box *box, struct wined3d_const_bo_address *address);
|
||||
HRESULT (*map)(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
unsigned int sub_resource_idx, void **map_ptr, const struct wined3d_box *box, unsigned int flags);
|
||||
HRESULT (*unmap)(struct wined3d_device_context *context, struct wined3d_resource *resource,
|
||||
@@ -4860,6 +4862,9 @@ void wined3d_device_context_emit_set_viewports(struct wined3d_device_context *co
|
||||
void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_context *context,
|
||||
struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
|
||||
const void *data, unsigned int row_pitch, unsigned int slice_pitch) DECLSPEC_HIDDEN;
|
||||
+void wined3d_device_context_upload_bo(struct wined3d_device_context *context,
|
||||
+ struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
|
||||
+ const struct wined3d_const_bo_address *addr, unsigned int row_pitch, unsigned int slice_pitch);
|
||||
|
||||
static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource)
|
||||
{
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,113 +0,0 @@
|
||||
From 95d7fb8450b3f407e5f794537ca3263cf0c63164 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 19:19:58 -0500
|
||||
Subject: [PATCH] wined3d: Implement NOOVERWITE maps in
|
||||
wined3d_deferred_context_prepare_upload_bo().
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/d3d11/tests/d3d11.c | 42 +++++++++++++++++-----------------------
|
||||
dlls/wined3d/cs.c | 21 +++++++++++++++++++-
|
||||
2 files changed, 38 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index 8442191b83c..82da0c38784 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -33134,38 +33134,32 @@ static void test_deferred_context_map(void)
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &map_desc);
|
||||
- todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
- if (hr == S_OK)
|
||||
+ map_data = map_desc.pData;
|
||||
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
|
||||
{
|
||||
- map_data = map_desc.pData;
|
||||
- for (i = 0; i < ARRAY_SIZE(data); ++i)
|
||||
- {
|
||||
- ok(map_data[i] == 2 * i, "Got unexpected value %.8e at %u.\n", map_data[i], i);
|
||||
- if (i % 2)
|
||||
- map_data[i] = 3 * i;
|
||||
- }
|
||||
- memcpy(data, map_data, sizeof(data));
|
||||
-
|
||||
- ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
|
||||
+ ok(map_data[i] == 2 * i, "Got unexpected value %.8e at %u.\n", map_data[i], i);
|
||||
+ if (i % 2)
|
||||
+ map_data[i] = 3 * i;
|
||||
}
|
||||
+ memcpy(data, map_data, sizeof(data));
|
||||
+
|
||||
+ ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &map_desc);
|
||||
- todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
- if (hr == S_OK)
|
||||
+ map_data = map_desc.pData;
|
||||
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
|
||||
{
|
||||
- map_data = map_desc.pData;
|
||||
- for (i = 0; i < ARRAY_SIZE(data); ++i)
|
||||
- {
|
||||
- ok(map_data[i] == data[i], "Got unexpected value %.8e at %u.\n", map_data[i], i);
|
||||
- if (i % 3)
|
||||
- map_data[i] = 4 * i;
|
||||
- }
|
||||
- memcpy(data, map_data, sizeof(data));
|
||||
-
|
||||
- ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
|
||||
+ ok(map_data[i] == data[i], "Got unexpected value %.8e at %u.\n", map_data[i], i);
|
||||
+ if (i % 3)
|
||||
+ map_data[i] = 4 * i;
|
||||
}
|
||||
+ memcpy(data, map_data, sizeof(data));
|
||||
+
|
||||
+ ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
|
||||
|
||||
hr = ID3D11DeviceContext_FinishCommandList(deferred, FALSE, &list);
|
||||
ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index c70606ad036..51fb4eefcd9 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -3452,12 +3452,31 @@ static void *wined3d_deferred_context_prepare_upload_bo(struct wined3d_device_co
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (flags & ~(WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD))
|
||||
+ if (flags & ~(WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
|
||||
{
|
||||
FIXME("Unhandled flags %#x.\n", flags);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ if (flags & WINED3D_MAP_NOOVERWRITE)
|
||||
+ {
|
||||
+ int i = deferred->upload_count;
|
||||
+
|
||||
+ while (i--)
|
||||
+ {
|
||||
+ struct wined3d_deferred_upload *upload = &deferred->uploads[i];
|
||||
+
|
||||
+ if (upload->resource == resource && upload->sub_resource_idx == sub_resource_idx)
|
||||
+ {
|
||||
+ address->buffer_object = 0;
|
||||
+ address->addr = upload->sysmem;
|
||||
+ return upload->sysmem;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
if (!wined3d_array_reserve((void **)&deferred->uploads, &deferred->uploads_capacity,
|
||||
deferred->upload_count + 1, sizeof(*deferred->uploads)))
|
||||
return NULL;
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,27 +0,0 @@
|
||||
From ecdb057520bc11f91ffc18d362f5e5df69593fd1 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Fri, 25 Jun 2021 18:04:47 -0500
|
||||
Subject: [PATCH] wined3d: Print a message when forcing CS serialization.
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/wined3d/cs.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 51fb4eefcd9..b696c130192 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -3303,6 +3303,9 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device,
|
||||
cs->c.device = device;
|
||||
cs->serialize_commands = TRACE_ON(d3d_sync) || wined3d_settings.cs_multithreaded & WINED3D_CSMT_SERIALIZE;
|
||||
|
||||
+ if (cs->serialize_commands)
|
||||
+ ERR_(d3d_sync)("Forcing serialization of all command streams.\n");
|
||||
+
|
||||
state_init(&cs->state, d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT, cs->c.state->feature_level);
|
||||
|
||||
cs->data_size = WINED3D_INITIAL_CS_SIZE;
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,3 +0,0 @@
|
||||
Fixes: [42191] Multiple games require d3d11 deferred contexts (Diablo 3, Dark Souls 3, The Evil Within, Elex, Alien: Isolation, Assassin's Creed III)
|
||||
Fixes: [43743] No 3D graphics in Wolcen: Lords of Mayhem
|
||||
Fixes: [41636] Multiple DirectX 11 games need ID3D11Device1::CreateDeferredContext1 implementation (WWE 2K15, Dishonored: Death of the Outsider, Pro Evolution Soccer 2019, Shantae and the Pirate's Curse, Space Engineers)
|
@ -1,4 +1,4 @@
|
||||
From a83181801d5248f7e228810bfe0a829a81be345f Mon Sep 17 00:00:00 2001
|
||||
From 1370cc026e08ebc0f9eb0314b86cc38220c22041 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 16 Jan 2014 20:56:49 -0700
|
||||
Subject: [PATCH] ntdll: Add support for junction point creation.
|
||||
@ -14,10 +14,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
|
||||
create mode 100644 include/ntifs.h
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 71991bd3938..7553b22e76d 100644
|
||||
index 596809f9f6a..e9a7c2d6088 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -2219,6 +2219,8 @@ AC_CHECK_FUNCS(\
|
||||
@@ -2209,6 +2209,8 @@ AC_CHECK_FUNCS(\
|
||||
proc_pidinfo \
|
||||
pwrite \
|
||||
readlink \
|
||||
@ -27,7 +27,7 @@ index 71991bd3938..7553b22e76d 100644
|
||||
setproctitle \
|
||||
setprogname \
|
||||
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
|
||||
index 2c1835e3ff0..54e06a3f126 100644
|
||||
index 46037546e6e..7a01e947e13 100644
|
||||
--- a/dlls/ntdll/tests/file.c
|
||||
+++ b/dlls/ntdll/tests/file.c
|
||||
@@ -38,6 +38,7 @@
|
||||
@ -38,7 +38,7 @@ index 2c1835e3ff0..54e06a3f126 100644
|
||||
|
||||
#ifndef IO_COMPLETION_ALL_ACCESS
|
||||
#define IO_COMPLETION_ALL_ACCESS 0x001F0003
|
||||
@@ -5233,6 +5234,105 @@ static void test_mailslot_name(void)
|
||||
@@ -5322,6 +5323,105 @@ static void test_mailslot_name(void)
|
||||
CloseHandle( device );
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ index 2c1835e3ff0..54e06a3f126 100644
|
||||
START_TEST(file)
|
||||
{
|
||||
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
|
||||
@@ -5305,5 +5405,6 @@ START_TEST(file)
|
||||
@@ -5394,5 +5494,6 @@ START_TEST(file)
|
||||
test_ioctl();
|
||||
test_query_ea();
|
||||
test_flush_buffers_file();
|
||||
@ -152,7 +152,7 @@ index 2c1835e3ff0..54e06a3f126 100644
|
||||
test_mailslot_name();
|
||||
}
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index 700ee717294..492838d9031 100644
|
||||
index 94140d1cfbc..3699934caf8 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -36,6 +36,7 @@
|
||||
@ -215,7 +215,7 @@ index 700ee717294..492838d9031 100644
|
||||
/* get space from the current directory data buffer, allocating a new one if necessary */
|
||||
static void *get_dir_data_space( struct dir_data *data, unsigned int size )
|
||||
{
|
||||
@@ -5950,6 +5982,116 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
|
||||
@@ -5931,6 +5963,116 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
|
||||
}
|
||||
|
||||
|
||||
@ -332,7 +332,7 @@ index 700ee717294..492838d9031 100644
|
||||
/******************************************************************************
|
||||
* NtFsControlFile (NTDLL.@)
|
||||
*/
|
||||
@@ -6032,6 +6174,23 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
|
||||
@@ -6013,6 +6155,23 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
|
||||
break;
|
||||
}
|
||||
|
||||
@ -357,13 +357,13 @@ index 700ee717294..492838d9031 100644
|
||||
TRACE("FSCTL_SET_SPARSE: Ignoring request\n");
|
||||
io->Information = 0;
|
||||
diff --git a/include/Makefile.in b/include/Makefile.in
|
||||
index 9822bce6bdd..00a1be0b74e 100644
|
||||
index 61a74a210c9..e4a3a83ecc8 100644
|
||||
--- a/include/Makefile.in
|
||||
+++ b/include/Makefile.in
|
||||
@@ -538,6 +538,7 @@ SOURCES = \
|
||||
ntddvdeo.h \
|
||||
@@ -541,6 +541,7 @@ SOURCES = \
|
||||
ntdef.h \
|
||||
ntdsapi.h \
|
||||
ntgdi.h \
|
||||
+ ntifs.h \
|
||||
ntlsa.h \
|
||||
ntquery.h \
|
||||
|
@ -2,7 +2,6 @@ Fixes: Add nvapi stubs required for GPU PhysX support
|
||||
Fixes: [35062] Fix graphical corruption in FarCry 3 with NVIDIA drivers
|
||||
Fixes: [43862] CS:GO fails to start when nvapi cannot be initialized
|
||||
Depends: nvcuda-CUDA_Support
|
||||
Depends: d3d11-Deferred_Context
|
||||
|
||||
# Causes regression?
|
||||
# https://bugs.wine-staging.com/show_bug.cgi?id=193
|
||||
|
@ -51,7 +51,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "0ec555e58ea9d5b33f4c825e96965ad0cb15d00f"
|
||||
echo "52ba1b498a9694daf804c9aea99c788bb4e753a3"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -95,7 +95,6 @@ patch_enable_all ()
|
||||
enable_comdlg32_lpstrFileTitle="$1"
|
||||
enable_crypt32_CMS_Certificates="$1"
|
||||
enable_cryptext_CryptExtOpenCER="$1"
|
||||
enable_d3d11_Deferred_Context="$1"
|
||||
enable_d3drm_IDirect3D3_support="$1"
|
||||
enable_d3dx9_36_BumpLuminance="$1"
|
||||
enable_d3dx9_36_CloneEffect="$1"
|
||||
@ -327,9 +326,6 @@ patch_enable ()
|
||||
cryptext-CryptExtOpenCER)
|
||||
enable_cryptext_CryptExtOpenCER="$2"
|
||||
;;
|
||||
d3d11-Deferred_Context)
|
||||
enable_d3d11_Deferred_Context="$2"
|
||||
;;
|
||||
d3drm-IDirect3D3-support)
|
||||
enable_d3drm_IDirect3D3_support="$2"
|
||||
;;
|
||||
@ -1328,13 +1324,9 @@ if test "$enable_nvcuvid_CUDA_Video_Support" -eq 1; then
|
||||
fi
|
||||
|
||||
if test "$enable_nvapi_Stub_DLL" -eq 1; then
|
||||
if test "$enable_d3d11_Deferred_Context" -gt 1; then
|
||||
abort "Patchset d3d11-Deferred_Context disabled, but nvapi-Stub_DLL depends on that."
|
||||
fi
|
||||
if test "$enable_nvcuda_CUDA_Support" -gt 1; then
|
||||
abort "Patchset nvcuda-CUDA_Support disabled, but nvapi-Stub_DLL depends on that."
|
||||
fi
|
||||
enable_d3d11_Deferred_Context=1
|
||||
enable_nvcuda_CUDA_Support=1
|
||||
fi
|
||||
|
||||
@ -1600,28 +1592,6 @@ if test "$enable_cryptext_CryptExtOpenCER" -eq 1; then
|
||||
patch_apply cryptext-CryptExtOpenCER/0001-cryptext-Implement-CryptExtOpenCER.patch
|
||||
fi
|
||||
|
||||
# Patchset d3d11-Deferred_Context
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#42191] Multiple games require d3d11 deferred contexts (Diablo 3, Dark Souls 3, The Evil Within, Elex, Alien:
|
||||
# | Isolation, Assassin's Creed III)
|
||||
# | * [#43743] No 3D graphics in Wolcen: Lords of Mayhem
|
||||
# | * [#41636] Multiple DirectX 11 games need ID3D11Device1::CreateDeferredContext1 implementation (WWE 2K15, Dishonored:
|
||||
# | Death of the Outsider, Pro Evolution Soccer 2019, Shantae and the Pirate's Curse, Space Engineers)
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/wined3d/buffer.c, dlls/wined3d/cs.c, dlls/wined3d/device.c,
|
||||
# | dlls/wined3d/resource.c, dlls/wined3d/texture.c, dlls/wined3d/wined3d_private.h
|
||||
# |
|
||||
if test "$enable_d3d11_Deferred_Context" -eq 1; then
|
||||
patch_apply d3d11-Deferred_Context/0006-wined3d-Introduce-a-prepare_upload_bo-device-context.patch
|
||||
patch_apply d3d11-Deferred_Context/0007-wined3d-Implement-wined3d_deferred_context_prepare_u.patch
|
||||
patch_apply d3d11-Deferred_Context/0008-d3d11-Forbid-map-types-other-than-DISCARD-and-NOOVER.patch
|
||||
patch_apply d3d11-Deferred_Context/0009-wined3d-Use-context-ops-prepare_upload_bo-in-wined3d.patch
|
||||
patch_apply d3d11-Deferred_Context/0010-wined3d-Implement-NOOVERWITE-maps-in-wined3d_deferre.patch
|
||||
patch_apply d3d11-Deferred_Context/0011-wined3d-Print-a-message-when-forcing-CS-serializatio.patch
|
||||
fi
|
||||
|
||||
# Patchset d3drm-IDirect3D3-support
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
@ -2880,7 +2850,7 @@ fi
|
||||
# Patchset nvapi-Stub_DLL
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * d3d11-Deferred_Context, nvcuda-CUDA_Support
|
||||
# | * nvcuda-CUDA_Support
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#35062] Fix graphical corruption in FarCry 3 with NVIDIA drivers
|
||||
@ -2921,7 +2891,7 @@ fi
|
||||
# Patchset nvcuvid-CUDA_Video_Support
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * d3d11-Deferred_Context, nvcuda-CUDA_Support, nvapi-Stub_DLL
|
||||
# | * nvcuda-CUDA_Support, nvapi-Stub_DLL
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * configure.ac, dlls/nvcuvid/Makefile.in, dlls/nvcuvid/nvcuvid.c, dlls/nvcuvid/nvcuvid.spec, include/Makefile.in,
|
||||
@ -2934,7 +2904,7 @@ fi
|
||||
# Patchset nvencodeapi-Video_Encoder
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * d3d11-Deferred_Context, nvcuda-CUDA_Support, nvapi-Stub_DLL, nvcuvid-CUDA_Video_Support
|
||||
# | * nvcuda-CUDA_Support, nvapi-Stub_DLL, nvcuvid-CUDA_Video_Support
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * configure.ac, dlls/nvencodeapi/Makefile.in, dlls/nvencodeapi/nvencodeapi.c, dlls/nvencodeapi/nvencodeapi.spec,
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 2fc3173016ecac56e884b2bc92f2aab3de3240ee Mon Sep 17 00:00:00 2001
|
||||
From 9804dd77fd8c0ec56963306f409fea6b910bb48d Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Sun, 7 Feb 2021 22:54:19 -0600
|
||||
Subject: [PATCH] server: Create processes using a limited administrator token
|
||||
@ -10,15 +10,15 @@ Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/server/process.c b/server/process.c
|
||||
index 9288bcc27d5..50295cc0202 100644
|
||||
index 15387a2affa..3a8bbdbfb2e 100644
|
||||
--- a/server/process.c
|
||||
+++ b/server/process.c
|
||||
@@ -664,7 +664,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla
|
||||
if (!parent)
|
||||
{
|
||||
process->handles = alloc_handle_table( process, 0 );
|
||||
- process->token = token_create_admin( TRUE, -1, TokenElevationTypeFull );
|
||||
+ process->token = token_create_admin( TRUE, -1, TokenElevationTypeLimited );
|
||||
- process->token = token_create_admin( TRUE, -1, TokenElevationTypeFull, default_session_id );
|
||||
+ process->token = token_create_admin( TRUE, -1, TokenElevationTypeLimited, default_session_id );
|
||||
process->affinity = ~0;
|
||||
}
|
||||
else
|
||||
|
@ -1,4 +1,3 @@
|
||||
Depends: d3d11-Deferred_Context
|
||||
# Disabling this for now. Needs to be changed again to match the approach taken
|
||||
# for deferred contexts; we'll rebase it once that's been finally fixed upstream.
|
||||
Disabled: true
|
@ -1,4 +1,4 @@
|
||||
From 3239cb2bda6b37a58acb281d8cd66095fb160661 Mon Sep 17 00:00:00 2001
|
||||
From 43d02082f72dd20c098e285877c24bce9312047b Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Mon, 25 Feb 2019 20:28:35 +0300
|
||||
Subject: [PATCH] wined3d: Support indexed vertex blending.
|
||||
@ -12,10 +12,10 @@ Subject: [PATCH] wined3d: Support indexed vertex blending.
|
||||
5 files changed, 169 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
|
||||
index ba649101914..d3e7c62aba8 100644
|
||||
index cfe74a11f5e..0618b2507e8 100644
|
||||
--- a/dlls/d3d9/tests/visual.c
|
||||
+++ b/dlls/d3d9/tests/visual.c
|
||||
@@ -21848,7 +21848,7 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
@@ -21861,7 +21861,7 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
|
||||
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
|
||||
if (caps.MaxVertexBlendMatrixIndex < 7 || caps.MaxVertexBlendMatrices < 4)
|
||||
{
|
||||
@ -24,7 +24,7 @@ index ba649101914..d3e7c62aba8 100644
|
||||
test_id_str, caps.MaxVertexBlendMatrices, caps.MaxVertexBlendMatrixIndex);
|
||||
return;
|
||||
}
|
||||
@@ -22017,7 +22017,7 @@ static void test_indexed_vertex_blending(void)
|
||||
@@ -22030,7 +22030,7 @@ static void test_indexed_vertex_blending(void)
|
||||
memset(&caps, 0, sizeof(caps));
|
||||
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
|
||||
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
|
||||
@ -33,7 +33,7 @@ index ba649101914..d3e7c62aba8 100644
|
||||
caps.MaxVertexBlendMatrixIndex);
|
||||
|
||||
do_test_indexed_vertex_blending(device,"IVB software");
|
||||
@@ -22043,7 +22043,7 @@ static void test_indexed_vertex_blending(void)
|
||||
@@ -22056,7 +22056,7 @@ static void test_indexed_vertex_blending(void)
|
||||
memset(&caps, 0, sizeof(caps));
|
||||
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
|
||||
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
|
||||
@ -43,10 +43,10 @@ index ba649101914..d3e7c62aba8 100644
|
||||
|
||||
hr = IDirect3DDevice9_SetSoftwareVertexProcessing(device, FALSE);
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index ccb6ccb6baa..b46df1a1c40 100644
|
||||
index 3741a881da0..af0c8fa6c52 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -150,6 +150,9 @@ struct shader_glsl_priv
|
||||
@@ -147,6 +147,9 @@ struct shader_glsl_priv
|
||||
struct wine_rb_tree ffp_fragment_shaders;
|
||||
BOOL ffp_proj_control;
|
||||
BOOL legacy_lighting;
|
||||
@ -56,7 +56,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
};
|
||||
|
||||
struct glsl_vs_program
|
||||
@@ -164,6 +167,7 @@ struct glsl_vs_program
|
||||
@@ -161,6 +164,7 @@ struct glsl_vs_program
|
||||
GLint base_vertex_id_location;
|
||||
|
||||
GLint modelview_matrix_location[MAX_VERTEX_BLENDS];
|
||||
@ -64,7 +64,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
GLint projection_matrix_location;
|
||||
GLint normal_matrix_location;
|
||||
GLint texture_matrix_location[WINED3D_MAX_TEXTURES];
|
||||
@@ -1608,10 +1612,10 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -1605,10 +1609,10 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
{
|
||||
unsigned int base, count;
|
||||
|
||||
@ -77,7 +77,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
if (priv->ubo_vs_c == -1)
|
||||
{
|
||||
GL_EXTCALL(glGenBuffers(1, &priv->ubo_vs_c));
|
||||
@@ -1624,6 +1628,21 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -1621,6 +1625,21 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
GL_EXTCALL(glBindBufferBase(GL_UNIFORM_BUFFER, base, priv->ubo_vs_c));
|
||||
checkGLcall("glBindBufferBase");
|
||||
}
|
||||
@ -99,7 +99,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
ctx_data->ubo_bound = TRUE;
|
||||
}
|
||||
|
||||
@@ -1670,28 +1689,41 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
@@ -1667,28 +1686,41 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
||||
}
|
||||
|
||||
if (update_mask & WINED3D_SHADER_CONST_FFP_MODELVIEW)
|
||||
@ -124,16 +124,16 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
- break;
|
||||
+ if (priv->ubo_modelview == -1)
|
||||
+ FIXME("UBO buffer with vertex blend matrices is not initialized.\n");
|
||||
+
|
||||
|
||||
- get_modelview_matrix(context, state, i, &mat);
|
||||
- GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[i], 1, FALSE, &mat._11));
|
||||
- checkGLcall("glUniformMatrix4fv");
|
||||
+ GL_EXTCALL(glBindBuffer(GL_UNIFORM_BUFFER, priv->ubo_modelview));
|
||||
+ checkGLcall("glBindBuffer (UBO)");
|
||||
+ GL_EXTCALL(glBufferData(GL_UNIFORM_BUFFER, sizeof(*priv->modelview_buffer) * MAX_VERTEX_BLEND_UBO,
|
||||
+ NULL, GL_STREAM_DRAW));
|
||||
+ checkGLcall("glBufferData");
|
||||
|
||||
- get_modelview_matrix(context, state, i, &mat);
|
||||
- GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[i], 1, FALSE, &mat._11));
|
||||
- checkGLcall("glUniformMatrix4fv");
|
||||
+
|
||||
+ for (i = 0; i < MAX_VERTEX_BLEND_UBO; ++i)
|
||||
+ get_modelview_matrix(context, state, i, &priv->modelview_buffer[i]);
|
||||
+
|
||||
@ -155,7 +155,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9049,8 +9081,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9079,8 +9111,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
{
|
||||
{"vec4", "ffp_attrib_position"}, /* WINED3D_FFP_POSITION */
|
||||
{"vec4", "ffp_attrib_blendweight"}, /* WINED3D_FFP_BLENDWEIGHT */
|
||||
@ -165,7 +165,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
{"vec3", "ffp_attrib_normal"}, /* WINED3D_FFP_NORMAL */
|
||||
{"float", "ffp_attrib_psize"}, /* WINED3D_FFP_PSIZE */
|
||||
{"vec4", "ffp_attrib_diffuse"}, /* WINED3D_FFP_DIFFUSE */
|
||||
@@ -9066,6 +9097,9 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9096,6 +9127,9 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
string_buffer_clear(buffer);
|
||||
|
||||
shader_glsl_add_version_declaration(buffer, gl_info);
|
||||
@ -175,7 +175,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
|
||||
if (shader_glsl_use_explicit_attrib_location(gl_info))
|
||||
shader_addline(buffer, "#extension GL_ARB_explicit_attrib_location : enable\n");
|
||||
@@ -9080,7 +9114,18 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9110,7 +9144,18 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
}
|
||||
shader_addline(buffer, "\n");
|
||||
|
||||
@ -195,7 +195,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
shader_addline(buffer, "uniform mat4 ffp_projection_matrix;\n");
|
||||
shader_addline(buffer, "uniform mat3 ffp_normal_matrix;\n");
|
||||
shader_addline(buffer, "uniform mat4 ffp_texture_matrix[%u];\n", WINED3D_MAX_TEXTURES);
|
||||
@@ -9142,6 +9187,8 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9172,6 +9217,8 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
shader_addline(buffer, "\nvoid main()\n{\n");
|
||||
shader_addline(buffer, "float m;\n");
|
||||
shader_addline(buffer, "vec3 r;\n");
|
||||
@ -204,7 +204,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(attrib_info); ++i)
|
||||
{
|
||||
@@ -9171,8 +9218,21 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9201,8 +9248,21 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
shader_addline(buffer, "ffp_attrib_blendweight[%u] -= ffp_attrib_blendweight[%u];\n", settings->vertexblends, i);
|
||||
|
||||
shader_addline(buffer, "vec4 ec_pos = vec4(0.0);\n");
|
||||
@ -228,7 +228,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
|
||||
shader_addline(buffer, "gl_Position = ffp_projection_matrix * ec_pos;\n");
|
||||
if (settings->clipping)
|
||||
@@ -9196,7 +9256,19 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
@@ -9226,7 +9286,19 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
||||
else
|
||||
{
|
||||
for (i = 0; i < settings->vertexblends + 1; ++i)
|
||||
@ -249,7 +249,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
}
|
||||
|
||||
if (settings->normalize)
|
||||
@@ -10061,6 +10133,28 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
|
||||
@@ -10091,6 +10163,28 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
|
||||
string_buffer_sprintf(name, "ffp_modelview_matrix[%u]", i);
|
||||
vs->modelview_matrix_location[i] = GL_EXTCALL(glGetUniformLocation(program_id, name->buffer));
|
||||
}
|
||||
@ -278,7 +278,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
vs->projection_matrix_location = GL_EXTCALL(glGetUniformLocation(program_id, "ffp_projection_matrix"));
|
||||
vs->normal_matrix_location = GL_EXTCALL(glGetUniformLocation(program_id, "ffp_normal_matrix"));
|
||||
for (i = 0; i < WINED3D_MAX_TEXTURES; ++i)
|
||||
@@ -10643,7 +10737,7 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl,
|
||||
@@ -10673,7 +10767,7 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl,
|
||||
entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MODELVIEW
|
||||
| WINED3D_SHADER_CONST_FFP_PROJ;
|
||||
|
||||
@ -287,7 +287,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
{
|
||||
if (entry->vs.modelview_matrix_location[i] != -1)
|
||||
{
|
||||
@@ -10652,6 +10746,9 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl,
|
||||
@@ -10682,6 +10776,9 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl,
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
for (i = 0; i < WINED3D_MAX_TEXTURES; ++i)
|
||||
{
|
||||
if (entry->vs.texture_matrix_location[i] != -1)
|
||||
@@ -11192,7 +11289,17 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
@@ -11222,7 +11319,17 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
||||
fragment_pipe->get_caps(device->adapter, &fragment_caps);
|
||||
priv->ffp_proj_control = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_PROJ_CONTROL;
|
||||
priv->legacy_lighting = device->wined3d->flags & WINED3D_LEGACY_FFP_LIGHTING;
|
||||
@ -316,7 +316,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
device->vertex_priv = vertex_priv;
|
||||
device->fragment_priv = fragment_priv;
|
||||
device->shader_priv = priv;
|
||||
@@ -11225,6 +11332,14 @@ static void shader_glsl_free(struct wined3d_device *device, struct wined3d_conte
|
||||
@@ -11255,6 +11362,14 @@ static void shader_glsl_free(struct wined3d_device *device, struct wined3d_conte
|
||||
string_buffer_free(&priv->shader_buffer);
|
||||
priv->fragment_pipe->free_private(device, context);
|
||||
priv->vertex_pipe->vp_free(device, context);
|
||||
@ -331,7 +331,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
|
||||
if (priv->ubo_vs_c != -1)
|
||||
{
|
||||
@@ -11649,7 +11764,11 @@ static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_adapter *adapter,
|
||||
@@ -11679,7 +11794,11 @@ static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_adapter *adapter,
|
||||
caps->ffp_generic_attributes = TRUE;
|
||||
caps->max_active_lights = WINED3D_MAX_ACTIVE_LIGHTS;
|
||||
caps->max_vertex_blend_matrices = MAX_VERTEX_BLENDS;
|
||||
@ -344,7 +344,7 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
caps->vertex_processing_caps = WINED3DVTXPCAPS_TEXGEN
|
||||
| WINED3DVTXPCAPS_MATERIALSOURCE7
|
||||
| WINED3DVTXPCAPS_VERTEXFOG
|
||||
@@ -11851,7 +11970,8 @@ static void glsl_vertex_pipe_pixel_shader(struct wined3d_context *context,
|
||||
@@ -11881,7 +12000,8 @@ static void glsl_vertex_pipe_pixel_shader(struct wined3d_context *context,
|
||||
static void glsl_vertex_pipe_world(struct wined3d_context *context,
|
||||
const struct wined3d_state *state, DWORD state_id)
|
||||
{
|
||||
@ -355,10 +355,10 @@ index ccb6ccb6baa..b46df1a1c40 100644
|
||||
|
||||
static void glsl_vertex_pipe_vertexblend(struct wined3d_context *context,
|
||||
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
|
||||
index b2180782af8..37cede476fc 100644
|
||||
index a359b88931b..41c831b26b0 100644
|
||||
--- a/dlls/wined3d/utils.c
|
||||
+++ b/dlls/wined3d/utils.c
|
||||
@@ -6622,6 +6622,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
|
||||
@@ -6726,6 +6726,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
|
||||
settings->flatshading = FALSE;
|
||||
|
||||
settings->swizzle_map = si->swizzle_map;
|
||||
@ -367,10 +367,10 @@ index b2180782af8..37cede476fc 100644
|
||||
|
||||
int wined3d_ffp_vertex_program_key_compare(const void *key, const struct wine_rb_entry *entry)
|
||||
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
|
||||
index c5df45541e4..f8ee97a03db 100644
|
||||
index 45a01f4bdd4..46788da8e69 100644
|
||||
--- a/dlls/wined3d/vertexdeclaration.c
|
||||
+++ b/dlls/wined3d/vertexdeclaration.c
|
||||
@@ -119,6 +119,15 @@ static BOOL declaration_element_valid_ffp(const struct wined3d_vertex_element *e
|
||||
@@ -121,6 +121,15 @@ static BOOL declaration_element_valid_ffp(const struct wined3d_vertex_element *e
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -387,10 +387,10 @@ index c5df45541e4..f8ee97a03db 100644
|
||||
switch(element->format)
|
||||
{
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 7d7e931d624..600c04900dd 100644
|
||||
index f1de261ed8d..5df817d55ca 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -283,6 +283,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
|
||||
@@ -295,6 +295,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
|
||||
}
|
||||
|
||||
/* Device caps */
|
||||
@ -398,7 +398,7 @@ index 7d7e931d624..600c04900dd 100644
|
||||
#define WINED3D_MAX_ACTIVE_LIGHTS 8
|
||||
#define WINED3D_MAX_SOFTWARE_ACTIVE_LIGHTS 32
|
||||
#define MAX_CONSTANT_BUFFERS 15
|
||||
@@ -3253,7 +3254,8 @@ struct wined3d_ffp_vs_settings
|
||||
@@ -3589,7 +3590,8 @@ struct wined3d_ffp_vs_settings
|
||||
DWORD ortho_fog : 1;
|
||||
DWORD flatshading : 1;
|
||||
DWORD swizzle_map : 16; /* MAX_ATTRIBS, 16 */
|
||||
@ -408,8 +408,8 @@ index 7d7e931d624..600c04900dd 100644
|
||||
|
||||
DWORD texgen[WINED3D_MAX_TEXTURES];
|
||||
};
|
||||
@@ -5453,6 +5455,13 @@ static inline void wined3d_not_from_cs(struct wined3d_cs *cs)
|
||||
assert(cs->thread_id != GetCurrentThreadId());
|
||||
@@ -6065,6 +6067,13 @@ static inline void wined3d_not_from_cs(const struct wined3d_device *device)
|
||||
assert(device->cs->thread_id != GetCurrentThreadId());
|
||||
}
|
||||
|
||||
+static inline BOOL is_indexed_vertex_blending(const struct wined3d_context *context,
|
||||
@ -423,5 +423,5 @@ index 7d7e931d624..600c04900dd 100644
|
||||
enum wined3d_material_color_source source)
|
||||
{
|
||||
--
|
||||
2.26.2
|
||||
2.30.2
|
||||
|
||||
|
@ -1 +1 @@
|
||||
0ec555e58ea9d5b33f4c825e96965ad0cb15d00f
|
||||
52ba1b498a9694daf804c9aea99c788bb4e753a3
|
||||
|
Loading…
Reference in New Issue
Block a user