d3d11-Deferred_Context: Replace with a new implementation.

This commit is contained in:
Zebediah Figura 2021-05-22 01:22:14 -05:00
parent be3928a809
commit 5378adafaa
60 changed files with 3100 additions and 7858 deletions

View File

@ -0,0 +1,34 @@
From 29866a3cb6dc799b060565d94608c7b25bd26509 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 21 May 2021 23:44:39 -0500
Subject: [PATCH] d3d11/tests: Add a couple of extra tests for SRV/RTV
conflict.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/d3d11/tests/d3d11.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 47c6613d904..5ab08632367 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -32364,6 +32364,15 @@ static void test_deferred_context_state(void)
ID3D11DeviceContext_PSGetShaderResources(deferred, 0, 1, &ret_srv);
ok(!ret_srv, "Got unexpected SRV %p.\n", ret_srv);
+ ID3D11DeviceContext_PSSetShaderResources(deferred, 0, 1, &srv);
+ ID3D11DeviceContext_PSGetShaderResources(deferred, 0, 1, &ret_srv);
+ ok(!ret_srv, "Got unexpected SRV %p.\n", ret_srv);
+
+ ID3D11DeviceContext_PSSetShaderResources(immediate, 0, 1, &srv);
+ ID3D11DeviceContext_PSGetShaderResources(immediate, 0, 1, &ret_srv);
+ ok(ret_srv == srv, "Got unexpected SRV %p.\n", ret_srv);
+ ID3D11ShaderResourceView_Release(ret_srv);
+
ID3D11ShaderResourceView_Release(srv);
ID3D11RenderTargetView_Release(rtv);
ID3D11Texture2D_Release(texture);
--
2.30.2

View File

@ -1,174 +0,0 @@
From 1d756dd5a98e84afa53a487cd6b7ecbf0a576422 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 19 Jan 2017 16:54:42 +0100
Subject: [PATCH] wined3d: Add wined3d_resource_map_info function.
---
dlls/wined3d/buffer.c | 19 +++++++++++++++++++
dlls/wined3d/resource.c | 8 ++++++++
dlls/wined3d/texture.c | 31 +++++++++++++++++++++++++++++++
dlls/wined3d/wined3d.spec | 1 +
dlls/wined3d/wined3d_private.h | 2 ++
include/wine/wined3d.h | 9 +++++++++
6 files changed, 70 insertions(+)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index ea21f85bc9e..d030a1cecd6 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -949,6 +949,24 @@ static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resourc
return WINED3D_OK;
}
+static HRESULT buffer_resource_sub_resource_map_info(struct wined3d_resource *resource, unsigned int sub_resource_idx,
+ struct wined3d_map_info *info, DWORD flags)
+{
+ struct wined3d_buffer *buffer = buffer_from_resource(resource);
+
+ if (sub_resource_idx)
+ {
+ WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
+ return E_INVALIDARG;
+ }
+
+ info->row_pitch = resource->size;
+ info->slice_pitch = resource->size;
+ info->size = buffer->resource.size;
+
+ return WINED3D_OK;
+}
+
static HRESULT buffer_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
{
struct wined3d_buffer *buffer = buffer_from_resource(resource);
@@ -1085,6 +1103,7 @@ static const struct wined3d_resource_ops buffer_resource_ops =
buffer_resource_preload,
buffer_resource_unload,
buffer_resource_sub_resource_map,
+ buffer_resource_sub_resource_map_info,
buffer_resource_sub_resource_unmap,
};
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 6e34605f547..b3a46950f4e 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -323,6 +323,14 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
return wined3d_device_context_map(&resource->device->cs->c, resource, sub_resource_idx, map_desc, box, flags);
}
+HRESULT CDECL wined3d_resource_map_info(struct wined3d_resource *resource, unsigned int sub_resource_idx,
+ struct wined3d_map_info *info, DWORD flags)
+{
+ TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
+
+ return resource->resource_ops->resource_map_info(resource, sub_resource_idx, info, flags);
+}
+
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
{
TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 333002ebfd5..ad34329af1d 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -3509,6 +3509,36 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
return WINED3D_OK;
}
+static HRESULT texture_resource_sub_resource_map_info(struct wined3d_resource *resource, unsigned int sub_resource_idx,
+ struct wined3d_map_info *info, DWORD flags)
+{
+ const struct wined3d_format *format = resource->format;
+ struct wined3d_texture_sub_resource *sub_resource;
+ unsigned int fmt_flags = resource->format_flags;
+ struct wined3d_texture *texture;
+ unsigned int texture_level;
+
+ texture = texture_from_resource(resource);
+ if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx)))
+ return E_INVALIDARG;
+
+ texture_level = sub_resource_idx % texture->level_count;
+
+ if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH)
+ {
+ info->row_pitch = wined3d_texture_get_level_width(texture, texture_level) * format->byte_count;
+ info->slice_pitch = wined3d_texture_get_level_height(texture, texture_level) * info->row_pitch;
+ }
+ else
+ {
+ wined3d_texture_get_pitch(texture, texture_level, &info->row_pitch, &info->slice_pitch);
+ }
+
+ info->size = info->slice_pitch * wined3d_texture_get_level_depth(texture, texture_level);
+
+ return WINED3D_OK;
+}
+
static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
{
struct wined3d_texture_sub_resource *sub_resource;
@@ -3561,6 +3591,7 @@ static const struct wined3d_resource_ops texture_resource_ops =
texture_resource_preload,
texture_resource_unload,
texture_resource_sub_resource_map,
+ texture_resource_sub_resource_map_info,
texture_resource_sub_resource_unmap,
};
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 7c81eff1593..63e7b82abda 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -230,6 +230,7 @@
@ cdecl wined3d_resource_get_parent(ptr)
@ cdecl wined3d_resource_get_priority(ptr)
@ cdecl wined3d_resource_map(ptr long ptr ptr long)
+@ cdecl wined3d_resource_map_info(ptr long ptr long)
@ cdecl wined3d_resource_preload(ptr)
@ cdecl wined3d_resource_set_parent(ptr ptr)
@ cdecl wined3d_resource_set_priority(ptr long)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4d5f4765f57..385d0511d56 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4046,6 +4046,8 @@ struct wined3d_resource_ops
void (*resource_unload)(struct wined3d_resource *resource);
HRESULT (*resource_sub_resource_map)(struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags);
+ HRESULT (*resource_map_info)(struct wined3d_resource *resource, unsigned int sub_resource_idx,
+ struct wined3d_map_info *info, DWORD flags);
HRESULT (*resource_sub_resource_unmap)(struct wined3d_resource *resource, unsigned int sub_resource_idx);
};
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 2c4b93ce805..760bb709c2b 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1861,6 +1861,13 @@ struct wined3d_map_desc
void *data;
};
+struct wined3d_map_info
+{
+ UINT row_pitch;
+ UINT slice_pitch;
+ UINT size;
+};
+
struct wined3d_sub_resource_data
{
const void *data;
@@ -2749,6 +2756,8 @@ void * __cdecl wined3d_resource_get_parent(const struct wined3d_resource *resour
DWORD __cdecl wined3d_resource_get_priority(const struct wined3d_resource *resource);
HRESULT __cdecl wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags);
+HRESULT __cdecl wined3d_resource_map_info(struct wined3d_resource *resource, unsigned int sub_resource_idx,
+ struct wined3d_map_info *info, DWORD flags);
void __cdecl wined3d_resource_preload(struct wined3d_resource *resource);
void __cdecl wined3d_resource_set_parent(struct wined3d_resource *resource, void *parent);
DWORD __cdecl wined3d_resource_set_priority(struct wined3d_resource *resource, DWORD priority);
--
2.30.2

View File

@ -0,0 +1,286 @@
From bca2466f49202f638339644f9c92b3573b719822 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Sat, 22 May 2021 00:27:53 -0500
Subject: [PATCH] wined3d: Check for SRV/RTV binding conflicts per
wined3d_state.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/wined3d/context.c | 19 ++++-
dlls/wined3d/device.c | 23 ++++--
dlls/wined3d/resource.c | 1 -
dlls/wined3d/wined3d_private.h | 125 +++++++--------------------------
4 files changed, 61 insertions(+), 107 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 2debf50de7f..7f50126204b 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -335,6 +335,23 @@ void context_update_stream_info(struct wined3d_context *context, const struct wi
}
}
+static bool is_resource_rtv_bound(const struct wined3d_state *state,
+ const struct wined3d_resource *resource)
+{
+ unsigned int i;
+
+ if (!resource->rtv_bind_count_device)
+ return false;
+
+ for (i = 0; i < ARRAY_SIZE(state->fb.render_targets); ++i)
+ {
+ if (state->fb.render_targets[i] && state->fb.render_targets[i]->resource == resource)
+ return true;
+ }
+
+ return false;
+}
+
/* Context activation is done by the caller. */
static void context_preload_texture(struct wined3d_context *context,
const struct wined3d_state *state, unsigned int idx)
@@ -344,7 +361,7 @@ static void context_preload_texture(struct wined3d_context *context,
if (!(texture = state->textures[idx]))
return;
- if ((texture->resource.rtv_full_bind_count_device + texture->resource.rtv_partial_bind_count_device)
+ if (is_resource_rtv_bound(state, &texture->resource)
|| (state->fb.depth_stencil && state->fb.depth_stencil->resource == &texture->resource))
context->uses_fbo_attached_resources = 1;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index dbb5dcf2672..2c8ebba8844 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1985,7 +1985,7 @@ void CDECL wined3d_device_context_set_shader_resource_view(struct wined3d_device
if (view == prev)
return;
- if (view && (wined3d_is_srv_rtv_bound(view)
+ if (view && (wined3d_is_srv_rtv_bound(state, view)
|| ((dsv = state->fb.depth_stencil)
&& dsv->resource == view->resource && wined3d_dsv_srv_conflict(dsv, view->format))))
{
@@ -2064,22 +2064,31 @@ void CDECL wined3d_device_context_set_unordered_access_view(struct wined3d_devic
static void wined3d_device_context_unbind_srv_for_rtv(struct wined3d_device_context *context,
const struct wined3d_rendertarget_view *view, BOOL dsv)
{
- struct wined3d_state *state = context->state;
+ const struct wined3d_state *state = context->state;
+ const struct wined3d_resource *resource;
- if (view && wined3d_is_rtv_srv_bound(view))
+ if (!view)
+ return;
+ resource = view->resource;
+
+ if (resource->srv_bind_count_device)
{
- const struct wined3d_resource *resource = view->resource;
const struct wined3d_shader_resource_view *srv;
unsigned int i, j;
- WARN("Application sets bound resource as render target.\n");
-
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
+ {
for (j = 0; j < MAX_SHADER_RESOURCE_VIEWS; ++j)
+ {
if ((srv = state->shader_resource_view[i][j]) && srv->resource == resource
- && ((!dsv && wined3d_is_srv_rtv_bound(srv))
+ && ((!dsv && wined3d_is_srv_rtv_bound(state, srv))
|| (dsv && wined3d_dsv_srv_conflict(view, srv->format))))
+ {
+ WARN("Application sets bound resource as render target.\n");
wined3d_device_context_set_shader_resource_view(context, i, j, NULL);
+ }
+ }
+ }
}
}
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 6e34605f547..58e3e5c77fd 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -235,7 +235,6 @@ static void wined3d_resource_destroy_object(void *object)
TRACE("resource %p.\n", resource);
- heap_free(resource->sub_resource_bind_counts_device);
wined3d_resource_free_sysmem(resource);
context_resource_released(resource->device, resource);
wined3d_resource_release(resource);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4c308d2ac05..fadad706af4 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4084,16 +4084,8 @@ struct wined3d_resource
struct list resource_list_entry;
- struct
- {
- uint32_t srv;
- uint32_t rtv;
- }
- *sub_resource_bind_counts_device;
- uint32_t srv_full_bind_count_device;
- uint32_t rtv_full_bind_count_device;
- uint32_t srv_partial_bind_count_device;
- uint32_t rtv_partial_bind_count_device;
+ uint32_t srv_bind_count_device;
+ uint32_t rtv_bind_count_device;
};
static inline ULONG wined3d_resource_incref(struct wined3d_resource *resource)
@@ -6214,120 +6206,57 @@ static inline bool wined3d_rtv_all_subresources(const struct wined3d_rendertarge
return texture->level_count == 1 && rtv->layer_count == wined3d_bind_layer_count(texture);
}
-static inline void wined3d_srv_bind_count_add(struct wined3d_shader_resource_view *srv, int value)
-{
- struct wined3d_resource *resource = srv->resource;
- struct wined3d_texture *texture;
- unsigned int level, layer;
-
- if (wined3d_srv_all_subresources(srv))
- {
- resource->srv_full_bind_count_device += value;
- return;
- }
-
- resource->srv_partial_bind_count_device += value;
-
- texture = texture_from_resource(resource);
-
- if (!resource->sub_resource_bind_counts_device
- && !(resource->sub_resource_bind_counts_device = heap_alloc_zero(texture->level_count
- * wined3d_bind_layer_count(texture) * sizeof(*resource->sub_resource_bind_counts_device))))
- return;
-
- for (layer = 0; layer < srv->desc.u.texture.layer_count; ++layer)
- for (level = 0; level < srv->desc.u.texture.level_count; ++level)
- resource->sub_resource_bind_counts_device[(layer + srv->desc.u.texture.layer_idx)
- * texture->level_count + srv->desc.u.texture.level_idx + level].srv += value;
-}
-
static inline void wined3d_srv_bind_count_inc(struct wined3d_shader_resource_view *srv)
{
- wined3d_srv_bind_count_add(srv, 1);
+ ++srv->resource->srv_bind_count_device;
}
static inline void wined3d_srv_bind_count_dec(struct wined3d_shader_resource_view *srv)
{
- wined3d_srv_bind_count_add(srv, -1);
-}
-
-static inline void wined3d_rtv_bind_count_add(struct wined3d_rendertarget_view *rtv, int value)
-{
- struct wined3d_resource *resource = rtv->resource;
- struct wined3d_texture *texture;
- unsigned int layer;
-
- if (wined3d_rtv_all_subresources(rtv))
- {
- resource->rtv_full_bind_count_device += value;
- return;
- }
-
- resource->rtv_partial_bind_count_device += value;
-
- texture = texture_from_resource(resource);
-
- if (!resource->sub_resource_bind_counts_device
- && !(resource->sub_resource_bind_counts_device = heap_alloc_zero(texture->level_count
- * wined3d_bind_layer_count(texture) * sizeof(*resource->sub_resource_bind_counts_device))))
- return;
-
- for (layer = 0; layer < rtv->layer_count; ++layer)
- resource->sub_resource_bind_counts_device[rtv->sub_resource_idx + layer * texture->level_count].rtv += value;
+ --srv->resource->srv_bind_count_device;
}
static inline void wined3d_rtv_bind_count_inc(struct wined3d_rendertarget_view *rtv)
{
- wined3d_rtv_bind_count_add(rtv, 1);
+ ++rtv->resource->rtv_bind_count_device;
}
static inline void wined3d_rtv_bind_count_dec(struct wined3d_rendertarget_view *rtv)
{
- wined3d_rtv_bind_count_add(rtv, -1);
+ --rtv->resource->rtv_bind_count_device;
}
-static inline bool wined3d_is_srv_rtv_bound(const struct wined3d_shader_resource_view *srv)
+static inline bool wined3d_rtv_overlaps_srv(const struct wined3d_rendertarget_view *rtv,
+ const struct wined3d_shader_resource_view *srv)
{
- struct wined3d_resource *resource = srv->resource;
- struct wined3d_texture *texture;
- unsigned int level, layer;
+ if (rtv->resource != srv->resource)
+ return false;
- if (!(resource->rtv_full_bind_count_device + resource->rtv_partial_bind_count_device))
- return FALSE;
+ if (wined3d_srv_all_subresources(srv) || wined3d_rtv_all_subresources(rtv))
+ return true;
- if (resource->rtv_full_bind_count_device || wined3d_srv_all_subresources(srv))
- return TRUE;
-
- texture = texture_from_resource(resource);
-
- for (layer = 0; layer < srv->desc.u.texture.layer_count; ++layer)
- for (level = 0; level < srv->desc.u.texture.level_count; ++level)
- if (resource->sub_resource_bind_counts_device[(layer + srv->desc.u.texture.layer_idx)
- * texture->level_count + srv->desc.u.texture.level_idx + level].rtv)
- return TRUE;
-
- return FALSE;
+ return rtv->sub_resource_idx >= srv->desc.u.texture.level_idx
+ && rtv->sub_resource_idx < srv->desc.u.texture.level_idx + srv->desc.u.texture.level_count
+ && rtv->layer_count >= srv->desc.u.texture.layer_idx;
}
-static inline bool wined3d_is_rtv_srv_bound(const struct wined3d_rendertarget_view *rtv)
+static inline bool wined3d_is_srv_rtv_bound(const struct wined3d_state *state,
+ const struct wined3d_shader_resource_view *srv)
{
- struct wined3d_resource *resource = rtv->resource;
- struct wined3d_texture *texture;
- unsigned int layer;
+ unsigned int i;
- if (!(resource->srv_full_bind_count_device + resource->srv_partial_bind_count_device))
- return FALSE;
+ if (!srv->resource->rtv_bind_count_device)
+ return false;
- if (resource->srv_full_bind_count_device || wined3d_rtv_all_subresources(rtv))
- return TRUE;
+ for (i = 0; i < ARRAY_SIZE(state->fb.render_targets); ++i)
+ {
+ const struct wined3d_rendertarget_view *rtv;
- texture = texture_from_resource(resource);
+ if ((rtv = state->fb.render_targets[i]) && wined3d_rtv_overlaps_srv(rtv, srv))
+ return true;
+ }
- for (layer = 0; layer < rtv->layer_count; ++layer)
- if (resource->sub_resource_bind_counts_device[rtv->sub_resource_idx + layer * texture->level_count].srv)
- return TRUE;
-
- return FALSE;
+ return false;
}
static inline void wined3d_viewport_get_z_range(const struct wined3d_viewport *vp, float *min_z, float *max_z)
--
2.30.2

View File

@ -0,0 +1,270 @@
From d591728c209f7fd9e438eebfb3977692d13bbd6b Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 18 May 2021 21:42:01 -0500
Subject: [PATCH] d3d11/tests: Add some tests for Map() on deferred contexts.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/d3d11/tests/d3d11.c | 239 +++++++++++++++++++++++++++++++++++++++
1 file changed, 239 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 5ab08632367..e5d46f445a4 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -32706,6 +32706,244 @@ static void test_deferred_context_rendering(void)
release_test_context(&test_context);
}
+static void test_deferred_context_map(void)
+{
+ ID3D11DeviceContext *immediate, *deferred;
+ struct d3d11_test_context test_context;
+ D3D11_SUBRESOURCE_DATA resource_data;
+ D3D11_BUFFER_DESC buffer_desc = {0};
+ D3D11_MAPPED_SUBRESOURCE map_desc;
+ ID3D11Buffer *buffer, *buffer2;
+ struct resource_readback rb;
+ ID3D11CommandList *list;
+ float data[16], value;
+ ID3D11Device *device;
+ float *map_data;
+ unsigned int i;
+ HRESULT hr;
+
+ if (!init_test_context(&test_context, NULL))
+ return;
+
+ device = test_context.device;
+ immediate = test_context.immediate_context;
+
+ hr = ID3D11Device_CreateDeferredContext(device, 0, &deferred);
+ todo_wine ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
+ if (hr != S_OK)
+ {
+ release_test_context(&test_context);
+ return;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ data[i] = i;
+ resource_data.pSysMem = data;
+ resource_data.SysMemPitch = 0;
+ resource_data.SysMemSlicePitch = 0;
+
+ buffer_desc.ByteWidth = sizeof(data);
+ buffer_desc.Usage = D3D11_USAGE_DYNAMIC;
+ buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ buffer_desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ hr = ID3D11Device_CreateBuffer(device, &buffer_desc, &resource_data, &buffer);
+ ok(hr == S_OK, "Failed to create buffer, hr %#x.\n", hr);
+ hr = ID3D11Device_CreateBuffer(device, &buffer_desc, &resource_data, &buffer2);
+ ok(hr == S_OK, "Failed to create buffer, hr %#x.\n", hr);
+
+ hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_READ, 0, &map_desc);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+ hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_READ_WRITE, 0, &map_desc);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+ hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE, 0, &map_desc);
+ 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 == 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;
+ /* The previous contents of map_data are undefined and may in practice be
+ * uninitialized garbage. */
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ map_data[i] = 2 * i;
+
+ ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
+
+ 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;
+ 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);
+
+ get_buffer_readback(buffer, &rb);
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ {
+ value = get_readback_float(&rb, i, 0);
+ ok(value == i, "Got unexpected value %.8e at %u.\n", value, i);
+ }
+ release_resource_readback(&rb);
+
+ ID3D11DeviceContext_ExecuteCommandList(immediate, list, TRUE);
+
+ get_buffer_readback(buffer, &rb);
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ {
+ value = get_readback_float(&rb, i, 0);
+ ok(value == 2 * i, "Got unexpected value %.8e at %u.\n", value, i);
+ }
+ release_resource_readback(&rb);
+
+ ID3D11CommandList_Release(list);
+
+ /* Test WRITE_NO_OVERWRITE. */
+
+ hr = ID3D11DeviceContext_Map(immediate, (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] = i;
+ 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);
+
+ 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;
+ ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
+
+ hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_READ, 0, &map_desc);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+ hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_READ_WRITE, 0, &map_desc);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+ hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE, 0, &map_desc);
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ hr = ID3D11DeviceContext_FinishCommandList(deferred, FALSE, &list);
+ ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
+
+ get_buffer_readback(buffer, &rb);
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ {
+ value = get_readback_float(&rb, i, 0);
+ ok(value == i, "Got unexpected value %.8e at %u.\n", value, i);
+ }
+ release_resource_readback(&rb);
+
+ ID3D11DeviceContext_ExecuteCommandList(immediate, list, TRUE);
+
+ get_buffer_readback(buffer, &rb);
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ {
+ value = get_readback_float(&rb, i, 0);
+ ok(value == data[i], "Got unexpected value %.8e at %u.\n", value, i);
+ }
+ release_resource_readback(&rb);
+
+ ID3D11CommandList_Release(list);
+
+ /* Do something with the mapped data from within the deferred context. */
+
+ hr = ID3D11DeviceContext_Map(immediate, (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] = i;
+ ID3D11DeviceContext_Unmap(immediate, (ID3D11Resource *)buffer, 0);
+
+ 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;
+ ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
+
+ ID3D11DeviceContext_CopyResource(deferred, (ID3D11Resource *)buffer2, (ID3D11Resource *)buffer);
+
+ 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] = 3 * i;
+ 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);
+
+ get_buffer_readback(buffer, &rb);
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ {
+ value = get_readback_float(&rb, i, 0);
+ ok(value == i, "Got unexpected value %.8e at %u.\n", value, i);
+ }
+ release_resource_readback(&rb);
+
+ ID3D11DeviceContext_ExecuteCommandList(immediate, list, TRUE);
+
+ get_buffer_readback(buffer2, &rb);
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ {
+ value = get_readback_float(&rb, i, 0);
+ ok(value == 2 * i, "Got unexpected value %.8e at %u.\n", value, i);
+ }
+ release_resource_readback(&rb);
+
+ get_buffer_readback(buffer, &rb);
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ {
+ value = get_readback_float(&rb, i, 0);
+ ok(value == 3 * i, "Got unexpected value %.8e at %u.\n", value, i);
+ }
+ release_resource_readback(&rb);
+
+ ID3D11CommandList_Release(list);
+
+ ID3D11Buffer_Release(buffer2);
+ ID3D11Buffer_Release(buffer);
+ ID3D11DeviceContext_Release(deferred);
+ release_test_context(&test_context);
+}
+
START_TEST(d3d11)
{
unsigned int argc, i;
@@ -32876,6 +33114,7 @@ START_TEST(d3d11)
queue_test(test_deferred_context_state);
queue_test(test_deferred_context_swap_state);
queue_test(test_deferred_context_rendering);
+ queue_test(test_deferred_context_map);
queue_test(test_unbound_streams);
run_queued_tests();
--
2.30.2

View File

@ -1,81 +0,0 @@
From fc3937794343611ef4bedefc4829ed06ceee8f64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 24 Jan 2017 04:10:12 +0100
Subject: [PATCH] d3d11: Implement CSSetShader for deferred contexts.
---
dlls/d3d11/device.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 2f13e85..e54ccaf 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -40,6 +40,7 @@ enum deferred_cmd
DEFERRED_OMSETBLENDSTATE, /* blend_state_info */
DEFERRED_OMSETRENDERTARGETS, /* render_target_info */
+ DEFERRED_CSSETSHADER, /* cs_info */
DEFERRED_DSSETSHADER, /* ds_info */
DEFERRED_HSSETSHADER, /* hs_info */
DEFERRED_PSSETSHADER, /* ps_info */
@@ -120,6 +121,11 @@ struct deferred_call
} render_target_info;
struct
{
+ ID3D11ComputeShader *shader;
+ /* FIXME: add class instances */
+ } cs_info;
+ struct
+ {
ID3D11DomainShader *shader;
/* FIXME: add class instances */
} ds_info;
@@ -349,6 +355,12 @@ static void free_deferred_calls(struct list *commands)
ID3D11DepthStencilView_Release(call->render_target_info.depth_stencil);
break;
}
+ case DEFERRED_CSSETSHADER:
+ {
+ if (call->cs_info.shader)
+ ID3D11ComputeShader_Release(call->cs_info.shader);
+ break;
+ }
case DEFERRED_DSSETSHADER:
{
if (call->ds_info.shader)
@@ -491,6 +503,11 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
call->render_target_info.render_targets, call->render_target_info.depth_stencil);
break;
}
+ case DEFERRED_CSSETSHADER:
+ {
+ ID3D11DeviceContext1_CSSetShader(iface, call->cs_info.shader, NULL, 0);
+ break;
+ }
case DEFERRED_DSSETSHADER:
{
ID3D11DeviceContext1_DSSetShader(iface, call->ds_info.shader, NULL, 0);
@@ -4410,8 +4427,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetUnorderedAccessViews(I
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetShader(ID3D11DeviceContext *iface,
ID3D11ComputeShader *shader, ID3D11ClassInstance *const *class_instances, UINT class_instance_count)
{
- FIXME("iface %p, shader %p, class_instances %p, class_instance_count %u stub!\n",
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+ struct deferred_call *call;
+
+ TRACE("iface %p, shader %p, class_instances %p, class_instance_count %u.\n",
iface, shader, class_instances, class_instance_count);
+
+ if (!(call = add_deferred_call(context, 0)))
+ return;
+
+ call->cmd = DEFERRED_CSSETSHADER;
+ if (shader) ID3D11ComputeShader_AddRef(shader);
+ call->cs_info.shader = shader;
}
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetSamplers(ID3D11DeviceContext *iface,
--
1.9.1

View File

@ -0,0 +1,70 @@
From 621c0b6f10a09dd7300caa8870015a931d338e85 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 21 May 2021 22:17:30 -0500
Subject: [PATCH] d3d11/tests: Add some tests for UpdateSubresource() on a
deferred context.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/d3d11/tests/d3d11.c | 45 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index e5d46f445a4..0f5ba6c3663 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -32940,6 +32940,51 @@ static void test_deferred_context_map(void)
ID3D11Buffer_Release(buffer2);
ID3D11Buffer_Release(buffer);
+
+ /* Test UpdateSubresource. */
+
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ data[i] = i;
+
+ buffer_desc.ByteWidth = sizeof(data);
+ buffer_desc.Usage = D3D11_USAGE_DEFAULT;
+ buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ buffer_desc.CPUAccessFlags = 0;
+ hr = ID3D11Device_CreateBuffer(device, &buffer_desc, &resource_data, &buffer);
+ ok(hr == S_OK, "Failed to create buffer, hr %#x.\n", hr);
+ hr = ID3D11Device_CreateBuffer(device, &buffer_desc, &resource_data, &buffer2);
+ ok(hr == S_OK, "Failed to create buffer, hr %#x.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ data[i] = 2 * i;
+ ID3D11DeviceContext_UpdateSubresource(deferred, (ID3D11Resource *)buffer, 0, NULL, data, 0, 0);
+
+ hr = ID3D11DeviceContext_FinishCommandList(deferred, FALSE, &list);
+ ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
+
+ get_buffer_readback(buffer, &rb);
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ {
+ value = get_readback_float(&rb, i, 0);
+ ok(value == i, "Got unexpected value %.8e at %u.\n", value, i);
+ }
+ release_resource_readback(&rb);
+
+ ID3D11DeviceContext_ExecuteCommandList(immediate, list, TRUE);
+
+ get_buffer_readback(buffer, &rb);
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ {
+ value = get_readback_float(&rb, i, 0);
+ ok(value == 2 * i, "Got unexpected value %.8e at %u.\n", value, i);
+ }
+ release_resource_readback(&rb);
+
+ ID3D11CommandList_Release(list);
+
+ ID3D11Buffer_Release(buffer2);
+ ID3D11Buffer_Release(buffer);
+
ID3D11DeviceContext_Release(deferred);
release_test_context(&test_context);
}
--
2.30.2

View File

@ -1,68 +0,0 @@
From ac4e13da593e8d6fcd868e95414eb6395fb28e44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 24 Jan 2017 04:21:47 +0100
Subject: [PATCH] d3d11: Implement CSSetConstantBuffers for deferred contexts.
---
dlls/d3d11/device.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index e54ccaf..8fee8cd 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -52,6 +52,7 @@ enum deferred_cmd
DEFERRED_DSSETSAMPLERS, /* samplers_info */
DEFERRED_PSSETSAMPLERS, /* samplers_info */
+ DEFERRED_CSSETCONSTANTBUFFERS, /* constant_buffers_info */
DEFERRED_DSSETCONSTANTBUFFERS, /* constant_buffers_info */
DEFERRED_HSSETCONSTANTBUFFERS, /* constant_buffers_info */
DEFERRED_PSSETCONSTANTBUFFERS, /* constant_buffers_info */
@@ -266,7 +267,7 @@ static void add_deferred_set_samplers(struct d3d11_deferred_context *context, en
}
}
-/* for DEFERRED_DSSETCONSTANTBUFFERS, DEFERRED_HSSETCONSTANTBUFFERS,
+/* for DEFERRED_CSSETCONSTANTBUFFERS. DEFERRED_DSSETCONSTANTBUFFERS, DEFERRED_HSSETCONSTANTBUFFERS,
* DEFERRED_PSSETCONSTANTBUFFERS and DEFERRED_VSSETCONSTANTBUFFERS */
static void add_deferred_set_constant_buffers(struct d3d11_deferred_context *context, enum deferred_cmd cmd,
UINT start_slot, UINT buffer_count, ID3D11Buffer *const *buffers)
@@ -405,6 +406,7 @@ static void free_deferred_calls(struct list *commands)
}
break;
}
+ case DEFERRED_CSSETCONSTANTBUFFERS:
case DEFERRED_DSSETCONSTANTBUFFERS:
case DEFERRED_HSSETCONSTANTBUFFERS:
case DEFERRED_PSSETCONSTANTBUFFERS:
@@ -552,6 +554,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
call->samplers_info.num_samplers, call->samplers_info.samplers);
break;
}
+ case DEFERRED_CSSETCONSTANTBUFFERS:
+ {
+ ID3D11DeviceContext1_CSSetConstantBuffers(iface, call->constant_buffers_info.start_slot,
+ call->constant_buffers_info.num_buffers, call->constant_buffers_info.buffers);
+ break;
+ }
case DEFERRED_DSSETCONSTANTBUFFERS:
{
ID3D11DeviceContext1_DSSetConstantBuffers(iface, call->constant_buffers_info.start_slot,
@@ -4451,8 +4459,12 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetSamplers(ID3D11DeviceC
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetConstantBuffers(ID3D11DeviceContext *iface,
UINT start_slot, UINT buffer_count, ID3D11Buffer *const *buffers)
{
- FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+
+ TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
iface, start_slot, buffer_count, buffers);
+
+ add_deferred_set_constant_buffers(context, DEFERRED_CSSETCONSTANTBUFFERS, start_slot, buffer_count, buffers);
}
static void STDMETHODCALLTYPE d3d11_deferred_context_VSGetConstantBuffers(ID3D11DeviceContext *iface,
--
1.9.1

View File

@ -0,0 +1,92 @@
From 78d2694bb7cb03fa84c6a093ba28264f81adc143 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Wed, 12 May 2021 16:40:00 -0500
Subject: [PATCH] wined3d: Store the framebuffer state inline in struct
wined3d_cs_clear.
Avoid storing pointers to the CS data inside individual ops.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/wined3d/cs.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 14076defaa9..8702ac08631 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -107,7 +107,7 @@ struct wined3d_cs_clear
enum wined3d_cs_op opcode;
DWORD flags;
unsigned int rt_count;
- struct wined3d_fb_state *fb;
+ struct wined3d_fb_state fb;
RECT draw_rect;
struct wined3d_color color;
float depth;
@@ -684,19 +684,19 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
const struct wined3d_cs_clear *op = data;
unsigned int i;
- device->blitter->ops->blitter_clear(device->blitter, device, op->rt_count, op->fb,
+ device->blitter->ops->blitter_clear(device->blitter, device, op->rt_count, &op->fb,
op->rect_count, op->rects, &op->draw_rect, op->flags, &op->color, op->depth, op->stencil);
if (op->flags & WINED3DCLEAR_TARGET)
{
for (i = 0; i < op->rt_count; ++i)
{
- if (op->fb->render_targets[i])
- wined3d_resource_release(op->fb->render_targets[i]->resource);
+ if (op->fb.render_targets[i])
+ wined3d_resource_release(op->fb.render_targets[i]->resource);
}
}
if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
- wined3d_resource_release(op->fb->depth_stencil->resource);
+ wined3d_resource_release(op->fb.depth_stencil->resource);
}
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
@@ -715,7 +715,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags & (WINED3DCLEAR_TARGET | WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
op->rt_count = rt_count;
- op->fb = &cs->state.fb;
+ op->fb = state->fb;
SetRect(&op->draw_rect, vp->x, vp->y, vp->x + vp->width, vp->y + vp->height);
if (state->rasterizer_state && state->rasterizer_state->desc.scissor)
IntersectRect(&op->draw_rect, &op->draw_rect, &state->scissor_rects[0]);
@@ -746,24 +746,23 @@ void wined3d_device_context_emit_clear_rendertarget_view(struct wined3d_device_c
struct wined3d_cs_clear *op;
size_t size;
- size = FIELD_OFFSET(struct wined3d_cs_clear, rects[1]) + sizeof(struct wined3d_fb_state);
+ size = FIELD_OFFSET(struct wined3d_cs_clear, rects[1]);
op = wined3d_device_context_require_space(context, size, WINED3D_CS_QUEUE_DEFAULT);
- op->fb = (void *)&op->rects[1];
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags & (WINED3DCLEAR_TARGET | WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
if (flags & WINED3DCLEAR_TARGET)
{
op->rt_count = 1;
- op->fb->render_targets[0] = view;
- op->fb->depth_stencil = NULL;
+ op->fb.render_targets[0] = view;
+ op->fb.depth_stencil = NULL;
op->color = *color;
}
else
{
op->rt_count = 0;
- op->fb->render_targets[0] = NULL;
- op->fb->depth_stencil = view;
+ op->fb.render_targets[0] = NULL;
+ op->fb.depth_stencil = view;
op->depth = depth;
op->stencil = stencil;
}
--
2.30.2

View File

@ -1,82 +0,0 @@
From 300aab481c30eddac58cbf7c9a418d3c0f7bb4e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 24 Jan 2017 04:29:10 +0100
Subject: [PATCH] d3d11: Implement Dispatch for deferred contexts.
---
dlls/d3d11/device.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 8fee8cd..b1f148a 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -62,6 +62,7 @@ enum deferred_cmd
DEFERRED_DRAWINDEXEDINSTANCED, /* draw_indexed_inst_info */
DEFERRED_MAP, /* map_info */
+ DEFERRED_DISPATCH, /* dispatch_info */
DEFERRED_CLEARSTATE,
};
@@ -186,6 +187,12 @@ struct deferred_call
void *buffer;
UINT size;
} map_info;
+ struct
+ {
+ UINT count_x;
+ UINT count_y;
+ UINT count_z;
+ } dispatch_info;
};
};
@@ -429,6 +436,10 @@ static void free_deferred_calls(struct list *commands)
ID3D11Resource_Release(call->map_info.resource);
break;
}
+ case DEFERRED_DISPATCH:
+ {
+ break; /* nothing to do */
+ }
case DEFERRED_CLEARSTATE:
{
break; /* nothing to do */
@@ -614,6 +625,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
break;
}
+ case DEFERRED_DISPATCH:
+ {
+ ID3D11DeviceContext1_Dispatch(iface, call->dispatch_info.count_x,
+ call->dispatch_info.count_y, call->dispatch_info.count_z);
+ break;
+ }
case DEFERRED_CLEARSTATE:
{
ID3D11DeviceContext1_ClearState(iface);
@@ -4181,8 +4198,19 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DrawInstancedIndirect(ID3D1
static void STDMETHODCALLTYPE d3d11_deferred_context_Dispatch(ID3D11DeviceContext *iface,
UINT thread_group_count_x, UINT thread_group_count_y, UINT thread_group_count_z)
{
- FIXME("iface %p, thread_group_count_x %u, thread_group_count_y %u, thread_group_count_z %u stub!\n",
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+ struct deferred_call *call;
+
+ TRACE("iface %p, thread_group_count_x %u, thread_group_count_y %u, thread_group_count_z %u.\n",
iface, thread_group_count_x, thread_group_count_y, thread_group_count_z);
+
+ if (!(call = add_deferred_call(context, 0)))
+ return;
+
+ call->cmd = DEFERRED_DISPATCH;
+ call->dispatch_info.count_x = thread_group_count_x;
+ call->dispatch_info.count_y = thread_group_count_y;
+ call->dispatch_info.count_z = thread_group_count_z;
}
static void STDMETHODCALLTYPE d3d11_deferred_context_DispatchIndirect(ID3D11DeviceContext *iface,
--
1.9.1

View File

@ -0,0 +1,487 @@
From 6b084cc6c70ca2e68709bf417f9d485199e0a04c Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 6 May 2021 20:49:03 -0500
Subject: [PATCH] d3d11: Implement ID3D11Device::CreateDeferredContext().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42191
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/d3d11/d3d11_private.h | 1 +
dlls/d3d11/device.c | 70 +++++++++++++++---
dlls/d3d11/tests/d3d11.c | 65 ++++++++--------
dlls/wined3d/cs.c | 147 +++++++++++++++++++++++++++++++++++++
dlls/wined3d/wined3d.spec | 3 +
include/wine/wined3d.h | 3 +
6 files changed, 250 insertions(+), 39 deletions(-)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 1a8cdc6d77c..2b5a51afbd1 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -547,6 +547,7 @@ struct d3d11_device_context
ID3D11Multithread ID3D11Multithread_iface;
LONG refcount;
+ D3D11_DEVICE_CONTEXT_TYPE type;
struct wined3d_device_context *wined3d_context;
struct d3d_device *device;
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 2a012fce144..459c49145cd 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -351,7 +351,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_context_QueryInterface(ID3D11Devic
{
*out = &context->ID3D11DeviceContext1_iface;
}
- else if (IsEqualGUID(iid, &IID_ID3D11Multithread))
+ else if (context->type == D3D11_DEVICE_CONTEXT_IMMEDIATE && IsEqualGUID(iid, &IID_ID3D11Multithread))
{
*out = &context->ID3D11Multithread_iface;
}
@@ -390,6 +390,11 @@ static ULONG STDMETHODCALLTYPE d3d11_device_context_Release(ID3D11DeviceContext1
if (!refcount)
{
+ if (context->type != D3D11_DEVICE_CONTEXT_IMMEDIATE)
+ {
+ wined3d_deferred_context_destroy(context->wined3d_context);
+ heap_free(context);
+ }
ID3D11Device2_Release(&context->device->ID3D11Device2_iface);
}
@@ -2645,9 +2650,11 @@ static void STDMETHODCALLTYPE d3d11_device_context_Flush(ID3D11DeviceContext1 *i
static D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE d3d11_device_context_GetType(ID3D11DeviceContext1 *iface)
{
+ struct d3d11_device_context *context = impl_from_ID3D11DeviceContext1(iface);
+
TRACE("iface %p.\n", iface);
- return D3D11_DEVICE_CONTEXT_IMMEDIATE;
+ return context->type;
}
static UINT STDMETHODCALLTYPE d3d11_device_context_GetContextFlags(ID3D11DeviceContext1 *iface)
@@ -2826,13 +2833,18 @@ static void STDMETHODCALLTYPE d3d11_device_context_SwapDeviceContextState(ID3D11
TRACE("iface %p, state %p, prev %p.\n", iface, state, prev);
- if (!state)
+ if (prev)
+ *prev = NULL;
+
+ if (context->type != D3D11_DEVICE_CONTEXT_IMMEDIATE)
{
- if (prev)
- *prev = NULL;
+ WARN("SwapDeviceContextState is not allowed on a deferred context.\n");
return;
}
+ if (!state)
+ return;
+
wined3d_mutex_lock();
prev_impl = device->state;
@@ -3082,11 +3094,13 @@ static const struct ID3D11MultithreadVtbl d3d11_multithread_vtbl =
d3d11_multithread_GetMultithreadProtected,
};
-static void d3d11_device_context_init(struct d3d11_device_context *context, struct d3d_device *device)
+static void d3d11_device_context_init(struct d3d11_device_context *context, struct d3d_device *device,
+ D3D11_DEVICE_CONTEXT_TYPE type)
{
context->ID3D11DeviceContext1_iface.lpVtbl = &d3d11_device_context_vtbl;
context->ID3D11Multithread_iface.lpVtbl = &d3d11_multithread_vtbl;
context->refcount = 1;
+ context->type = type;
context->device = device;
ID3D11Device2_AddRef(&device->ID3D11Device2_iface);
@@ -3575,13 +3589,49 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateCounter(ID3D11Device2 *iface
return E_NOTIMPL;
}
+static HRESULT d3d11_deferred_context_create(struct d3d_device *device,
+ UINT flags, struct d3d11_device_context **context)
+{
+ struct d3d11_device_context *object;
+ HRESULT hr;
+
+ if (flags)
+ FIXME("Ignoring flags %#x.\n", flags);
+
+ if (!(object = heap_alloc_zero(sizeof(*object))))
+ return E_OUTOFMEMORY;
+ d3d11_device_context_init(object, device, D3D11_DEVICE_CONTEXT_DEFERRED);
+
+ wined3d_mutex_lock();
+ if (FAILED(hr = wined3d_deferred_context_create(device->wined3d_device, &object->wined3d_context)))
+ {
+ WARN("Failed to create wined3d deferred context, hr %#x.\n", hr);
+ heap_free(object);
+ wined3d_mutex_unlock();
+ return hr;
+ }
+ wined3d_mutex_unlock();
+
+ TRACE("Created deferred context %p.\n", object);
+ *context = object;
+
+ return S_OK;
+}
+
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext(ID3D11Device2 *iface, UINT flags,
ID3D11DeviceContext **context)
{
- FIXME("iface %p, flags %#x, context %p stub!\n", iface, flags, context);
+ struct d3d_device *device = impl_from_ID3D11Device2(iface);
+ struct d3d11_device_context *object;
+ HRESULT hr;
- *context = NULL;
- return E_NOTIMPL;
+ TRACE("iface %p, flags %#x, context %p.\n", iface, flags, context);
+
+ if (FAILED(hr = d3d11_deferred_context_create(device, flags, &object)))
+ return hr;
+
+ *context = (ID3D11DeviceContext *)&object->ID3D11DeviceContext1_iface;
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d11_device_OpenSharedResource(ID3D11Device2 *iface, HANDLE resource, REFIID iid,
@@ -6655,7 +6705,7 @@ void d3d_device_init(struct d3d_device *device, void *outer_unknown)
device->d3d11_only = FALSE;
device->state = NULL;
- d3d11_device_context_init(&device->immediate_context, device);
+ d3d11_device_context_init(&device->immediate_context, device, D3D11_DEVICE_CONTEXT_IMMEDIATE);
ID3D11DeviceContext1_Release(&device->immediate_context.ID3D11DeviceContext1_iface);
wine_rb_init(&device->blend_states, d3d_blend_state_compare);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 0f5ba6c3663..43ea70d2e9b 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -2266,6 +2266,8 @@ static void test_create_deferred_context(void)
hr = ID3D11Device_CreateDeferredContext(device, 0, &context);
todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Failed to create deferred context, hr %#x.\n", hr);
+ if (hr == S_OK)
+ ID3D11DeviceContext_Release(context);
refcount = ID3D11Device_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
@@ -2278,9 +2280,7 @@ static void test_create_deferred_context(void)
expected_refcount = get_refcount(device) + 1;
hr = ID3D11Device_CreateDeferredContext(device, 0, &context);
- todo_wine ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
- if (FAILED(hr))
- goto done;
+ ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
refcount = get_refcount(device);
ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount);
refcount = get_refcount(context);
@@ -2294,7 +2294,6 @@ static void test_create_deferred_context(void)
refcount = ID3D11DeviceContext_Release(context);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
-done:
refcount = ID3D11Device_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
}
@@ -32270,14 +32269,7 @@ static void test_deferred_context_state(void)
ID3D11DeviceContext_PSSetConstantBuffers(immediate, 0, 1, &green_buffer);
hr = ID3D11Device_CreateDeferredContext(device, 0, &deferred);
- todo_wine ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
- if (hr != S_OK)
- {
- ID3D11Buffer_Release(blue_buffer);
- ID3D11Buffer_Release(green_buffer);
- release_test_context(&test_context);
- return;
- }
+ ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer);
ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
@@ -32289,7 +32281,15 @@ static void test_deferred_context_state(void)
ID3D11Buffer_Release(ret_buffer);
hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list1);
- ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
+ todo_wine ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
+ if (hr != S_OK)
+ {
+ ID3D11DeviceContext_Release(deferred);
+ ID3D11Buffer_Release(blue_buffer);
+ ID3D11Buffer_Release(green_buffer);
+ release_test_context(&test_context);
+ return;
+ }
ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer);
ok(ret_buffer == blue_buffer, "Got unexpected buffer %p.\n", ret_buffer);
@@ -32468,12 +32468,7 @@ static void test_deferred_context_rendering(void)
immediate = test_context.immediate_context;
hr = ID3D11Device_CreateDeferredContext(device, 0, &deferred);
- todo_wine ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
- if (hr != S_OK)
- {
- release_test_context(&test_context);
- return;
- }
+ ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
memset(&blend_desc, 0, sizeof(blend_desc));
@@ -32492,7 +32487,16 @@ static void test_deferred_context_rendering(void)
ID3D11DeviceContext_ClearRenderTargetView(deferred, test_context.backbuffer_rtv, green);
hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list1);
- ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
+ todo_wine ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
+ if (hr != S_OK)
+ {
+ ID3D11BlendState_Release(red_blend);
+ ID3D11BlendState_Release(green_blend);
+ ID3D11BlendState_Release(blue_blend);
+ ID3D11DeviceContext_Release(deferred);
+ release_test_context(&test_context);
+ return;
+ }
hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list2);
ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
@@ -32729,12 +32733,7 @@ static void test_deferred_context_map(void)
immediate = test_context.immediate_context;
hr = ID3D11Device_CreateDeferredContext(device, 0, &deferred);
- todo_wine ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
- if (hr != S_OK)
- {
- release_test_context(&test_context);
- return;
- }
+ ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(data); ++i)
data[i] = i;
@@ -32758,13 +32757,21 @@ 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);
- ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ todo_wine 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 == 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);
+ 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;
+ }
map_data = map_desc.pData;
/* The previous contents of map_data are undefined and may in practice be
* uninitialized garbage. */
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 8702ac08631..9a143b915ed 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -3162,3 +3162,150 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
heap_free(cs->data);
heap_free(cs);
}
+
+struct wined3d_deferred_context
+{
+ struct wined3d_device_context c;
+
+ SIZE_T data_size, data_capacity;
+ void *data;
+};
+
+static struct wined3d_deferred_context *wined3d_deferred_context_from_context(struct wined3d_device_context *context)
+{
+ return CONTAINING_RECORD(context, struct wined3d_deferred_context, c);
+}
+
+static void *wined3d_deferred_context_require_space(struct wined3d_device_context *context,
+ size_t size, enum wined3d_cs_queue_id queue_id)
+{
+ struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
+ struct wined3d_cs_packet *packet;
+ size_t header_size, packet_size;
+
+ assert(queue_id == WINED3D_CS_QUEUE_DEFAULT);
+
+ header_size = offsetof(struct wined3d_cs_packet, data[0]);
+ packet_size = offsetof(struct wined3d_cs_packet, data[size]);
+ packet_size = (packet_size + header_size - 1) & ~(header_size - 1);
+
+ if (!wined3d_array_reserve(&deferred->data, &deferred->data_capacity, deferred->data_size + packet_size, 1))
+ return NULL;
+
+ packet = (struct wined3d_cs_packet *)((BYTE *)deferred->data + deferred->data_size);
+ TRACE("size was %zu, adding %zu\n", (size_t)deferred->data_size, packet_size);
+ deferred->data_size += packet_size;
+ packet->size = packet_size - header_size;
+ return &packet->data;
+}
+
+static void wined3d_deferred_context_submit(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
+{
+ assert(queue_id == WINED3D_CS_QUEUE_DEFAULT);
+
+ /* Nothing to do. */
+}
+
+static void wined3d_deferred_context_finish(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
+{
+ /* This should not happen; we cannot meaningfully finish a deferred context. */
+ ERR("Ignoring finish() on a deferred context.\n");
+}
+
+static void wined3d_deferred_context_push_constants(struct wined3d_device_context *context,
+ enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants)
+{
+ FIXME("context %p, p %#x, start_idx %u, count %u, constants %p, stub!\n", context, p, start_idx, count, constants);
+}
+
+static HRESULT wined3d_deferred_context_map(struct wined3d_device_context *context,
+ struct wined3d_resource *resource, unsigned int sub_resource_idx,
+ struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags)
+{
+ FIXME("context %p, resource %p, sub_resource_idx %u, map_desc %p, box %p, flags %#x, stub!\n",
+ context, resource, sub_resource_idx, map_desc, box, flags);
+ return E_NOTIMPL;
+}
+
+static HRESULT wined3d_deferred_context_unmap(struct wined3d_device_context *context,
+ struct wined3d_resource *resource, unsigned int sub_resource_idx)
+{
+ FIXME("context %p, resource %p, sub_resource_idx %u, stub!\n",
+ context, resource, sub_resource_idx);
+ return E_NOTIMPL;
+}
+
+static void wined3d_deferred_context_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)
+{
+ FIXME("context %p, resource %p, sub_resource_idx %u, box %p, data %p, row_pitch %u, slice_pitch %u, stub!\n",
+ context, resource, sub_resource_idx, box, data, row_pitch, slice_pitch);
+}
+
+static void wined3d_deferred_context_issue_query(struct wined3d_device_context *context,
+ struct wined3d_query *query, unsigned int flags)
+{
+ FIXME("context %p, query %p, flags %#x, stub!\n", context, query, flags);
+}
+
+static void wined3d_deferred_context_flush(struct wined3d_device_context *context)
+{
+ FIXME("context %p, stub!\n", context);
+}
+
+static void wined3d_deferred_context_acquire_resource(struct wined3d_device_context *context,
+ struct wined3d_resource *resource)
+{
+ FIXME("context %p, resource %p, stub!\n", context, resource);
+}
+
+static const struct wined3d_device_context_ops wined3d_deferred_context_ops =
+{
+ wined3d_deferred_context_require_space,
+ wined3d_deferred_context_submit,
+ wined3d_deferred_context_finish,
+ wined3d_deferred_context_push_constants,
+ wined3d_deferred_context_map,
+ wined3d_deferred_context_unmap,
+ wined3d_deferred_context_update_sub_resource,
+ wined3d_deferred_context_issue_query,
+ wined3d_deferred_context_flush,
+ wined3d_deferred_context_acquire_resource,
+};
+
+HRESULT CDECL wined3d_deferred_context_create(struct wined3d_device *device, struct wined3d_device_context **context)
+{
+ struct wined3d_deferred_context *object;
+ HRESULT hr;
+
+ TRACE("device %p, context %p.\n", device, context);
+
+ if (!(object = heap_alloc_zero(sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ if (FAILED(hr = wined3d_state_create(device, &device->cs->c.state->feature_level, 1, &object->c.state)))
+ {
+ heap_free(object);
+ return hr;
+ }
+
+ object->c.ops = &wined3d_deferred_context_ops;
+ object->c.device = device;
+
+ TRACE("Created deferred context %p.\n", context);
+ *context = &object->c;
+
+ return S_OK;
+}
+
+void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *context)
+{
+ struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
+
+ TRACE("context %p.\n", context);
+
+ wined3d_state_destroy(deferred->c.state);
+ heap_free(deferred->data);
+ heap_free(deferred);
+}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 9f3dfed7ef8..901e9bee621 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -33,6 +33,9 @@
@ cdecl wined3d_buffer_get_resource(ptr)
@ cdecl wined3d_buffer_incref(ptr)
+@ cdecl wined3d_deferred_context_create(ptr ptr)
+@ cdecl wined3d_deferred_context_destroy(ptr)
+
@ cdecl wined3d_depth_stencil_state_create(ptr ptr ptr ptr ptr)
@ cdecl wined3d_depth_stencil_state_decref(ptr)
@ cdecl wined3d_depth_stencil_state_get_parent(ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 2ee18bcaaed..0be192b0f01 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2340,6 +2340,9 @@ void * __cdecl wined3d_buffer_get_parent(const struct wined3d_buffer *buffer);
struct wined3d_resource * __cdecl wined3d_buffer_get_resource(struct wined3d_buffer *buffer);
ULONG __cdecl wined3d_buffer_incref(struct wined3d_buffer *buffer);
+HRESULT __cdecl wined3d_deferred_context_create(struct wined3d_device *device, struct wined3d_device_context **context);
+void __cdecl wined3d_deferred_context_destroy(struct wined3d_device_context *context);
+
HRESULT __cdecl wined3d_depth_stencil_state_create(struct wined3d_device *device,
const struct wined3d_depth_stencil_state_desc *desc, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_depth_stencil_state **state);
--
2.30.2

View File

@ -1,98 +0,0 @@
From 116636717ee333aff38b77530fbcb885ad46f0a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 24 Jan 2017 04:48:56 +0100
Subject: [PATCH] d3d11: Implement CSSetUnorderedAccessViews for deferred
contexts.
---
dlls/d3d11/device.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index b1f148a..3c475e7 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -58,6 +58,8 @@ enum deferred_cmd
DEFERRED_PSSETCONSTANTBUFFERS, /* constant_buffers_info */
DEFERRED_VSSETCONSTANTBUFFERS, /* constant_buffers_info */
+ DEFERRED_CSSETUNORDEREDACCESSVIEWS, /* unordered_view */
+
DEFERRED_DRAWINDEXED, /* draw_indexed_info */
DEFERRED_DRAWINDEXEDINSTANCED, /* draw_indexed_inst_info */
@@ -166,6 +168,13 @@ struct deferred_call
} constant_buffers_info;
struct
{
+ UINT start_slot;
+ UINT num_views;
+ ID3D11UnorderedAccessView **views;
+ UINT *initial_counts;
+ } unordered_view;
+ struct
+ {
UINT count;
UINT start_index;
INT base_vertex;
@@ -426,6 +435,15 @@ static void free_deferred_calls(struct list *commands)
}
break;
}
+ case DEFERRED_CSSETUNORDEREDACCESSVIEWS:
+ {
+ for (i = 0; i < call->unordered_view.num_views; i++)
+ {
+ if (call->unordered_view.views[i])
+ ID3D11UnorderedAccessView_Release(call->unordered_view.views[i]);
+ }
+ break;
+ }
case DEFERRED_DRAWINDEXED:
case DEFERRED_DRAWINDEXEDINSTANCED:
{
@@ -595,6 +613,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
call->constant_buffers_info.num_buffers, call->constant_buffers_info.buffers);
break;
}
+ case DEFERRED_CSSETUNORDEREDACCESSVIEWS:
+ {
+ ID3D11DeviceContext1_CSSetUnorderedAccessViews(iface, call->unordered_view.start_slot,
+ call->unordered_view.num_views, call->unordered_view.views, call->unordered_view.initial_counts);
+ break;
+ }
case DEFERRED_DRAWINDEXED:
{
ID3D11DeviceContext1_DrawIndexed(iface, call->draw_indexed_info.count,
@@ -4456,8 +4480,27 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetShaderResources(ID3D11
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetUnorderedAccessViews(ID3D11DeviceContext *iface,
UINT start_slot, UINT view_count, ID3D11UnorderedAccessView *const *views, const UINT *initial_counts)
{
- FIXME("iface %p, start_slot %u, view_count %u, views %p, initial_counts %p stub!\n",
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+ struct deferred_call *call;
+ int i;
+
+ TRACE("iface %p, start_slot %u, view_count %u, views %p, initial_counts %p.\n",
iface, start_slot, view_count, views, initial_counts);
+
+ if (!(call = add_deferred_call(context, view_count * (sizeof(*views) + sizeof(UINT)))))
+ return;
+
+ call->cmd = DEFERRED_CSSETUNORDEREDACCESSVIEWS;
+ call->unordered_view.start_slot = start_slot;
+ call->unordered_view.num_views = view_count;
+ call->unordered_view.views = (void *)(call + 1);
+ call->unordered_view.initial_counts = (void *)&call->unordered_view.views[view_count];
+ for (i = 0; i < view_count; i++)
+ {
+ if (views[i]) ID3D11UnorderedAccessView_AddRef(views[i]);
+ call->unordered_view.views[i] = views[i];
+ call->unordered_view.initial_counts[i] = initial_counts[i];
+ }
}
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetShader(ID3D11DeviceContext *iface,
--
1.9.1

View File

@ -0,0 +1,76 @@
From 23c6f443659535cf63c4bf3a9411ad6ba7724881 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 6 May 2021 20:53:51 -0500
Subject: [PATCH] d3d11: Implement ID3D11Device1::CreateDeferredContext1().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41636
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/d3d11/device.c | 12 ++++++++++--
dlls/d3d11/tests/d3d11.c | 5 +----
dlls/wined3d/cs.c | 2 +-
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 459c49145cd..39144df3dc4 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -4077,9 +4077,17 @@ static void STDMETHODCALLTYPE d3d11_device_GetImmediateContext1(ID3D11Device2 *i
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext1(ID3D11Device2 *iface, UINT flags,
ID3D11DeviceContext1 **context)
{
- FIXME("iface %p, flags %#x, context %p stub!\n", iface, flags, context);
+ struct d3d_device *device = impl_from_ID3D11Device2(iface);
+ struct d3d11_device_context *object;
+ HRESULT hr;
- return E_NOTIMPL;
+ TRACE("iface %p, flags %#x, context %p.\n", iface, flags, context);
+
+ if (FAILED(hr = d3d11_deferred_context_create(device, flags, &object)))
+ return hr;
+
+ *context = &object->ID3D11DeviceContext1_iface;
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBlendState1(ID3D11Device2 *iface,
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 43ea70d2e9b..e56cb7594c6 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -32410,9 +32410,7 @@ static void test_deferred_context_swap_state(void)
ID3D11DeviceContext1_PSSetConstantBuffers(immediate, 0, 1, &green_buffer);
hr = ID3D11Device1_CreateDeferredContext1(device, 0, &deferred);
- todo_wine ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
- if (hr != S_OK)
- goto out;
+ ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
feature_level = ID3D11Device1_GetFeatureLevel(device);
hr = ID3D11Device1_CreateDeviceContextState(device, 0, &feature_level, 1, D3D11_SDK_VERSION,
@@ -32433,7 +32431,6 @@ static void test_deferred_context_swap_state(void)
ID3DDeviceContextState_Release(state);
ID3D11DeviceContext1_Release(deferred);
-out:
ID3D11Buffer_Release(green_buffer);
ID3D11DeviceContext1_Release(immediate);
ID3D11Device1_Release(device);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 9a143b915ed..e903b94378e 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -3293,7 +3293,7 @@ HRESULT CDECL wined3d_deferred_context_create(struct wined3d_device *device, str
object->c.ops = &wined3d_deferred_context_ops;
object->c.device = device;
- TRACE("Created deferred context %p.\n", context);
+ TRACE("Created deferred context %p.\n", object);
*context = &object->c;
return S_OK;
--
2.30.2

View File

@ -1,85 +0,0 @@
From 27ae92005a2782ab4465f1d90cecc8c328a27bc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 24 Jan 2017 05:06:12 +0100
Subject: [PATCH] d3d11: Implement ClearRenderTargetView for deferred contexts.
---
dlls/d3d11/device.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 3c475e7..3c41fc3 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -67,6 +67,7 @@ enum deferred_cmd
DEFERRED_DISPATCH, /* dispatch_info */
DEFERRED_CLEARSTATE,
+ DEFERRED_CLEARRENDERTARGETVIEW, /* clear_rtv_info */
};
struct deferred_call
@@ -202,6 +203,11 @@ struct deferred_call
UINT count_y;
UINT count_z;
} dispatch_info;
+ struct
+ {
+ ID3D11RenderTargetView *rtv;
+ float color[4];
+ } clear_rtv_info;
};
};
@@ -462,6 +468,12 @@ static void free_deferred_calls(struct list *commands)
{
break; /* nothing to do */
}
+ case DEFERRED_CLEARRENDERTARGETVIEW:
+ {
+ if (call->clear_rtv_info.rtv)
+ ID3D11RenderTargetView_Release(call->clear_rtv_info.rtv);
+ break;
+ }
default:
{
FIXME("Unimplemented command type %u\n", call->cmd);
@@ -660,6 +672,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
ID3D11DeviceContext1_ClearState(iface);
break;
}
+ case DEFERRED_CLEARRENDERTARGETVIEW:
+ {
+ ID3D11DeviceContext1_ClearRenderTargetView(iface, call->clear_rtv_info.rtv,
+ call->clear_rtv_info.color);
+ break;
+ }
default:
{
FIXME("Unimplemented command type %u\n", call->cmd);
@@ -4316,8 +4334,21 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CopyStructureCount(ID3D11De
static void STDMETHODCALLTYPE d3d11_deferred_context_ClearRenderTargetView(ID3D11DeviceContext *iface,
ID3D11RenderTargetView *render_target_view, const float color_rgba[4])
{
- FIXME("iface %p, render_target_view %p, color_rgba %s stub!\n",
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+ struct deferred_call *call;
+ int i;
+
+ TRACE("iface %p, render_target_view %p, color_rgba %s.\n",
iface, render_target_view, debug_float4(color_rgba));
+
+ if (!(call = add_deferred_call(context, 0)))
+ return;
+
+ call->cmd = DEFERRED_CLEARRENDERTARGETVIEW;
+ if (render_target_view) ID3D11RenderTargetView_AddRef(render_target_view);
+ call->clear_rtv_info.rtv = render_target_view;
+ for (i = 0; i < 4; i++)
+ call->clear_rtv_info.color[i] = color_rgba[i];
}
static void STDMETHODCALLTYPE d3d11_deferred_context_ClearUnorderedAccessViewUint(ID3D11DeviceContext *iface,
--
1.9.1

View File

@ -0,0 +1,59 @@
From 5f4be09c3c2a3098155c769cdda40f1cfb29640d Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Mon, 10 May 2021 12:13:12 -0500
Subject: [PATCH] wined3d: Keep a list of acquired resources in struct
wined3d_deferred_context.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/wined3d/cs.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index e903b94378e..e1ffd8f0ff8 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -3169,6 +3169,9 @@ struct wined3d_deferred_context
SIZE_T data_size, data_capacity;
void *data;
+
+ SIZE_T resource_count, resources_capacity;
+ struct wined3d_resource **resources;
};
static struct wined3d_deferred_context *wined3d_deferred_context_from_context(struct wined3d_device_context *context)
@@ -3257,7 +3260,14 @@ static void wined3d_deferred_context_flush(struct wined3d_device_context *contex
static void wined3d_deferred_context_acquire_resource(struct wined3d_device_context *context,
struct wined3d_resource *resource)
{
- FIXME("context %p, resource %p, stub!\n", context, resource);
+ struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
+
+ if (!wined3d_array_reserve((void **)&deferred->resources, &deferred->resources_capacity,
+ deferred->resource_count + 1, sizeof(*deferred->resources)))
+ return;
+
+ deferred->resources[deferred->resource_count++] = resource;
+ wined3d_resource_incref(resource);
}
static const struct wined3d_device_context_ops wined3d_deferred_context_ops =
@@ -3302,9 +3312,14 @@ HRESULT CDECL wined3d_deferred_context_create(struct wined3d_device *device, str
void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *context)
{
struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
+ SIZE_T i;
TRACE("context %p.\n", context);
+ for (i = 0; i < deferred->resource_count; ++i)
+ wined3d_resource_decref(deferred->resources[i]);
+ heap_free(deferred->resources);
+
wined3d_state_destroy(deferred->c.state);
heap_free(deferred->data);
heap_free(deferred);
--
2.30.2

View File

@ -1,76 +0,0 @@
From c47799ef188ff3e15573bfb8811193918afffea1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 24 Jan 2017 05:13:46 +0100
Subject: [PATCH] d3d11: Implement Draw for deferred contexts.
---
dlls/d3d11/device.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 3c41fc3..1bf9caf 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -60,6 +60,7 @@ enum deferred_cmd
DEFERRED_CSSETUNORDEREDACCESSVIEWS, /* unordered_view */
+ DEFERRED_DRAW, /* draw_info */
DEFERRED_DRAWINDEXED, /* draw_indexed_info */
DEFERRED_DRAWINDEXEDINSTANCED, /* draw_indexed_inst_info */
@@ -177,6 +178,11 @@ struct deferred_call
struct
{
UINT count;
+ UINT start;
+ } draw_info;
+ struct
+ {
+ UINT count;
UINT start_index;
INT base_vertex;
} draw_indexed_info;
@@ -450,6 +456,7 @@ static void free_deferred_calls(struct list *commands)
}
break;
}
+ case DEFERRED_DRAW:
case DEFERRED_DRAWINDEXED:
case DEFERRED_DRAWINDEXEDINSTANCED:
{
@@ -631,6 +638,11 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
call->unordered_view.num_views, call->unordered_view.views, call->unordered_view.initial_counts);
break;
}
+ case DEFERRED_DRAW:
+ {
+ ID3D11DeviceContext1_Draw(iface, call->draw_info.count, call->draw_info.start);
+ break;
+ }
case DEFERRED_DRAWINDEXED:
{
ID3D11DeviceContext1_DrawIndexed(iface, call->draw_indexed_info.count,
@@ -3866,8 +3878,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DrawIndexed(ID3D11DeviceCon
static void STDMETHODCALLTYPE d3d11_deferred_context_Draw(ID3D11DeviceContext *iface,
UINT vertex_count, UINT start_vertex_location)
{
- FIXME("iface %p, vertex_count %u, start_vertex_location %u stub!\n",
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+ struct deferred_call *call;
+
+ TRACE("iface %p, vertex_count %u, start_vertex_location %u.\n",
iface, vertex_count, start_vertex_location);
+
+ if (!(call = add_deferred_call(context, 0)))
+ return;
+
+ call->cmd = DEFERRED_DRAW;
+ call->draw_info.count = vertex_count;
+ call->draw_info.start = start_vertex_location;
}
static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_Map(ID3D11DeviceContext *iface, ID3D11Resource *resource,
--
1.9.1

View File

@ -0,0 +1,202 @@
From 71dac6603aded658bf4b728de49e0a51ce9a0ac9 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Mon, 10 May 2021 11:48:53 -0500
Subject: [PATCH] d3d11: Implement ID3D11DeviceContext::ClearState() using a
single CS op.
Specifically, tweak and make use of the already existing
WINED3D_CS_OP_RESET_STATE.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/d3d11/device.c | 40 +---------------------------------
dlls/wined3d/cs.c | 16 +++++++++++---
dlls/wined3d/device.c | 13 +++++++++--
dlls/wined3d/wined3d.spec | 1 +
dlls/wined3d/wined3d_private.h | 2 +-
include/wine/wined3d.h | 1 +
6 files changed, 28 insertions(+), 45 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 39144df3dc4..6f07bc92cdf 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2591,49 +2591,11 @@ static void STDMETHODCALLTYPE d3d11_device_context_CSGetConstantBuffers(ID3D11De
static void STDMETHODCALLTYPE d3d11_device_context_ClearState(ID3D11DeviceContext1 *iface)
{
struct d3d11_device_context *context = impl_from_ID3D11DeviceContext1(iface);
- static const float blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f};
- unsigned int i, j;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
- for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
- {
- wined3d_device_context_set_shader(context->wined3d_context, i, NULL);
- for (j = 0; j < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++j)
- wined3d_device_context_set_constant_buffer(context->wined3d_context, i, j, NULL);
- for (j = 0; j < D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++j)
- wined3d_device_context_set_shader_resource_view(context->wined3d_context, i, j, NULL);
- for (j = 0; j < D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; ++j)
- wined3d_device_context_set_sampler(context->wined3d_context, i, j, NULL);
- }
- for (i = 0; i < D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i)
- {
- wined3d_device_context_set_stream_source(context->wined3d_context, i, NULL, 0, 0);
- }
- wined3d_device_context_set_index_buffer(context->wined3d_context, NULL, WINED3DFMT_UNKNOWN, 0);
- wined3d_device_context_set_vertex_declaration(context->wined3d_context, NULL);
- wined3d_device_context_set_primitive_type(context->wined3d_context, WINED3D_PT_UNDEFINED, 0);
- for (i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i)
- {
- wined3d_device_context_set_rendertarget_view(context->wined3d_context, i, NULL, FALSE);
- }
- wined3d_device_context_set_depth_stencil_view(context->wined3d_context, NULL);
- for (i = 0; i < WINED3D_PIPELINE_COUNT; ++i)
- {
- for (j = 0; j < D3D11_PS_CS_UAV_REGISTER_COUNT; ++j)
- wined3d_device_context_set_unordered_access_view(context->wined3d_context, i, j, NULL, ~0u);
- }
- ID3D11DeviceContext1_OMSetDepthStencilState(iface, NULL, 0);
- ID3D11DeviceContext1_OMSetBlendState(iface, NULL, blend_factor, D3D11_DEFAULT_SAMPLE_MASK);
- ID3D11DeviceContext1_RSSetViewports(iface, 0, NULL);
- ID3D11DeviceContext1_RSSetScissorRects(iface, 0, NULL);
- ID3D11DeviceContext1_RSSetState(iface, NULL);
- for (i = 0; i < D3D11_SO_BUFFER_SLOT_COUNT; ++i)
- {
- wined3d_device_context_set_stream_output(context->wined3d_context, i, NULL, 0);
- }
- wined3d_device_context_set_predication(context->wined3d_context, NULL, FALSE);
+ wined3d_device_context_reset_state(context->wined3d_context);
wined3d_mutex_unlock();
}
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index e1ffd8f0ff8..42f7606d3c9 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -359,6 +359,7 @@ struct wined3d_cs_push_constants
struct wined3d_cs_reset_state
{
enum wined3d_cs_op opcode;
+ bool invalidate;
};
struct wined3d_cs_callback
@@ -2143,18 +2144,27 @@ static void wined3d_cs_mt_push_constants(struct wined3d_device_context *context,
static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
{
+ const struct wined3d_cs_reset_state *op = data;
+ unsigned int state;
+
state_cleanup(&cs->state);
wined3d_state_reset(&cs->state, &cs->c.device->adapter->d3d_info);
+ if (op->invalidate)
+ {
+ for (state = 0; state <= STATE_HIGHEST; ++state)
+ device_invalidate_state(cs->c.device, state);
+ }
}
-void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
+void wined3d_device_context_emit_reset_state(struct wined3d_device_context *context, bool invalidate)
{
struct wined3d_cs_reset_state *op;
- op = wined3d_device_context_require_space(&cs->c, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
+ op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
op->opcode = WINED3D_CS_OP_RESET_STATE;
+ op->invalidate = invalidate;
- wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT);
+ wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
}
static void wined3d_cs_exec_callback(struct wined3d_cs *cs, const void *data)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 2c8ebba8844..08f986dd5e2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1169,7 +1169,7 @@ void wined3d_device_uninit_3d(struct wined3d_device *device)
wined3d_texture_decref(texture);
}
- wined3d_cs_emit_reset_state(device->cs);
+ wined3d_device_context_emit_reset_state(&device->cs->c, false);
state_cleanup(state);
wine_rb_clear(&device->samplers, device_free_sampler, NULL);
@@ -1649,6 +1649,15 @@ void CDECL wined3d_device_context_get_scissor_rects(const struct wined3d_device_
*rect_count = state->scissor_rect_count;
}
+void CDECL wined3d_device_context_reset_state(struct wined3d_device_context *context)
+{
+ TRACE("context %p.\n", context);
+
+ state_cleanup(context->state);
+ wined3d_state_reset(context->state, &context->device->adapter->d3d_info);
+ wined3d_device_context_emit_reset_state(context, true);
+}
+
void CDECL wined3d_device_context_set_state(struct wined3d_device_context *context, struct wined3d_state *state)
{
const struct wined3d_light_info *light;
@@ -5417,7 +5426,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (reset_state)
{
TRACE("Resetting state.\n");
- wined3d_cs_emit_reset_state(device->cs);
+ wined3d_device_context_emit_reset_state(&device->cs->c, false);
state_cleanup(state);
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 901e9bee621..84412515c39 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -114,6 +114,7 @@
@ cdecl wined3d_device_context_get_viewports(ptr ptr ptr)
@ cdecl wined3d_device_context_issue_query(ptr ptr long)
@ cdecl wined3d_device_context_map(ptr ptr long ptr ptr long)
+@ cdecl wined3d_device_context_reset_state(ptr)
@ cdecl wined3d_device_context_resolve_sub_resource(ptr ptr long ptr long long)
@ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long)
@ cdecl wined3d_device_context_set_constant_buffer(ptr long long ptr)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index fadad706af4..af9beffc142 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4737,7 +4737,6 @@ void wined3d_device_context_emit_clear_uav_uint(struct wined3d_device_context *c
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect,
const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, DWORD flags) DECLSPEC_HIDDEN;
-void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture,
WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs,
@@ -4775,6 +4774,7 @@ void wined3d_device_context_emit_draw(struct wined3d_device_context *context,
bool indexed) DECLSPEC_HIDDEN;
void wined3d_device_context_emit_generate_mipmaps(struct wined3d_device_context *context,
struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN;
+void wined3d_device_context_emit_reset_state(struct wined3d_device_context *context, bool invalidate) DECLSPEC_HIDDEN;
void wined3d_device_context_emit_set_blend_state(struct wined3d_device_context *context,
struct wined3d_blend_state *state, const struct wined3d_color *blend_factor,
unsigned int sample_mask) DECLSPEC_HIDDEN;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0be192b0f01..812c042cdd7 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2480,6 +2480,7 @@ void __cdecl wined3d_device_context_issue_query(struct wined3d_device_context *c
HRESULT __cdecl wined3d_device_context_map(struct wined3d_device_context *context,
struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags);
+void __cdecl wined3d_device_context_reset_state(struct wined3d_device_context *context);
void __cdecl wined3d_device_context_resolve_sub_resource(struct wined3d_device_context *context,
struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx,
struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, enum wined3d_format_id format_id);
--
2.30.2

View File

@ -1,88 +0,0 @@
From b871fc2d2705efd89415626b9334a508f3ba97b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 24 Jan 2017 05:29:10 +0100
Subject: [PATCH] d3d11: Implement ClearDepthStencilView for deferred contexts.
---
dlls/d3d11/device.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 1bf9caf..7f84cd4 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -69,6 +69,7 @@ enum deferred_cmd
DEFERRED_CLEARSTATE,
DEFERRED_CLEARRENDERTARGETVIEW, /* clear_rtv_info */
+ DEFERRED_CLEARDEPTHSTENCILVIEW, /* clear_depth_info */
};
struct deferred_call
@@ -214,6 +215,13 @@ struct deferred_call
ID3D11RenderTargetView *rtv;
float color[4];
} clear_rtv_info;
+ struct
+ {
+ ID3D11DepthStencilView *view;
+ UINT flags;
+ FLOAT depth;
+ UINT8 stencil;
+ } clear_depth_info;
};
};
@@ -481,6 +489,12 @@ static void free_deferred_calls(struct list *commands)
ID3D11RenderTargetView_Release(call->clear_rtv_info.rtv);
break;
}
+ case DEFERRED_CLEARDEPTHSTENCILVIEW:
+ {
+ if (call->clear_depth_info.view)
+ ID3D11DepthStencilView_Release(call->clear_depth_info.view);
+ break;
+ }
default:
{
FIXME("Unimplemented command type %u\n", call->cmd);
@@ -690,6 +704,13 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
call->clear_rtv_info.color);
break;
}
+ case DEFERRED_CLEARDEPTHSTENCILVIEW:
+ {
+ ID3D11DeviceContext_ClearDepthStencilView(iface, call->clear_depth_info.view,
+ call->clear_depth_info.flags, call->clear_depth_info.depth,
+ call->clear_depth_info.stencil);
+ break;
+ }
default:
{
FIXME("Unimplemented command type %u\n", call->cmd);
@@ -4390,8 +4411,21 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_ClearUnorderedAccessViewFlo
static void STDMETHODCALLTYPE d3d11_deferred_context_ClearDepthStencilView(ID3D11DeviceContext *iface,
ID3D11DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
{
- FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %.8e, stencil %u stub!\n",
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+ struct deferred_call *call;
+
+ TRACE("iface %p, depth_stencil_view %p, flags %#x, depth %.8e, stencil %u.\n",
iface, depth_stencil_view, flags, depth, stencil);
+
+ if (!(call = add_deferred_call(context, 0)))
+ return;
+
+ call->cmd = DEFERRED_CLEARDEPTHSTENCILVIEW;
+ if (depth_stencil_view) ID3D11DepthStencilView_AddRef(depth_stencil_view);
+ call->clear_depth_info.view = depth_stencil_view;
+ call->clear_depth_info.flags = flags;
+ call->clear_depth_info.depth = depth;
+ call->clear_depth_info.stencil = stencil;
}
static void STDMETHODCALLTYPE d3d11_deferred_context_GenerateMips(ID3D11DeviceContext *iface,
--
1.9.1

View File

@ -0,0 +1,373 @@
From b477b3a47695cec5c92f7c7e600e92241267fe75 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Wed, 12 May 2021 10:46:59 -0500
Subject: [PATCH] d3d11: Implement ID3D11DeviceContext::FinishCommandList().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/d3d11/d3d11_private.h | 10 +++
dlls/d3d11/device.c | 154 ++++++++++++++++++++++++++++++++++++-
dlls/wined3d/cs.c | 103 +++++++++++++++++++++++++
dlls/wined3d/wined3d.spec | 4 +
include/wine/wined3d.h | 6 ++
5 files changed, 276 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 2b5a51afbd1..f4c66ca4ce9 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -583,6 +583,16 @@ struct d3d_device
SIZE_T context_state_count;
};
+struct d3d11_command_list
+{
+ ID3D11CommandList ID3D11CommandList_iface;
+ LONG refcount;
+
+ ID3D11Device *device;
+ struct wined3d_command_list *wined3d_list;
+ struct wined3d_private_store private_store;
+};
+
static inline struct d3d_device *impl_from_ID3D11Device(ID3D11Device *iface)
{
return CONTAINING_RECORD((ID3D11Device2 *)iface, struct d3d_device, ID3D11Device2_iface);
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 6f07bc92cdf..17bb0da369c 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -330,6 +330,123 @@ static void d3d_device_context_state_init(struct d3d_device_context_state *state
d3d_device_context_state_AddRef(&state->ID3DDeviceContextState_iface);
}
+/* ID3D11CommandList methods */
+
+static inline struct d3d11_command_list *impl_from_ID3D11CommandList(ID3D11CommandList *iface)
+{
+ return CONTAINING_RECORD(iface, struct d3d11_command_list, ID3D11CommandList_iface);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_command_list_QueryInterface(ID3D11CommandList *iface, REFIID iid, void **out)
+{
+ TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
+
+ if (IsEqualGUID(iid, &IID_ID3D11CommandList)
+ || IsEqualGUID(iid, &IID_ID3D11DeviceChild)
+ || IsEqualGUID(iid, &IID_IUnknown))
+ {
+ ID3D11CommandList_AddRef(iface);
+ *out = iface;
+ return S_OK;
+ }
+
+ WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
+ *out = NULL;
+
+ return E_NOINTERFACE;
+}
+
+static ULONG STDMETHODCALLTYPE d3d11_command_list_AddRef(ID3D11CommandList *iface)
+{
+ struct d3d11_command_list *list = impl_from_ID3D11CommandList(iface);
+ ULONG refcount = InterlockedIncrement(&list->refcount);
+
+ TRACE("%p increasing refcount to %u.\n", list, refcount);
+
+ return refcount;
+}
+
+static ULONG STDMETHODCALLTYPE d3d11_command_list_Release(ID3D11CommandList *iface)
+{
+ struct d3d11_command_list *list = impl_from_ID3D11CommandList(iface);
+ ULONG refcount = InterlockedDecrement(&list->refcount);
+
+ TRACE("%p decreasing refcount to %u.\n", list, refcount);
+
+ if (!refcount)
+ {
+ wined3d_mutex_lock();
+ wined3d_command_list_decref(list->wined3d_list);
+ wined3d_mutex_unlock();
+ ID3D11Device_Release(list->device);
+ heap_free(list);
+ }
+
+ return refcount;
+}
+
+static void STDMETHODCALLTYPE d3d11_command_list_GetDevice(ID3D11CommandList *iface, ID3D11Device **device)
+{
+ struct d3d11_command_list *list = impl_from_ID3D11CommandList(iface);
+
+ TRACE("iface %p, device %p.\n", iface, device);
+
+ *device = (ID3D11Device *)list->device;
+ ID3D11Device_AddRef(*device);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_command_list_GetPrivateData(ID3D11CommandList *iface, REFGUID guid,
+ UINT *data_size, void *data)
+{
+ struct d3d11_command_list *list = impl_from_ID3D11CommandList(iface);
+
+ TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return d3d_get_private_data(&list->private_store, guid, data_size, data);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_command_list_SetPrivateData(ID3D11CommandList *iface, REFGUID guid,
+ UINT data_size, const void *data)
+{
+ struct d3d11_command_list *list = impl_from_ID3D11CommandList(iface);
+
+ TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return d3d_set_private_data(&list->private_store, guid, data_size, data);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_command_list_SetPrivateDataInterface(ID3D11CommandList *iface,
+ REFGUID guid, const IUnknown *data)
+{
+ struct d3d11_command_list *list = impl_from_ID3D11CommandList(iface);
+
+ TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
+
+ return d3d_set_private_data_interface(&list->private_store, guid, data);
+}
+
+static UINT STDMETHODCALLTYPE d3d11_command_list_GetContextFlags(ID3D11CommandList *iface)
+{
+ TRACE("iface %p.\n", iface);
+
+ return 0;
+}
+
+static const struct ID3D11CommandListVtbl d3d11_command_list_vtbl =
+{
+ /* IUnknown methods */
+ d3d11_command_list_QueryInterface,
+ d3d11_command_list_AddRef,
+ d3d11_command_list_Release,
+ /* ID3D11DeviceChild methods */
+ d3d11_command_list_GetDevice,
+ d3d11_command_list_GetPrivateData,
+ d3d11_command_list_SetPrivateData,
+ d3d11_command_list_SetPrivateDataInterface,
+ /* ID3D11CommandList methods */
+ d3d11_command_list_GetContextFlags,
+};
+
/* ID3D11DeviceContext - immediate context methods */
static inline struct d3d11_device_context *impl_from_ID3D11DeviceContext1(ID3D11DeviceContext1 *iface)
@@ -2629,9 +2746,44 @@ static UINT STDMETHODCALLTYPE d3d11_device_context_GetContextFlags(ID3D11DeviceC
static HRESULT STDMETHODCALLTYPE d3d11_device_context_FinishCommandList(ID3D11DeviceContext1 *iface,
BOOL restore, ID3D11CommandList **command_list)
{
+ struct d3d11_device_context *context = impl_from_ID3D11DeviceContext1(iface);
+ struct d3d11_command_list *object;
+ HRESULT hr;
+
TRACE("iface %p, restore %#x, command_list %p.\n", iface, restore, command_list);
- return DXGI_ERROR_INVALID_CALL;
+ if (context->type == D3D11_DEVICE_CONTEXT_IMMEDIATE)
+ {
+ WARN("Attempt to record command list on an immediate context; returning DXGI_ERROR_INVALID_CALL.\n");
+ return DXGI_ERROR_INVALID_CALL;
+ }
+
+ if (!(object = heap_alloc_zero(sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ object->ID3D11CommandList_iface.lpVtbl = &d3d11_command_list_vtbl;
+ object->refcount = 1;
+ object->device = (ID3D11Device *)&context->device->ID3D11Device2_iface;
+ wined3d_private_store_init(&object->private_store);
+
+ wined3d_mutex_lock();
+
+ if (FAILED(hr = wined3d_deferred_context_record_command_list(context->wined3d_context,
+ restore, &object->wined3d_list)))
+ {
+ WARN("Failed to record wined3d command list, hr %#x.\n", hr);
+ heap_free(object);
+ return hr;
+ }
+
+ ID3D11Device2_AddRef(&context->device->ID3D11Device2_iface);
+
+ wined3d_mutex_unlock();
+
+ TRACE("Created command list %p.\n", object);
+ *command_list = &object->ID3D11CommandList_iface;
+
+ return S_OK;
}
static void STDMETHODCALLTYPE d3d11_device_context_CopySubresourceRegion1(ID3D11DeviceContext1 *iface,
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 42f7606d3c9..137f979ae4a 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -26,6 +26,59 @@ WINE_DECLARE_DEBUG_CHANNEL(fps);
#define WINED3D_INITIAL_CS_SIZE 4096
+struct wined3d_command_list
+{
+ LONG refcount;
+
+ struct wined3d_device *device;
+
+ SIZE_T data_size;
+ void *data;
+
+ SIZE_T resource_count;
+ struct wined3d_resource **resources;
+};
+
+static void wined3d_command_list_destroy_object(void *object)
+{
+ struct wined3d_command_list *list = object;
+
+ TRACE("list %p.\n", list);
+
+ heap_free(list->resources);
+ heap_free(list->data);
+ heap_free(list);
+}
+
+ULONG CDECL wined3d_command_list_incref(struct wined3d_command_list *list)
+{
+ ULONG refcount = InterlockedIncrement(&list->refcount);
+
+ TRACE("%p increasing refcount to %u.\n", list, refcount);
+
+ return refcount;
+}
+
+ULONG CDECL wined3d_command_list_decref(struct wined3d_command_list *list)
+{
+ ULONG refcount = InterlockedDecrement(&list->refcount);
+ struct wined3d_device *device = list->device;
+
+ TRACE("%p decreasing refcount to %u.\n", list, refcount);
+
+ if (!refcount)
+ {
+ SIZE_T i;
+
+ for (i = 0; i < list->resource_count; ++i)
+ wined3d_resource_decref(list->resources[i]);
+
+ wined3d_cs_destroy_object(device->cs, wined3d_command_list_destroy_object, list);
+ }
+
+ return refcount;
+}
+
enum wined3d_cs_op
{
WINED3D_CS_OP_NOP,
@@ -3334,3 +3387,53 @@ void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *conte
heap_free(deferred->data);
heap_free(deferred);
}
+
+HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device_context *context,
+ BOOL restore, struct wined3d_command_list **list)
+{
+ struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
+ struct wined3d_command_list *object;
+
+ TRACE("context %p, list %p.\n", context, list);
+
+ if (restore)
+ {
+ FIXME("Restoring context state is not implemented.\n");
+ return E_NOTIMPL;
+ }
+
+ if (!(object = heap_alloc_zero(sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ object->refcount = 1;
+ object->device = deferred->c.device;
+
+ if (!(object->data = heap_alloc(deferred->data_size)))
+ {
+ heap_free(object);
+ return E_OUTOFMEMORY;
+ }
+ object->data_size = deferred->data_size;
+ memcpy(object->data, deferred->data, deferred->data_size);
+
+ if (!(object->resources = heap_alloc(deferred->resource_count * sizeof(*object->resources))))
+ {
+ heap_free(object->data);
+ heap_free(object);
+ return E_OUTOFMEMORY;
+ }
+ object->resource_count = deferred->resource_count;
+ memcpy(object->resources, deferred->resources, deferred->resource_count * sizeof(*object->resources));
+ /* Transfer our references to the resources to the command list. */
+
+ deferred->data_size = 0;
+ deferred->resource_count = 0;
+
+ /* This is in fact recorded into a subsequent command list. */
+ wined3d_device_context_reset_state(&deferred->c);
+
+ TRACE("Created command list %p.\n", object);
+ *list = object;
+
+ return S_OK;
+}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 84412515c39..6683b3bc30f 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -33,8 +33,12 @@
@ cdecl wined3d_buffer_get_resource(ptr)
@ cdecl wined3d_buffer_incref(ptr)
+@ cdecl wined3d_command_list_decref(ptr)
+@ cdecl wined3d_command_list_incref(ptr)
+
@ cdecl wined3d_deferred_context_create(ptr ptr)
@ cdecl wined3d_deferred_context_destroy(ptr)
+@ cdecl wined3d_deferred_context_record_command_list(ptr long ptr)
@ cdecl wined3d_depth_stencil_state_create(ptr ptr ptr ptr ptr)
@ cdecl wined3d_depth_stencil_state_decref(ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 812c042cdd7..e4fd0b73268 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2221,6 +2221,7 @@ struct wined3d;
struct wined3d_adapter;
struct wined3d_blend_state;
struct wined3d_buffer;
+struct wined3d_command_list;
struct wined3d_depth_stencil_state;
struct wined3d_device;
struct wined3d_device_context;
@@ -2340,8 +2341,13 @@ void * __cdecl wined3d_buffer_get_parent(const struct wined3d_buffer *buffer);
struct wined3d_resource * __cdecl wined3d_buffer_get_resource(struct wined3d_buffer *buffer);
ULONG __cdecl wined3d_buffer_incref(struct wined3d_buffer *buffer);
+ULONG __cdecl wined3d_command_list_decref(struct wined3d_command_list *list);
+ULONG __cdecl wined3d_command_list_incref(struct wined3d_command_list *list);
+
HRESULT __cdecl wined3d_deferred_context_create(struct wined3d_device *device, struct wined3d_device_context **context);
void __cdecl wined3d_deferred_context_destroy(struct wined3d_device_context *context);
+HRESULT __cdecl wined3d_deferred_context_record_command_list(struct wined3d_device_context *context,
+ BOOL restore, struct wined3d_command_list **list);
HRESULT __cdecl wined3d_depth_stencil_state_create(struct wined3d_device *device,
const struct wined3d_depth_stencil_state_desc *desc, void *parent,
--
2.30.2

Some files were not shown because too many files have changed in this diff Show More