mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
d3d11-Deferred_Context: Replace with a new implementation.
This commit is contained in:
parent
be3928a809
commit
5378adafaa
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,90 +0,0 @@
|
||||
From acca9a7bb557d405c74dbaf1153c3d0642780d03 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:01:07 +0300
|
||||
Subject: [PATCH] d3d11: Implement GSSetShader for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 31 +++++++++++++++++++++++++++++--
|
||||
1 file changed, 29 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 7f84cd4..64480f4 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -42,6 +42,7 @@ enum deferred_cmd
|
||||
|
||||
DEFERRED_CSSETSHADER, /* cs_info */
|
||||
DEFERRED_DSSETSHADER, /* ds_info */
|
||||
+ DEFERRED_GSSETSHADER, /* gs_info */
|
||||
DEFERRED_HSSETSHADER, /* hs_info */
|
||||
DEFERRED_PSSETSHADER, /* ps_info */
|
||||
DEFERRED_VSSETSHADER, /* vs_info */
|
||||
@@ -138,6 +139,11 @@ struct deferred_call
|
||||
} ds_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11GeometryShader *shader;
|
||||
+ /* FIXME: add class instances */
|
||||
+ } gs_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11HullShader *shader;
|
||||
/* FIXME: add class instances */
|
||||
} hs_info;
|
||||
@@ -404,6 +410,12 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11DomainShader_Release(call->ds_info.shader);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_GSSETSHADER:
|
||||
+ {
|
||||
+ if (call->gs_info.shader)
|
||||
+ ID3D11GeometryShader_Release(call->gs_info.shader);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_HSSETSHADER:
|
||||
{
|
||||
if (call->hs_info.shader)
|
||||
@@ -577,6 +589,11 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
ID3D11DeviceContext1_DSSetShader(iface, call->ds_info.shader, NULL, 0);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_GSSETSHADER:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_GSSetShader(iface, call->gs_info.shader, NULL, 0);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_HSSETSHADER:
|
||||
{
|
||||
ID3D11DeviceContext1_HSSetShader(iface, call->hs_info.shader, NULL, 0);
|
||||
@@ -706,7 +723,7 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
}
|
||||
case DEFERRED_CLEARDEPTHSTENCILVIEW:
|
||||
{
|
||||
- ID3D11DeviceContext_ClearDepthStencilView(iface, call->clear_depth_info.view,
|
||||
+ ID3D11DeviceContext1_ClearDepthStencilView(iface, call->clear_depth_info.view,
|
||||
call->clear_depth_info.flags, call->clear_depth_info.depth,
|
||||
call->clear_depth_info.stencil);
|
||||
break;
|
||||
@@ -4100,8 +4117,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetConstantBuffers(ID3D11
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShader(ID3D11DeviceContext *iface,
|
||||
ID3D11GeometryShader *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_GSSETSHADER;
|
||||
+ if (shader) ID3D11GeometryShader_AddRef(shader);
|
||||
+ call->gs_info.shader = shader;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_IASetPrimitiveTopology(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -0,0 +1,142 @@
|
||||
From 5a3e0eba2c666e3a125fa97c35018cabc5a4d778 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Wed, 12 May 2021 11:26:40 -0500
|
||||
Subject: [PATCH] wined3d: Implement restoring context in
|
||||
wined3d_deferred_context_record_command_list().
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/d3d11/tests/d3d11.c | 39 +++++++++++++--------------------------
|
||||
dlls/wined3d/cs.c | 11 ++++-------
|
||||
2 files changed, 17 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index e56cb7594c6..321e827971a 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -32281,15 +32281,7 @@ static void test_deferred_context_state(void)
|
||||
ID3D11Buffer_Release(ret_buffer);
|
||||
|
||||
hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list1);
|
||||
- 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;
|
||||
- }
|
||||
+ ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
|
||||
|
||||
ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer);
|
||||
ok(ret_buffer == blue_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
@@ -32310,7 +32302,9 @@ static void test_deferred_context_state(void)
|
||||
ID3D11DeviceContext_PSSetConstantBuffers(immediate, 0, 1, &green_buffer);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, FALSE);
|
||||
ID3D11DeviceContext_PSGetConstantBuffers(immediate, 0, 1, &ret_buffer);
|
||||
- ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
+ todo_wine ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
+ if (ret_buffer)
|
||||
+ ID3D11Buffer_Release(ret_buffer);
|
||||
|
||||
ID3D11CommandList_Release(list2);
|
||||
ID3D11CommandList_Release(list1);
|
||||
@@ -32484,16 +32478,7 @@ static void test_deferred_context_rendering(void)
|
||||
ID3D11DeviceContext_ClearRenderTargetView(deferred, test_context.backbuffer_rtv, green);
|
||||
|
||||
hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list1);
|
||||
- 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;
|
||||
- }
|
||||
+ ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list2);
|
||||
ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
|
||||
@@ -32503,12 +32488,12 @@ static void test_deferred_context_rendering(void)
|
||||
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
+ todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, &white.x);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
+ todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, &white.x);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list2, TRUE);
|
||||
@@ -32524,7 +32509,7 @@ static void test_deferred_context_rendering(void)
|
||||
ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, &white.x);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list2, TRUE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
+ todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11CommandList_Release(list2);
|
||||
ID3D11CommandList_Release(list1);
|
||||
@@ -32550,7 +32535,7 @@ static void test_deferred_context_rendering(void)
|
||||
ID3D11DeviceContext_ClearRenderTargetView(immediate, rtv, blue);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- ok(color == 0xffff0000, "Got unexpected color %#08x.\n", color);
|
||||
+ todo_wine ok(color == 0xffff0000, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11CommandList_Release(list1);
|
||||
ID3D11DeviceContext_Release(deferred);
|
||||
@@ -32584,10 +32569,12 @@ static void test_deferred_context_rendering(void)
|
||||
set_viewport(immediate, 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 1.0f);
|
||||
draw_color_quad(&test_context, &white);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color);
|
||||
+ todo_wine ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11DeviceContext_OMGetBlendState(immediate, &ret_blend, blend_factor, &sample_mask);
|
||||
- ok(!ret_blend, "Got unexpected blend state %p.\n", ret_blend);
|
||||
+ todo_wine ok(!ret_blend, "Got unexpected blend state %p.\n", ret_blend);
|
||||
+ if (ret_blend)
|
||||
+ ID3D11BlendState_Release(ret_blend);
|
||||
|
||||
ID3D11CommandList_Release(list1);
|
||||
ID3D11DeviceContext_Release(deferred);
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 137f979ae4a..a3b7cebce2a 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -3396,12 +3396,6 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
|
||||
|
||||
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;
|
||||
|
||||
@@ -3430,7 +3424,10 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
|
||||
deferred->resource_count = 0;
|
||||
|
||||
/* This is in fact recorded into a subsequent command list. */
|
||||
- wined3d_device_context_reset_state(&deferred->c);
|
||||
+ if (restore)
|
||||
+ wined3d_device_context_set_state(&deferred->c, deferred->c.state);
|
||||
+ else
|
||||
+ wined3d_device_context_reset_state(&deferred->c);
|
||||
|
||||
TRACE("Created command list %p.\n", object);
|
||||
*list = object;
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,70 +0,0 @@
|
||||
From 9a1f120b818e4368554b751ee02749220dfa8e4e Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:04:41 +0300
|
||||
Subject: [PATCH] d3d11: Implement GSSetConstantBuffers for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 18 +++++++++++++++---
|
||||
1 file changed, 15 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 64480f4..87c2466 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -55,6 +55,7 @@ enum deferred_cmd
|
||||
|
||||
DEFERRED_CSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
DEFERRED_DSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
+ DEFERRED_GSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
DEFERRED_HSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
DEFERRED_PSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
DEFERRED_VSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
@@ -309,8 +310,8 @@ static void add_deferred_set_samplers(struct d3d11_deferred_context *context, en
|
||||
}
|
||||
}
|
||||
|
||||
-/* for DEFERRED_CSSETCONSTANTBUFFERS. DEFERRED_DSSETCONSTANTBUFFERS, DEFERRED_HSSETCONSTANTBUFFERS,
|
||||
- * DEFERRED_PSSETCONSTANTBUFFERS and DEFERRED_VSSETCONSTANTBUFFERS */
|
||||
+/* for DEFERRED_CSSETCONSTANTBUFFERS. DEFERRED_DSSETCONSTANTBUFFERS, DEFERRED_GSSETCONSTANTBUFFERS,
|
||||
+ * 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)
|
||||
{
|
||||
@@ -456,6 +457,7 @@ static void free_deferred_calls(struct list *commands)
|
||||
}
|
||||
case DEFERRED_CSSETCONSTANTBUFFERS:
|
||||
case DEFERRED_DSSETCONSTANTBUFFERS:
|
||||
+ case DEFERRED_GSSETCONSTANTBUFFERS:
|
||||
case DEFERRED_HSSETCONSTANTBUFFERS:
|
||||
case DEFERRED_PSSETCONSTANTBUFFERS:
|
||||
case DEFERRED_VSSETCONSTANTBUFFERS:
|
||||
@@ -645,6 +647,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_GSSETCONSTANTBUFFERS:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_GSSetConstantBuffers(iface, call->constant_buffers_info.start_slot,
|
||||
+ call->constant_buffers_info.num_buffers, call->constant_buffers_info.buffers);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_HSSETCONSTANTBUFFERS:
|
||||
{
|
||||
ID3D11DeviceContext1_HSSetConstantBuffers(iface, call->constant_buffers_info.start_slot,
|
||||
@@ -4110,8 +4118,12 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DrawInstanced(ID3D11DeviceC
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetConstantBuffers(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_GSSETCONSTANTBUFFERS, start_slot, buffer_count, buffers);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShader(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -0,0 +1,443 @@
|
||||
From 4105dfde7a632fa94536ebdada5aaae2848e25f4 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Wed, 12 May 2021 17:44:58 -0500
|
||||
Subject: [PATCH] d3d11: Implement ID3D11DeviceContext::ExecuteCommandList().
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/d3d11/device.c | 17 ++++-
|
||||
dlls/d3d11/tests/d3d11.c | 30 ++++-----
|
||||
dlls/wined3d/cs.c | 116 +++++++++++++++++++++++++++++++++
|
||||
dlls/wined3d/device.c | 8 +++
|
||||
dlls/wined3d/wined3d.spec | 1 +
|
||||
dlls/wined3d/wined3d_private.h | 2 +
|
||||
include/wine/wined3d.h | 2 +
|
||||
7 files changed, 157 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 17bb0da369c..366bd9b2976 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -447,6 +447,14 @@ static const struct ID3D11CommandListVtbl d3d11_command_list_vtbl =
|
||||
d3d11_command_list_GetContextFlags,
|
||||
};
|
||||
|
||||
+static struct d3d11_command_list *unsafe_impl_from_ID3D11CommandList(ID3D11CommandList *iface)
|
||||
+{
|
||||
+ if (!iface)
|
||||
+ return NULL;
|
||||
+ assert(iface->lpVtbl == &d3d11_command_list_vtbl);
|
||||
+ return impl_from_ID3D11CommandList(iface);
|
||||
+}
|
||||
+
|
||||
/* ID3D11DeviceContext - immediate context methods */
|
||||
|
||||
static inline struct d3d11_device_context *impl_from_ID3D11DeviceContext1(ID3D11DeviceContext1 *iface)
|
||||
@@ -1513,7 +1521,14 @@ static void STDMETHODCALLTYPE d3d11_device_context_ResolveSubresource(ID3D11Devi
|
||||
static void STDMETHODCALLTYPE d3d11_device_context_ExecuteCommandList(ID3D11DeviceContext1 *iface,
|
||||
ID3D11CommandList *command_list, BOOL restore_state)
|
||||
{
|
||||
- FIXME("iface %p, command_list %p, restore_state %#x stub!\n", iface, command_list, restore_state);
|
||||
+ struct d3d11_device_context *context = impl_from_ID3D11DeviceContext1(iface);
|
||||
+ struct d3d11_command_list *list_impl = unsafe_impl_from_ID3D11CommandList(command_list);
|
||||
+
|
||||
+ TRACE("iface %p, command_list %p, restore_state %#x.\n", iface, command_list, restore_state);
|
||||
+
|
||||
+ wined3d_mutex_lock();
|
||||
+ wined3d_device_context_execute_command_list(context->wined3d_context, list_impl->wined3d_list, restore_state);
|
||||
+ wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_device_context_HSSetShaderResources(ID3D11DeviceContext1 *iface,
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index 321e827971a..6e4de231c28 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -32302,9 +32302,7 @@ static void test_deferred_context_state(void)
|
||||
ID3D11DeviceContext_PSSetConstantBuffers(immediate, 0, 1, &green_buffer);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, FALSE);
|
||||
ID3D11DeviceContext_PSGetConstantBuffers(immediate, 0, 1, &ret_buffer);
|
||||
- todo_wine ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
- if (ret_buffer)
|
||||
- ID3D11Buffer_Release(ret_buffer);
|
||||
+ ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
|
||||
ID3D11CommandList_Release(list2);
|
||||
ID3D11CommandList_Release(list1);
|
||||
@@ -32328,9 +32326,7 @@ static void test_deferred_context_state(void)
|
||||
ID3D11DeviceContext_PSSetConstantBuffers(deferred, 0, 1, &blue_buffer);
|
||||
ID3D11DeviceContext_ExecuteCommandList(deferred, list1, FALSE);
|
||||
ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer);
|
||||
- todo_wine ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
- if (ret_buffer)
|
||||
- ID3D11Buffer_Release(ret_buffer);
|
||||
+ ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
|
||||
ID3D11CommandList_Release(list1);
|
||||
ID3D11DeviceContext_Release(deferred2);
|
||||
@@ -32488,12 +32484,12 @@ static void test_deferred_context_rendering(void)
|
||||
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
+ ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, &white.x);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
+ ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, &white.x);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list2, TRUE);
|
||||
@@ -32509,7 +32505,7 @@ static void test_deferred_context_rendering(void)
|
||||
ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, &white.x);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list2, TRUE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
+ ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11CommandList_Release(list2);
|
||||
ID3D11CommandList_Release(list1);
|
||||
@@ -32535,7 +32531,7 @@ static void test_deferred_context_rendering(void)
|
||||
ID3D11DeviceContext_ClearRenderTargetView(immediate, rtv, blue);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- todo_wine ok(color == 0xffff0000, "Got unexpected color %#08x.\n", color);
|
||||
+ ok(color == 0xffff0000, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11CommandList_Release(list1);
|
||||
ID3D11DeviceContext_Release(deferred);
|
||||
@@ -32569,12 +32565,10 @@ static void test_deferred_context_rendering(void)
|
||||
set_viewport(immediate, 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 1.0f);
|
||||
draw_color_quad(&test_context, &white);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- todo_wine ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color);
|
||||
+ ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11DeviceContext_OMGetBlendState(immediate, &ret_blend, blend_factor, &sample_mask);
|
||||
- todo_wine ok(!ret_blend, "Got unexpected blend state %p.\n", ret_blend);
|
||||
- if (ret_blend)
|
||||
- ID3D11BlendState_Release(ret_blend);
|
||||
+ ok(!ret_blend, "Got unexpected blend state %p.\n", ret_blend);
|
||||
|
||||
ID3D11CommandList_Release(list1);
|
||||
ID3D11DeviceContext_Release(deferred);
|
||||
@@ -32602,7 +32596,7 @@ static void test_deferred_context_rendering(void)
|
||||
ID3D11DeviceContext_OMSetBlendState(immediate, red_blend, NULL, D3D11_DEFAULT_SAMPLE_MASK);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, FALSE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- todo_wine ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color);
|
||||
+ ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11CommandList_Release(list1);
|
||||
|
||||
@@ -32625,7 +32619,7 @@ static void test_deferred_context_rendering(void)
|
||||
ID3D11DeviceContext_OMSetBlendState(immediate, red_blend, NULL, D3D11_DEFAULT_SAMPLE_MASK);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, FALSE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
+ ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11CommandList_Release(list1);
|
||||
|
||||
@@ -32658,7 +32652,7 @@ static void test_deferred_context_rendering(void)
|
||||
ID3D11DeviceContext_OMSetBlendState(immediate, red_blend, NULL, D3D11_DEFAULT_SAMPLE_MASK);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list2, FALSE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- todo_wine ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color);
|
||||
+ ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11CommandList_Release(list2);
|
||||
|
||||
@@ -32678,7 +32672,7 @@ static void test_deferred_context_rendering(void)
|
||||
ID3D11DeviceContext_OMSetBlendState(immediate, red_blend, NULL, D3D11_DEFAULT_SAMPLE_MASK);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list2, FALSE);
|
||||
color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
- todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
+ ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
|
||||
|
||||
ID3D11CommandList_Release(list2);
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index a3b7cebce2a..20b2719fa9d 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -37,6 +37,12 @@ struct wined3d_command_list
|
||||
|
||||
SIZE_T resource_count;
|
||||
struct wined3d_resource **resources;
|
||||
+
|
||||
+ /* List of command lists queued for execution on this command list. We might
|
||||
+ * be the only thing holding a pointer to another command list, so we need
|
||||
+ * to hold a reference here (and in wined3d_deferred_context) as well. */
|
||||
+ SIZE_T command_list_count;
|
||||
+ struct wined3d_command_list **command_lists;
|
||||
};
|
||||
|
||||
static void wined3d_command_list_destroy_object(void *object)
|
||||
@@ -70,6 +76,8 @@ ULONG CDECL wined3d_command_list_decref(struct wined3d_command_list *list)
|
||||
{
|
||||
SIZE_T i;
|
||||
|
||||
+ for (i = 0; i < list->command_list_count; ++i)
|
||||
+ wined3d_command_list_decref(list->command_lists[i]);
|
||||
for (i = 0; i < list->resource_count; ++i)
|
||||
wined3d_resource_decref(list->resources[i]);
|
||||
|
||||
@@ -130,6 +138,7 @@ enum wined3d_cs_op
|
||||
WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW,
|
||||
WINED3D_CS_OP_COPY_UAV_COUNTER,
|
||||
WINED3D_CS_OP_GENERATE_MIPMAPS,
|
||||
+ WINED3D_CS_OP_EXECUTE_COMMAND_LIST,
|
||||
WINED3D_CS_OP_STOP,
|
||||
};
|
||||
|
||||
@@ -511,6 +520,12 @@ struct wined3d_cs_generate_mipmaps
|
||||
struct wined3d_shader_resource_view *view;
|
||||
};
|
||||
|
||||
+struct wined3d_cs_execute_command_list
|
||||
+{
|
||||
+ enum wined3d_cs_op opcode;
|
||||
+ struct wined3d_command_list *list;
|
||||
+};
|
||||
+
|
||||
struct wined3d_cs_stop
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
@@ -599,6 +614,7 @@ static const char *debug_cs_op(enum wined3d_cs_op op)
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_COPY_UAV_COUNTER);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_GENERATE_MIPMAPS);
|
||||
+ WINED3D_TO_STR(WINED3D_CS_OP_EXECUTE_COMMAND_LIST);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_STOP);
|
||||
#undef WINED3D_TO_STR
|
||||
}
|
||||
@@ -2314,6 +2330,27 @@ static void wined3d_cs_issue_query(struct wined3d_device_context *context,
|
||||
query->state = QUERY_SIGNALLED;
|
||||
}
|
||||
|
||||
+static void wined3d_cs_execute_command_list(struct wined3d_device_context *context,
|
||||
+ struct wined3d_command_list *list, BOOL restore_state)
|
||||
+{
|
||||
+ struct wined3d_cs_execute_command_list *op;
|
||||
+ SIZE_T i;
|
||||
+
|
||||
+ op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ op->opcode = WINED3D_CS_OP_EXECUTE_COMMAND_LIST;
|
||||
+ op->list = list;
|
||||
+
|
||||
+ for (i = 0; i < list->resource_count; ++i)
|
||||
+ wined3d_resource_acquire(list->resources[i]);
|
||||
+
|
||||
+ wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
+
|
||||
+ if (restore_state)
|
||||
+ wined3d_device_context_set_state(context, context->state);
|
||||
+ else
|
||||
+ wined3d_device_context_reset_state(context);
|
||||
+}
|
||||
+
|
||||
static void wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_preload_resource *op = data;
|
||||
@@ -2777,6 +2814,8 @@ static void wined3d_cs_acquire_resource(struct wined3d_device_context *context,
|
||||
wined3d_resource_acquire(resource);
|
||||
}
|
||||
|
||||
+static void wined3d_cs_exec_execute_command_list(struct wined3d_cs *cs, const void *data);
|
||||
+
|
||||
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
|
||||
{
|
||||
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
|
||||
@@ -2828,8 +2867,32 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view,
|
||||
/* WINED3D_CS_OP_COPY_UAV_COUNTER */ wined3d_cs_exec_copy_uav_counter,
|
||||
/* WINED3D_CS_OP_GENERATE_MIPMAPS */ wined3d_cs_exec_generate_mipmaps,
|
||||
+ /* WINED3D_CS_OP_EXECUTE_COMMAND_LIST */ wined3d_cs_exec_execute_command_list,
|
||||
};
|
||||
|
||||
+static void wined3d_cs_exec_execute_command_list(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+ const struct wined3d_cs_execute_command_list *op = data;
|
||||
+ size_t start = 0, end = op->list->data_size;
|
||||
+ const BYTE *cs_data = op->list->data;
|
||||
+
|
||||
+ TRACE("Executing command list %p.\n", op->list);
|
||||
+
|
||||
+ while (start < end)
|
||||
+ {
|
||||
+ const struct wined3d_cs_packet *packet = (const struct wined3d_cs_packet *)&cs_data[start];
|
||||
+ enum wined3d_cs_op opcode = *(const enum wined3d_cs_op *)packet->data;
|
||||
+
|
||||
+ if (opcode >= WINED3D_CS_OP_STOP)
|
||||
+ ERR("Invalid opcode %#x.\n", opcode);
|
||||
+ else
|
||||
+ wined3d_cs_op_handlers[opcode](cs, packet->data);
|
||||
+ TRACE("%s executed.\n", debug_cs_op(opcode));
|
||||
+
|
||||
+ start += offsetof(struct wined3d_cs_packet, data[packet->size]);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void *wined3d_cs_st_require_space(struct wined3d_device_context *context,
|
||||
size_t size, enum wined3d_cs_queue_id queue_id)
|
||||
{
|
||||
@@ -2897,6 +2960,7 @@ static const struct wined3d_device_context_ops wined3d_cs_st_ops =
|
||||
wined3d_cs_issue_query,
|
||||
wined3d_cs_flush,
|
||||
wined3d_cs_acquire_resource,
|
||||
+ wined3d_cs_execute_command_list,
|
||||
};
|
||||
|
||||
static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs *cs, const struct wined3d_cs_queue *queue)
|
||||
@@ -3024,6 +3088,7 @@ static const struct wined3d_device_context_ops wined3d_cs_mt_ops =
|
||||
wined3d_cs_issue_query,
|
||||
wined3d_cs_flush,
|
||||
wined3d_cs_acquire_resource,
|
||||
+ wined3d_cs_execute_command_list,
|
||||
};
|
||||
|
||||
static void poll_queries(struct wined3d_cs *cs)
|
||||
@@ -3235,6 +3300,12 @@ struct wined3d_deferred_context
|
||||
|
||||
SIZE_T resource_count, resources_capacity;
|
||||
struct wined3d_resource **resources;
|
||||
+
|
||||
+ /* List of command lists queued for execution on this context. A command
|
||||
+ * list can be the only thing holding a pointer to another command list, so
|
||||
+ * we need to hold a reference here and in wined3d_command_list as well. */
|
||||
+ SIZE_T command_list_count, command_lists_capacity;
|
||||
+ struct wined3d_command_list **command_lists;
|
||||
};
|
||||
|
||||
static struct wined3d_deferred_context *wined3d_deferred_context_from_context(struct wined3d_device_context *context)
|
||||
@@ -3333,6 +3404,37 @@ static void wined3d_deferred_context_acquire_resource(struct wined3d_device_cont
|
||||
wined3d_resource_incref(resource);
|
||||
}
|
||||
|
||||
+static void wined3d_deferred_context_execute_command_list(struct wined3d_device_context *context,
|
||||
+ struct wined3d_command_list *list, BOOL restore_state)
|
||||
+{
|
||||
+ struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
|
||||
+ struct wined3d_cs_execute_command_list *op;
|
||||
+ SIZE_T i;
|
||||
+
|
||||
+ op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ op->opcode = WINED3D_CS_OP_EXECUTE_COMMAND_LIST;
|
||||
+ op->list = list;
|
||||
+
|
||||
+ if (restore_state)
|
||||
+ wined3d_device_context_set_state(context, context->state);
|
||||
+ else
|
||||
+ wined3d_device_context_reset_state(context);
|
||||
+
|
||||
+ /* Grab a reference to each command list queued on this command list, as
|
||||
+ * well as the command list itself. */
|
||||
+ if (!wined3d_array_reserve((void **)&deferred->command_lists, &deferred->command_lists_capacity,
|
||||
+ deferred->command_list_count + list->command_list_count + 1, sizeof(*deferred->command_lists)))
|
||||
+ return;
|
||||
+
|
||||
+ for (i = 0; i < list->command_list_count; ++i)
|
||||
+ wined3d_command_list_incref(deferred->command_lists[deferred->command_list_count++] = list->command_lists[i]);
|
||||
+ wined3d_command_list_incref(deferred->command_lists[deferred->command_list_count++] = list);
|
||||
+
|
||||
+ /* And grab a reference to each of the command list's resources. */
|
||||
+ for (i = 0; i < list->resource_count; ++i)
|
||||
+ wined3d_deferred_context_acquire_resource(context, list->resources[i]);
|
||||
+}
|
||||
+
|
||||
static const struct wined3d_device_context_ops wined3d_deferred_context_ops =
|
||||
{
|
||||
wined3d_deferred_context_require_space,
|
||||
@@ -3345,6 +3447,7 @@ static const struct wined3d_device_context_ops wined3d_deferred_context_ops =
|
||||
wined3d_deferred_context_issue_query,
|
||||
wined3d_deferred_context_flush,
|
||||
wined3d_deferred_context_acquire_resource,
|
||||
+ wined3d_deferred_context_execute_command_list,
|
||||
};
|
||||
|
||||
HRESULT CDECL wined3d_deferred_context_create(struct wined3d_device *device, struct wined3d_device_context **context)
|
||||
@@ -3420,8 +3523,21 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
|
||||
memcpy(object->resources, deferred->resources, deferred->resource_count * sizeof(*object->resources));
|
||||
/* Transfer our references to the resources to the command list. */
|
||||
|
||||
+ if (!(object->command_lists = heap_alloc(deferred->command_list_count * sizeof(*object->command_lists))))
|
||||
+ {
|
||||
+ heap_free(object->resources);
|
||||
+ heap_free(object->data);
|
||||
+ heap_free(object);
|
||||
+ return E_OUTOFMEMORY;
|
||||
+ }
|
||||
+ object->command_list_count = deferred->command_list_count;
|
||||
+ memcpy(object->command_lists, deferred->command_lists,
|
||||
+ deferred->command_list_count * sizeof(*object->command_lists));
|
||||
+ /* Transfer our references to the command lists to the command list. */
|
||||
+
|
||||
deferred->data_size = 0;
|
||||
deferred->resource_count = 0;
|
||||
+ deferred->command_list_count = 0;
|
||||
|
||||
/* This is in fact recorded into a subsequent command list. */
|
||||
if (restore)
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 08f986dd5e2..ff87e3526cd 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4888,6 +4888,14 @@ void CDECL wined3d_device_context_issue_query(struct wined3d_device_context *con
|
||||
context->ops->issue_query(context, query, flags);
|
||||
}
|
||||
|
||||
+void CDECL wined3d_device_context_execute_command_list(struct wined3d_device_context *context,
|
||||
+ struct wined3d_command_list *list, BOOL restore_state)
|
||||
+{
|
||||
+ TRACE("context %p, list %p, restore_state %d.\n", context, list, restore_state);
|
||||
+
|
||||
+ context->ops->execute_command_list(context, list, restore_state);
|
||||
+}
|
||||
+
|
||||
struct wined3d_rendertarget_view * CDECL wined3d_device_context_get_rendertarget_view(
|
||||
const struct wined3d_device_context *context, unsigned int view_idx)
|
||||
{
|
||||
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
|
||||
index 6683b3bc30f..1369fd4cf90 100644
|
||||
--- a/dlls/wined3d/wined3d.spec
|
||||
+++ b/dlls/wined3d/wined3d.spec
|
||||
@@ -95,6 +95,7 @@
|
||||
@ cdecl wined3d_device_context_draw_indirect(ptr ptr long long)
|
||||
@ cdecl wined3d_device_context_dispatch(ptr long long long)
|
||||
@ cdecl wined3d_device_context_dispatch_indirect(ptr ptr long)
|
||||
+@ cdecl wined3d_device_context_execute_command_list(ptr ptr long)
|
||||
@ cdecl wined3d_device_context_flush(ptr)
|
||||
@ cdecl wined3d_device_context_generate_mipmaps(ptr ptr)
|
||||
@ cdecl wined3d_device_context_get_blend_state(ptr ptr ptr)
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index af9beffc142..ce93da3a81b 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -4693,6 +4693,8 @@ struct wined3d_device_context_ops
|
||||
void (*issue_query)(struct wined3d_device_context *context, struct wined3d_query *query, unsigned int flags);
|
||||
void (*flush)(struct wined3d_device_context *context);
|
||||
void (*acquire_resource)(struct wined3d_device_context *context, struct wined3d_resource *resource);
|
||||
+ void (*execute_command_list)(struct wined3d_device_context *context,
|
||||
+ struct wined3d_command_list *list, BOOL restore_state);
|
||||
};
|
||||
|
||||
struct wined3d_device_context
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index e4fd0b73268..4b22615a569 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -2441,6 +2441,8 @@ void __cdecl wined3d_device_context_draw_indexed(struct wined3d_device_context *
|
||||
unsigned int start_index, unsigned int index_count, unsigned int start_instance, unsigned int instance_count);
|
||||
void __cdecl wined3d_device_context_draw_indirect(struct wined3d_device_context *context,
|
||||
struct wined3d_buffer *buffer, unsigned int offset, bool indexed);
|
||||
+void __cdecl wined3d_device_context_execute_command_list(struct wined3d_device_context *context,
|
||||
+ struct wined3d_command_list *list, BOOL restore_state);
|
||||
void __cdecl wined3d_device_context_flush(struct wined3d_device_context *context);
|
||||
void __cdecl wined3d_device_context_generate_mipmaps(struct wined3d_device_context *context,
|
||||
struct wined3d_shader_resource_view *view);
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,68 +0,0 @@
|
||||
From f62f3e2af2ecced548978d05144736dc4f40a158 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:07:15 +0300
|
||||
Subject: [PATCH] d3d11: Implement CSSetShaderResources 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 87c2466..d0e9ebb 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -47,6 +47,7 @@ enum deferred_cmd
|
||||
DEFERRED_PSSETSHADER, /* ps_info */
|
||||
DEFERRED_VSSETSHADER, /* vs_info */
|
||||
|
||||
+ DEFERRED_CSSETSHADERRESOURCES, /* res_info */
|
||||
DEFERRED_DSSETSHADERRESOURCES, /* res_info */
|
||||
DEFERRED_PSSETSHADERRESOURCES, /* res_info */
|
||||
|
||||
@@ -268,7 +269,7 @@ static struct deferred_call *add_deferred_call(struct d3d11_deferred_context *co
|
||||
return call;
|
||||
}
|
||||
|
||||
-/* for DEFERRED_DSSETSHADERRESOURCES and DEFERRED_PSSETSHADERRESOURCES */
|
||||
+/* for DEFERRED_CSSETSHADERRESOURCES, DEFERRED_DSSETSHADERRESOURCES and DEFERRED_PSSETSHADERRESOURCES */
|
||||
static void add_deferred_set_shader_resources(struct d3d11_deferred_context *context, enum deferred_cmd cmd,
|
||||
UINT start_slot, UINT view_count, ID3D11ShaderResourceView *const *views)
|
||||
{
|
||||
@@ -435,6 +436,7 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11VertexShader_Release(call->vs_info.shader);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_CSSETSHADERRESOURCES:
|
||||
case DEFERRED_DSSETSHADERRESOURCES:
|
||||
case DEFERRED_PSSETSHADERRESOURCES:
|
||||
{
|
||||
@@ -611,6 +613,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
ID3D11DeviceContext1_VSSetShader(iface, call->vs_info.shader, NULL, 0);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_CSSETSHADERRESOURCES:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_CSSetShaderResources(iface, call->res_info.start_slot,
|
||||
+ call->res_info.num_views, call->res_info.views);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_DSSETSHADERRESOURCES:
|
||||
{
|
||||
ID3D11DeviceContext1_DSSetShaderResources(iface, call->res_info.start_slot,
|
||||
@@ -4599,8 +4607,12 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DSSetConstantBuffers(ID3D11
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetShaderResources(ID3D11DeviceContext *iface,
|
||||
UINT start_slot, UINT view_count, ID3D11ShaderResourceView *const *views)
|
||||
{
|
||||
- FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
|
||||
iface, start_slot, view_count, views);
|
||||
+
|
||||
+ add_deferred_set_shader_resources(context, DEFERRED_CSSETSHADERRESOURCES, start_slot, view_count, views);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetUnorderedAccessViews(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -0,0 +1,92 @@
|
||||
From 36509e9ab2c9bb0447eaa2d7b046826ec90fb0a5 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Fri, 14 May 2021 15:51:55 -0500
|
||||
Subject: [PATCH] wined3d: Implement
|
||||
wined3d_deferred_context_update_sub_resource().
|
||||
|
||||
Needed by Wolcen: Lords of Mayhem.
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/wined3d/cs.c | 37 +++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 33 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 20b2719fa9d..7be128f2ec4 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -490,6 +490,7 @@ struct wined3d_cs_update_sub_resource
|
||||
unsigned int sub_resource_idx;
|
||||
struct wined3d_box box;
|
||||
struct wined3d_sub_resource_data data;
|
||||
+ /* If data.data is NULL, the structure is followed by the data in memory. */
|
||||
};
|
||||
|
||||
struct wined3d_cs_add_dirty_texture_region
|
||||
@@ -2597,6 +2598,7 @@ void wined3d_device_context_emit_blt_sub_resource(struct wined3d_device_context
|
||||
static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_update_sub_resource *op = data;
|
||||
+ const void *src_data = op->data.data ? op->data.data : (const BYTE *)(op + 1);
|
||||
struct wined3d_resource *resource = op->resource;
|
||||
const struct wined3d_box *box = &op->box;
|
||||
unsigned int width, height, depth, level;
|
||||
@@ -2617,7 +2619,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
|
||||
goto done;
|
||||
}
|
||||
|
||||
- wined3d_buffer_upload_data(buffer, context, box, op->data.data);
|
||||
+ wined3d_buffer_upload_data(buffer, context, box, src_data);
|
||||
wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
|
||||
goto done;
|
||||
}
|
||||
@@ -2630,7 +2632,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
|
||||
depth = wined3d_texture_get_level_depth(texture, level);
|
||||
|
||||
addr.buffer_object = 0;
|
||||
- addr.addr = op->data.data;
|
||||
+ addr.addr = src_data;
|
||||
|
||||
/* Only load the sub-resource for partial updates. */
|
||||
if (!box->left && !box->top && !box->front
|
||||
@@ -3376,8 +3378,35 @@ static void wined3d_deferred_context_update_sub_resource(struct wined3d_device_c
|
||||
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);
|
||||
+ struct wined3d_cs_update_sub_resource *op;
|
||||
+ size_t data_size;
|
||||
+
|
||||
+ if (resource->type == WINED3D_RTYPE_BUFFER)
|
||||
+ {
|
||||
+ data_size = box->right - box->left;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ const struct wined3d_format *format = resource->format;
|
||||
+
|
||||
+ data_size = (box->back - box->front - 1) * slice_pitch
|
||||
+ + ((box->bottom - box->top) / format->block_height - 1) * row_pitch
|
||||
+ + ((box->right - box->left) / format->block_width) * format->block_byte_count;
|
||||
+ }
|
||||
+
|
||||
+ op = wined3d_device_context_require_space(context, sizeof(*op) + data_size, WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
|
||||
+ op->resource = resource;
|
||||
+ op->sub_resource_idx = sub_resource_idx;
|
||||
+ op->box = *box;
|
||||
+ op->data.row_pitch = row_pitch;
|
||||
+ op->data.slice_pitch = slice_pitch;
|
||||
+ op->data.data = NULL;
|
||||
+ memcpy(op + 1, data, data_size);
|
||||
+
|
||||
+ wined3d_device_context_acquire_resource(context, resource);
|
||||
+
|
||||
+ wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
}
|
||||
|
||||
static void wined3d_deferred_context_issue_query(struct wined3d_device_context *context,
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,69 +0,0 @@
|
||||
From 9e12a69e96e45dc449463ef94d7747f68c821303 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:09:57 +0300
|
||||
Subject: [PATCH] d3d11: Implement GSSetShaderResources for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index d0e9ebb..7f835e8 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -49,6 +49,7 @@ enum deferred_cmd
|
||||
|
||||
DEFERRED_CSSETSHADERRESOURCES, /* res_info */
|
||||
DEFERRED_DSSETSHADERRESOURCES, /* res_info */
|
||||
+ DEFERRED_GSSETSHADERRESOURCES, /* res_info */
|
||||
DEFERRED_PSSETSHADERRESOURCES, /* res_info */
|
||||
|
||||
DEFERRED_DSSETSAMPLERS, /* samplers_info */
|
||||
@@ -269,7 +270,8 @@ static struct deferred_call *add_deferred_call(struct d3d11_deferred_context *co
|
||||
return call;
|
||||
}
|
||||
|
||||
-/* for DEFERRED_CSSETSHADERRESOURCES, DEFERRED_DSSETSHADERRESOURCES and DEFERRED_PSSETSHADERRESOURCES */
|
||||
+/* for DEFERRED_CSSETSHADERRESOURCES, DEFERRED_DSSETSHADERRESOURCES, DEFERRED_GSSETSHADERRESOURCES,
|
||||
+ * and DEFERRED_PSSETSHADERRESOURCES */
|
||||
static void add_deferred_set_shader_resources(struct d3d11_deferred_context *context, enum deferred_cmd cmd,
|
||||
UINT start_slot, UINT view_count, ID3D11ShaderResourceView *const *views)
|
||||
{
|
||||
@@ -438,6 +440,7 @@ static void free_deferred_calls(struct list *commands)
|
||||
}
|
||||
case DEFERRED_CSSETSHADERRESOURCES:
|
||||
case DEFERRED_DSSETSHADERRESOURCES:
|
||||
+ case DEFERRED_GSSETSHADERRESOURCES:
|
||||
case DEFERRED_PSSETSHADERRESOURCES:
|
||||
{
|
||||
for (i = 0; i < call->res_info.num_views; i++)
|
||||
@@ -625,6 +628,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->res_info.num_views, call->res_info.views);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_GSSETSHADERRESOURCES:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_GSSetShaderResources(iface, call->res_info.start_slot,
|
||||
+ call->res_info.num_views, call->res_info.views);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_PSSETSHADERRESOURCES:
|
||||
{
|
||||
ID3D11DeviceContext1_PSSetShaderResources(iface, call->res_info.start_slot,
|
||||
@@ -4209,7 +4218,12 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_SetPredication(ID3D11Device
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShaderResources(ID3D11DeviceContext *iface,
|
||||
UINT start_slot, UINT view_count, ID3D11ShaderResourceView *const *views)
|
||||
{
|
||||
- FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n", iface, start_slot, view_count, views);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
|
||||
+ iface, start_slot, view_count, views);
|
||||
+
|
||||
+ add_deferred_set_shader_resources(context, DEFERRED_GSSETSHADERRESOURCES, start_slot, view_count, views);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetSamplers(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -0,0 +1,472 @@
|
||||
From 5f2710d0312229647c1053771d78c0232772cc23 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Wed, 19 May 2021 19:00:56 -0500
|
||||
Subject: [PATCH] wined3d: Implement wined3d_deferred_context_map().
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/d3d11/tests/d3d11.c | 15 +---
|
||||
dlls/wined3d/buffer.c | 14 ++++
|
||||
dlls/wined3d/cs.c | 140 ++++++++++++++++++++++++++++++---
|
||||
dlls/wined3d/resource.c | 29 ++++---
|
||||
dlls/wined3d/texture.c | 25 ++++++
|
||||
dlls/wined3d/wined3d_private.h | 5 ++
|
||||
6 files changed, 191 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index 6e4de231c28..836b78c53b6 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -32735,21 +32735,14 @@ static void test_deferred_context_map(void)
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE, 0, &map_desc);
|
||||
- todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &map_desc);
|
||||
- todo_wine ok(hr == D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD, "Got unexpected hr %#x.\n", hr);
|
||||
+ ok(hr == D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map_desc);
|
||||
- todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
- if (hr != S_OK)
|
||||
- {
|
||||
- ID3D11Buffer_Release(buffer2);
|
||||
- ID3D11Buffer_Release(buffer);
|
||||
- ID3D11DeviceContext_Release(deferred);
|
||||
- release_test_context(&test_context);
|
||||
- return;
|
||||
- }
|
||||
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
+
|
||||
map_data = map_desc.pData;
|
||||
/* The previous contents of map_data are undefined and may in practice be
|
||||
* uninitialized garbage. */
|
||||
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
|
||||
index 12d038c0120..12b90cb54c2 100644
|
||||
--- a/dlls/wined3d/buffer.c
|
||||
+++ b/dlls/wined3d/buffer.c
|
||||
@@ -826,6 +826,19 @@ struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffe
|
||||
return &buffer->resource;
|
||||
}
|
||||
|
||||
+static HRESULT buffer_resource_sub_resource_get_size(struct wined3d_resource *resource,
|
||||
+ unsigned int sub_resource_idx, unsigned int *size, unsigned int *row_pitch, unsigned int *slice_pitch)
|
||||
+{
|
||||
+ if (sub_resource_idx)
|
||||
+ {
|
||||
+ WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
|
||||
+ return E_INVALIDARG;
|
||||
+ }
|
||||
+
|
||||
+ *size = *row_pitch = *slice_pitch = resource->size;
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx,
|
||||
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags)
|
||||
{
|
||||
@@ -1084,6 +1097,7 @@ static const struct wined3d_resource_ops buffer_resource_ops =
|
||||
buffer_resource_decref,
|
||||
buffer_resource_preload,
|
||||
buffer_resource_unload,
|
||||
+ buffer_resource_sub_resource_get_size,
|
||||
buffer_resource_sub_resource_map,
|
||||
buffer_resource_sub_resource_unmap,
|
||||
};
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 7be128f2ec4..a17926f6ff0 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -26,6 +26,13 @@ WINE_DECLARE_DEBUG_CHANNEL(fps);
|
||||
|
||||
#define WINED3D_INITIAL_CS_SIZE 4096
|
||||
|
||||
+struct wined3d_acquired_resource
|
||||
+{
|
||||
+ struct wined3d_resource *resource;
|
||||
+ unsigned int sub_resource_idx;
|
||||
+ void *sysmem;
|
||||
+};
|
||||
+
|
||||
struct wined3d_command_list
|
||||
{
|
||||
LONG refcount;
|
||||
@@ -36,7 +43,7 @@ struct wined3d_command_list
|
||||
void *data;
|
||||
|
||||
SIZE_T resource_count;
|
||||
- struct wined3d_resource **resources;
|
||||
+ struct wined3d_acquired_resource *resources;
|
||||
|
||||
/* List of command lists queued for execution on this command list. We might
|
||||
* be the only thing holding a pointer to another command list, so we need
|
||||
@@ -48,9 +55,13 @@ struct wined3d_command_list
|
||||
static void wined3d_command_list_destroy_object(void *object)
|
||||
{
|
||||
struct wined3d_command_list *list = object;
|
||||
+ SIZE_T i;
|
||||
|
||||
TRACE("list %p.\n", list);
|
||||
|
||||
+ for (i = 0; i < list->resource_count; ++i)
|
||||
+ wined3d_free_sysmem(list->resources[i].sysmem);
|
||||
+
|
||||
heap_free(list->resources);
|
||||
heap_free(list->data);
|
||||
heap_free(list);
|
||||
@@ -79,7 +90,7 @@ ULONG CDECL wined3d_command_list_decref(struct wined3d_command_list *list)
|
||||
for (i = 0; i < list->command_list_count; ++i)
|
||||
wined3d_command_list_decref(list->command_lists[i]);
|
||||
for (i = 0; i < list->resource_count; ++i)
|
||||
- wined3d_resource_decref(list->resources[i]);
|
||||
+ wined3d_resource_decref(list->resources[i].resource);
|
||||
|
||||
wined3d_cs_destroy_object(device->cs, wined3d_command_list_destroy_object, list);
|
||||
}
|
||||
@@ -139,6 +150,7 @@ enum wined3d_cs_op
|
||||
WINED3D_CS_OP_COPY_UAV_COUNTER,
|
||||
WINED3D_CS_OP_GENERATE_MIPMAPS,
|
||||
WINED3D_CS_OP_EXECUTE_COMMAND_LIST,
|
||||
+ WINED3D_CS_OP_UPLOAD_SUB_RESOURCE,
|
||||
WINED3D_CS_OP_STOP,
|
||||
};
|
||||
|
||||
@@ -469,6 +481,15 @@ struct wined3d_cs_unmap
|
||||
HRESULT *hr;
|
||||
};
|
||||
|
||||
+struct wined3d_cs_upload_sub_resource
|
||||
+{
|
||||
+ enum wined3d_cs_op opcode;
|
||||
+ struct wined3d_resource *resource;
|
||||
+ unsigned int sub_resource_idx;
|
||||
+ unsigned int size;
|
||||
+ const void *data;
|
||||
+};
|
||||
+
|
||||
struct wined3d_cs_blt_sub_resource
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
@@ -616,6 +637,7 @@ static const char *debug_cs_op(enum wined3d_cs_op op)
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_COPY_UAV_COUNTER);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_GENERATE_MIPMAPS);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_EXECUTE_COMMAND_LIST);
|
||||
+ WINED3D_TO_STR(WINED3D_CS_OP_UPLOAD_SUB_RESOURCE);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_STOP);
|
||||
#undef WINED3D_TO_STR
|
||||
}
|
||||
@@ -2342,7 +2364,7 @@ static void wined3d_cs_execute_command_list(struct wined3d_device_context *conte
|
||||
op->list = list;
|
||||
|
||||
for (i = 0; i < list->resource_count; ++i)
|
||||
- wined3d_resource_acquire(list->resources[i]);
|
||||
+ wined3d_resource_acquire(list->resources[i].resource);
|
||||
|
||||
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
|
||||
@@ -2463,6 +2485,28 @@ static HRESULT wined3d_cs_unmap(struct wined3d_device_context *context, struct w
|
||||
return hr;
|
||||
}
|
||||
|
||||
+static void wined3d_cs_exec_upload_sub_resource(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+ const struct wined3d_cs_upload_sub_resource *op = data;
|
||||
+ struct wined3d_resource *resource = op->resource;
|
||||
+ unsigned int sub_resource_idx = op->sub_resource_idx;
|
||||
+ struct wined3d_map_desc map_desc;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ if (FAILED(hr = resource->resource_ops->resource_sub_resource_map(resource,
|
||||
+ sub_resource_idx, &map_desc, NULL, WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD)))
|
||||
+ {
|
||||
+ ERR("Failed to map resource, hr %#x.\n", hr);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(map_desc.data, op->data, op->size);
|
||||
+
|
||||
+ resource->resource_ops->resource_sub_resource_unmap(resource, sub_resource_idx);
|
||||
+
|
||||
+ wined3d_resource_release(resource);
|
||||
+}
|
||||
+
|
||||
static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_blt_sub_resource *op = data;
|
||||
@@ -2870,6 +2914,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_COPY_UAV_COUNTER */ wined3d_cs_exec_copy_uav_counter,
|
||||
/* WINED3D_CS_OP_GENERATE_MIPMAPS */ wined3d_cs_exec_generate_mipmaps,
|
||||
/* WINED3D_CS_OP_EXECUTE_COMMAND_LIST */ wined3d_cs_exec_execute_command_list,
|
||||
+ /* WINED3D_CS_OP_UPLOAD_SUB_RESOURCE */ wined3d_cs_exec_upload_sub_resource,
|
||||
};
|
||||
|
||||
static void wined3d_cs_exec_execute_command_list(struct wined3d_cs *cs, const void *data)
|
||||
@@ -3301,7 +3346,7 @@ struct wined3d_deferred_context
|
||||
void *data;
|
||||
|
||||
SIZE_T resource_count, resources_capacity;
|
||||
- struct wined3d_resource **resources;
|
||||
+ struct wined3d_acquired_resource *resources;
|
||||
|
||||
/* List of command lists queued for execution on this context. A command
|
||||
* list can be the only thing holding a pointer to another command list, so
|
||||
@@ -3361,17 +3406,78 @@ static HRESULT wined3d_deferred_context_map(struct wined3d_device_context *conte
|
||||
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;
|
||||
+ struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
|
||||
+ struct wined3d_acquired_resource *acquired_resource;
|
||||
+ unsigned int size;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ if (box)
|
||||
+ {
|
||||
+ ERR("Unexpected box.\n");
|
||||
+ return E_INVALIDARG;
|
||||
+ }
|
||||
+
|
||||
+ if (FAILED(hr = resource->resource_ops->resource_sub_resource_get_size(resource,
|
||||
+ sub_resource_idx, &size, &map_desc->row_pitch, &map_desc->slice_pitch)))
|
||||
+ return E_INVALIDARG;
|
||||
+
|
||||
+ if (flags & WINED3D_MAP_DISCARD)
|
||||
+ {
|
||||
+ struct wined3d_cs_upload_sub_resource *op;
|
||||
+ void *sysmem;
|
||||
+
|
||||
+ if (!(sysmem = wined3d_allocate_sysmem(size)))
|
||||
+ return E_OUTOFMEMORY;
|
||||
+
|
||||
+ if (!wined3d_array_reserve((void **)&deferred->resources, &deferred->resources_capacity,
|
||||
+ deferred->resource_count + 1, sizeof(*deferred->resources)))
|
||||
+ return E_OUTOFMEMORY;
|
||||
+
|
||||
+ acquired_resource = &deferred->resources[deferred->resource_count++];
|
||||
+ acquired_resource->resource = resource;
|
||||
+ wined3d_resource_incref(resource);
|
||||
+ acquired_resource->sub_resource_idx = sub_resource_idx;
|
||||
+ acquired_resource->sysmem = sysmem;
|
||||
+
|
||||
+ op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ op->opcode = WINED3D_CS_OP_UPLOAD_SUB_RESOURCE;
|
||||
+ op->resource = resource;
|
||||
+ op->sub_resource_idx = sub_resource_idx;
|
||||
+ op->size = size;
|
||||
+ op->data = sysmem;
|
||||
+
|
||||
+ map_desc->data = sysmem;
|
||||
+ return S_OK;
|
||||
+ }
|
||||
+ else if (flags & WINED3D_MAP_NOOVERWRITE)
|
||||
+ {
|
||||
+ int i = deferred->resource_count;
|
||||
+
|
||||
+ while (i--)
|
||||
+ {
|
||||
+ acquired_resource = &deferred->resources[i];
|
||||
+
|
||||
+ if (acquired_resource->resource == resource
|
||||
+ && acquired_resource->sub_resource_idx == sub_resource_idx && acquired_resource->sysmem)
|
||||
+ {
|
||||
+ map_desc->data = acquired_resource->sysmem;
|
||||
+ return S_OK;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ WARN("Invalid flags %#x, returning E_INVALIDARG.\n", flags);
|
||||
+ return E_INVALIDARG;
|
||||
+ }
|
||||
}
|
||||
|
||||
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;
|
||||
+ return S_OK;
|
||||
}
|
||||
|
||||
static void wined3d_deferred_context_update_sub_resource(struct wined3d_device_context *context,
|
||||
@@ -3424,13 +3530,17 @@ static void wined3d_deferred_context_acquire_resource(struct wined3d_device_cont
|
||||
struct wined3d_resource *resource)
|
||||
{
|
||||
struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
|
||||
+ struct wined3d_acquired_resource *acquired_resource;
|
||||
|
||||
if (!wined3d_array_reserve((void **)&deferred->resources, &deferred->resources_capacity,
|
||||
deferred->resource_count + 1, sizeof(*deferred->resources)))
|
||||
return;
|
||||
|
||||
- deferred->resources[deferred->resource_count++] = resource;
|
||||
+ acquired_resource = &deferred->resources[deferred->resource_count++];
|
||||
+ acquired_resource->resource = resource;
|
||||
wined3d_resource_incref(resource);
|
||||
+ acquired_resource->sub_resource_idx = 0;
|
||||
+ acquired_resource->sysmem = NULL;
|
||||
}
|
||||
|
||||
static void wined3d_deferred_context_execute_command_list(struct wined3d_device_context *context,
|
||||
@@ -3461,7 +3571,8 @@ static void wined3d_deferred_context_execute_command_list(struct wined3d_device_
|
||||
|
||||
/* And grab a reference to each of the command list's resources. */
|
||||
for (i = 0; i < list->resource_count; ++i)
|
||||
- wined3d_deferred_context_acquire_resource(context, list->resources[i]);
|
||||
+ /* Don't store the sysmem pointer; the original command list will free it. */
|
||||
+ wined3d_deferred_context_acquire_resource(context, list->resources[i].resource);
|
||||
}
|
||||
|
||||
static const struct wined3d_device_context_ops wined3d_deferred_context_ops =
|
||||
@@ -3512,7 +3623,10 @@ void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *conte
|
||||
TRACE("context %p.\n", context);
|
||||
|
||||
for (i = 0; i < deferred->resource_count; ++i)
|
||||
- wined3d_resource_decref(deferred->resources[i]);
|
||||
+ {
|
||||
+ wined3d_resource_decref(deferred->resources[i].resource);
|
||||
+ wined3d_free_sysmem(deferred->resources[i].sysmem);
|
||||
+ }
|
||||
heap_free(deferred->resources);
|
||||
|
||||
wined3d_state_destroy(deferred->c.state);
|
||||
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
|
||||
index 58e3e5c77fd..42e45a2745c 100644
|
||||
--- a/dlls/wined3d/resource.c
|
||||
+++ b/dlls/wined3d/resource.c
|
||||
@@ -334,24 +334,32 @@ void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
|
||||
wined3d_cs_emit_preload_resource(resource->device->cs, resource);
|
||||
}
|
||||
|
||||
-static BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource)
|
||||
+void *wined3d_allocate_sysmem(SIZE_T size)
|
||||
{
|
||||
void **p;
|
||||
- SIZE_T align = RESOURCE_ALIGNMENT - 1 + sizeof(*p);
|
||||
+ static const SIZE_T align = RESOURCE_ALIGNMENT - 1 + sizeof(*p);
|
||||
void *mem;
|
||||
|
||||
- if (!(mem = heap_alloc_zero(resource->size + align)))
|
||||
+ if (!(mem = heap_alloc_zero(size + align)))
|
||||
{
|
||||
ERR("Failed to allocate system memory.\n");
|
||||
- return FALSE;
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1;
|
||||
*p = mem;
|
||||
|
||||
- resource->heap_memory = ++p;
|
||||
+ return ++p;
|
||||
+}
|
||||
|
||||
- return TRUE;
|
||||
+void wined3d_free_sysmem(void *mem)
|
||||
+{
|
||||
+ void **p = mem;
|
||||
+
|
||||
+ if (!p)
|
||||
+ return;
|
||||
+
|
||||
+ heap_free(*(--p));
|
||||
}
|
||||
|
||||
BOOL wined3d_resource_prepare_sysmem(struct wined3d_resource *resource)
|
||||
@@ -359,17 +367,12 @@ BOOL wined3d_resource_prepare_sysmem(struct wined3d_resource *resource)
|
||||
if (resource->heap_memory)
|
||||
return TRUE;
|
||||
|
||||
- return wined3d_resource_allocate_sysmem(resource);
|
||||
+ return !!(resource->heap_memory = wined3d_allocate_sysmem(resource->size));
|
||||
}
|
||||
|
||||
void wined3d_resource_free_sysmem(struct wined3d_resource *resource)
|
||||
{
|
||||
- void **p = resource->heap_memory;
|
||||
-
|
||||
- if (!p)
|
||||
- return;
|
||||
-
|
||||
- heap_free(*(--p));
|
||||
+ wined3d_free_sysmem(resource->heap_memory);
|
||||
resource->heap_memory = NULL;
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index dcdd08ac9b1..61b7fe9325f 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -3506,6 +3506,30 @@ static void texture_resource_unload(struct wined3d_resource *resource)
|
||||
resource_unload(&texture->resource);
|
||||
}
|
||||
|
||||
+static HRESULT texture_resource_sub_resource_get_size(struct wined3d_resource *resource,
|
||||
+ unsigned int sub_resource_idx, unsigned int *size, unsigned int *row_pitch, unsigned int *slice_pitch)
|
||||
+{
|
||||
+ struct wined3d_texture *texture = texture_from_resource(resource);
|
||||
+ unsigned int texture_level = sub_resource_idx % texture->level_count;
|
||||
+ struct wined3d_texture_sub_resource *sub_resource;
|
||||
+
|
||||
+ if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx)))
|
||||
+ return E_INVALIDARG;
|
||||
+
|
||||
+ if (resource->format_flags & WINED3DFMT_FLAG_BROKEN_PITCH)
|
||||
+ {
|
||||
+ *row_pitch = wined3d_texture_get_level_width(texture, texture_level) * resource->format->byte_count;
|
||||
+ *slice_pitch = wined3d_texture_get_level_height(texture, texture_level) * (*row_pitch);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ wined3d_texture_get_pitch(texture, texture_level, row_pitch, slice_pitch);
|
||||
+ }
|
||||
+
|
||||
+ *size = sub_resource->size;
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
static HRESULT texture_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)
|
||||
{
|
||||
@@ -3692,6 +3716,7 @@ static const struct wined3d_resource_ops texture_resource_ops =
|
||||
texture_resource_decref,
|
||||
texture_resource_preload,
|
||||
texture_resource_unload,
|
||||
+ texture_resource_sub_resource_get_size,
|
||||
texture_resource_sub_resource_map,
|
||||
texture_resource_sub_resource_unmap,
|
||||
};
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index ce93da3a81b..e7a3e42d8bb 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -4048,6 +4048,8 @@ struct wined3d_resource_ops
|
||||
ULONG (*resource_decref)(struct wined3d_resource *resource);
|
||||
void (*resource_preload)(struct wined3d_resource *resource);
|
||||
void (*resource_unload)(struct wined3d_resource *resource);
|
||||
+ HRESULT (*resource_sub_resource_get_size)(struct wined3d_resource *resource, unsigned int sub_resource_idx,
|
||||
+ unsigned int *size, unsigned int *row_pitch, unsigned int *slice_pitch);
|
||||
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_sub_resource_unmap)(struct wined3d_resource *resource, unsigned int sub_resource_idx);
|
||||
@@ -4131,6 +4133,9 @@ void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DEC
|
||||
#define RESOURCE_ALIGNMENT 16
|
||||
#define WINED3D_CONSTANT_BUFFER_ALIGNMENT 16
|
||||
|
||||
+void *wined3d_allocate_sysmem(SIZE_T size) DECLSPEC_HIDDEN;
|
||||
+void wined3d_free_sysmem(void *mem) DECLSPEC_HIDDEN;
|
||||
+
|
||||
#define WINED3D_LOCATION_DISCARDED 0x00000001
|
||||
#define WINED3D_LOCATION_SYSMEM 0x00000002
|
||||
#define WINED3D_LOCATION_BUFFER 0x00000008
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,68 +0,0 @@
|
||||
From 7f97c88879938cc72d3e8372ba74ff40b3371815 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:11:41 +0300
|
||||
Subject: [PATCH] d3d11: Implement HSSetShaderResources 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 7f835e8..2bdaa67 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -50,6 +50,7 @@ enum deferred_cmd
|
||||
DEFERRED_CSSETSHADERRESOURCES, /* res_info */
|
||||
DEFERRED_DSSETSHADERRESOURCES, /* res_info */
|
||||
DEFERRED_GSSETSHADERRESOURCES, /* res_info */
|
||||
+ DEFERRED_HSSETSHADERRESOURCES, /* res_info */
|
||||
DEFERRED_PSSETSHADERRESOURCES, /* res_info */
|
||||
|
||||
DEFERRED_DSSETSAMPLERS, /* samplers_info */
|
||||
@@ -271,7 +272,7 @@ static struct deferred_call *add_deferred_call(struct d3d11_deferred_context *co
|
||||
}
|
||||
|
||||
/* for DEFERRED_CSSETSHADERRESOURCES, DEFERRED_DSSETSHADERRESOURCES, DEFERRED_GSSETSHADERRESOURCES,
|
||||
- * and DEFERRED_PSSETSHADERRESOURCES */
|
||||
+ * DEFERRED_HSSETSHADERRESOURCES and DEFERRED_PSSETSHADERRESOURCES */
|
||||
static void add_deferred_set_shader_resources(struct d3d11_deferred_context *context, enum deferred_cmd cmd,
|
||||
UINT start_slot, UINT view_count, ID3D11ShaderResourceView *const *views)
|
||||
{
|
||||
@@ -441,6 +442,7 @@ static void free_deferred_calls(struct list *commands)
|
||||
case DEFERRED_CSSETSHADERRESOURCES:
|
||||
case DEFERRED_DSSETSHADERRESOURCES:
|
||||
case DEFERRED_GSSETSHADERRESOURCES:
|
||||
+ case DEFERRED_HSSETSHADERRESOURCES:
|
||||
case DEFERRED_PSSETSHADERRESOURCES:
|
||||
{
|
||||
for (i = 0; i < call->res_info.num_views; i++)
|
||||
@@ -634,6 +636,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->res_info.num_views, call->res_info.views);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_HSSETSHADERRESOURCES:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_HSSetShaderResources(iface, call->res_info.start_slot,
|
||||
+ call->res_info.num_views, call->res_info.views);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_PSSETSHADERRESOURCES:
|
||||
{
|
||||
ID3D11DeviceContext1_PSSetShaderResources(iface, call->res_info.start_slot,
|
||||
@@ -4529,8 +4537,12 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_ExecuteCommandList(ID3D11De
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetShaderResources(ID3D11DeviceContext *iface,
|
||||
UINT start_slot, UINT view_count, ID3D11ShaderResourceView *const *views)
|
||||
{
|
||||
- FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
|
||||
iface, start_slot, view_count, views);
|
||||
+
|
||||
+ add_deferred_set_shader_resources(context, DEFERRED_HSSETSHADERRESOURCES, start_slot, view_count, views);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetShader(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,68 +0,0 @@
|
||||
From 3e7cd344b0e07391ed7f859ed47c362e8f69128a Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:13:47 +0300
|
||||
Subject: [PATCH] d3d11: Implement VSSetShaderResources for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 17 +++++++++++++++--
|
||||
1 file changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 2bdaa67..dfafdcd 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -52,6 +52,7 @@ enum deferred_cmd
|
||||
DEFERRED_GSSETSHADERRESOURCES, /* res_info */
|
||||
DEFERRED_HSSETSHADERRESOURCES, /* res_info */
|
||||
DEFERRED_PSSETSHADERRESOURCES, /* res_info */
|
||||
+ DEFERRED_VSSETSHADERRESOURCES, /* res_info */
|
||||
|
||||
DEFERRED_DSSETSAMPLERS, /* samplers_info */
|
||||
DEFERRED_PSSETSAMPLERS, /* samplers_info */
|
||||
@@ -272,7 +273,7 @@ static struct deferred_call *add_deferred_call(struct d3d11_deferred_context *co
|
||||
}
|
||||
|
||||
/* for DEFERRED_CSSETSHADERRESOURCES, DEFERRED_DSSETSHADERRESOURCES, DEFERRED_GSSETSHADERRESOURCES,
|
||||
- * DEFERRED_HSSETSHADERRESOURCES and DEFERRED_PSSETSHADERRESOURCES */
|
||||
+ * DEFERRED_HSSETSHADERRESOURCES, DEFERRED_PSSETSHADERRESOURCES and DEFERRED_VSSETSHADERRESOURCES */
|
||||
static void add_deferred_set_shader_resources(struct d3d11_deferred_context *context, enum deferred_cmd cmd,
|
||||
UINT start_slot, UINT view_count, ID3D11ShaderResourceView *const *views)
|
||||
{
|
||||
@@ -444,6 +445,7 @@ static void free_deferred_calls(struct list *commands)
|
||||
case DEFERRED_GSSETSHADERRESOURCES:
|
||||
case DEFERRED_HSSETSHADERRESOURCES:
|
||||
case DEFERRED_PSSETSHADERRESOURCES:
|
||||
+ case DEFERRED_VSSETSHADERRESOURCES:
|
||||
{
|
||||
for (i = 0; i < call->res_info.num_views; i++)
|
||||
{
|
||||
@@ -648,6 +650,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->res_info.num_views, call->res_info.views);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_VSSETSHADERRESOURCES:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_VSSetShaderResources(iface, call->res_info.start_slot,
|
||||
+ call->res_info.num_views, call->res_info.views);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_DSSETSAMPLERS:
|
||||
{
|
||||
ID3D11DeviceContext1_DSSetSamplers(iface, call->samplers_info.start_slot,
|
||||
@@ -4186,7 +4194,12 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_IASetPrimitiveTopology(ID3D
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_VSSetShaderResources(ID3D11DeviceContext *iface,
|
||||
UINT start_slot, UINT view_count, ID3D11ShaderResourceView *const *views)
|
||||
{
|
||||
- FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n", iface, start_slot, view_count, views);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p, start_slot %u, view_count %u, views %p.\n",
|
||||
+ iface, start_slot, view_count, views);
|
||||
+
|
||||
+ add_deferred_set_shader_resources(context, DEFERRED_VSSETSHADERRESOURCES, start_slot, view_count, views);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_VSSetSamplers(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,68 +0,0 @@
|
||||
From 207460a669131fc04d9aec1575080b7fb1e820a9 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:15:31 +0300
|
||||
Subject: [PATCH] d3d11: Implement CSSetSamplers 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 dfafdcd..7e5f191 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -54,6 +54,7 @@ enum deferred_cmd
|
||||
DEFERRED_PSSETSHADERRESOURCES, /* res_info */
|
||||
DEFERRED_VSSETSHADERRESOURCES, /* res_info */
|
||||
|
||||
+ DEFERRED_CSSETSAMPLERS, /* samplers_info */
|
||||
DEFERRED_DSSETSAMPLERS, /* samplers_info */
|
||||
DEFERRED_PSSETSAMPLERS, /* samplers_info */
|
||||
|
||||
@@ -294,7 +295,7 @@ static void add_deferred_set_shader_resources(struct d3d11_deferred_context *con
|
||||
}
|
||||
}
|
||||
|
||||
-/* for DEFERRED_DSSETSAMPLERS and DEFERRED_PSSETSAMPLERS */
|
||||
+/* for DEFERRED_CSSETSAMPLERS, DEFERRED_DSSETSAMPLERS and DEFERRED_PSSETSAMPLERS */
|
||||
static void add_deferred_set_samplers(struct d3d11_deferred_context *context, enum deferred_cmd cmd,
|
||||
UINT start_slot, UINT sampler_count, ID3D11SamplerState *const *samplers)
|
||||
{
|
||||
@@ -454,6 +455,7 @@ static void free_deferred_calls(struct list *commands)
|
||||
}
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_CSSETSAMPLERS:
|
||||
case DEFERRED_DSSETSAMPLERS:
|
||||
case DEFERRED_PSSETSAMPLERS:
|
||||
{
|
||||
@@ -656,6 +658,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->res_info.num_views, call->res_info.views);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_CSSETSAMPLERS:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_CSSetSamplers(iface, call->samplers_info.start_slot,
|
||||
+ call->samplers_info.num_samplers, call->samplers_info.samplers);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_DSSETSAMPLERS:
|
||||
{
|
||||
ID3D11DeviceContext1_DSSetSamplers(iface, call->samplers_info.start_slot,
|
||||
@@ -4700,8 +4708,12 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetShader(ID3D11DeviceCon
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetSamplers(ID3D11DeviceContext *iface,
|
||||
UINT start_slot, UINT sampler_count, ID3D11SamplerState *const *samplers)
|
||||
{
|
||||
- FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
|
||||
iface, start_slot, sampler_count, samplers);
|
||||
+
|
||||
+ add_deferred_set_samplers(context, DEFERRED_CSSETSAMPLERS, start_slot, sampler_count, samplers);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetConstantBuffers(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,69 +0,0 @@
|
||||
From e9225859dd9b134f1f3ac75555ba2912cacfade5 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:19:27 +0300
|
||||
Subject: [PATCH] d3d11: Implement GSSetSamplers for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 17 +++++++++++++++--
|
||||
1 file changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 7e5f191..aabbe38 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -56,6 +56,7 @@ enum deferred_cmd
|
||||
|
||||
DEFERRED_CSSETSAMPLERS, /* samplers_info */
|
||||
DEFERRED_DSSETSAMPLERS, /* samplers_info */
|
||||
+ DEFERRED_GSSETSAMPLERS, /* samplers_info */
|
||||
DEFERRED_PSSETSAMPLERS, /* samplers_info */
|
||||
|
||||
DEFERRED_CSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
@@ -295,7 +296,8 @@ static void add_deferred_set_shader_resources(struct d3d11_deferred_context *con
|
||||
}
|
||||
}
|
||||
|
||||
-/* for DEFERRED_CSSETSAMPLERS, DEFERRED_DSSETSAMPLERS and DEFERRED_PSSETSAMPLERS */
|
||||
+/* for DEFERRED_CSSETSAMPLERS, DEFERRED_DSSETSAMPLERS, DEFERRED_GSSETSAMPLERS and
|
||||
+ * DEFERRED_PSSETSAMPLERS */
|
||||
static void add_deferred_set_samplers(struct d3d11_deferred_context *context, enum deferred_cmd cmd,
|
||||
UINT start_slot, UINT sampler_count, ID3D11SamplerState *const *samplers)
|
||||
{
|
||||
@@ -457,6 +459,7 @@ static void free_deferred_calls(struct list *commands)
|
||||
}
|
||||
case DEFERRED_CSSETSAMPLERS:
|
||||
case DEFERRED_DSSETSAMPLERS:
|
||||
+ case DEFERRED_GSSETSAMPLERS:
|
||||
case DEFERRED_PSSETSAMPLERS:
|
||||
{
|
||||
for (i = 0; i < call->samplers_info.num_samplers; i++)
|
||||
@@ -670,6 +673,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->samplers_info.num_samplers, call->samplers_info.samplers);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_GSSETSAMPLERS:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_GSSetSamplers(iface, call->samplers_info.start_slot,
|
||||
+ call->samplers_info.num_samplers, call->samplers_info.samplers);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_PSSETSAMPLERS:
|
||||
{
|
||||
ID3D11DeviceContext1_PSSetSamplers(iface, call->samplers_info.start_slot,
|
||||
@@ -4258,8 +4267,12 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShaderResources(ID3D11
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetSamplers(ID3D11DeviceContext *iface,
|
||||
UINT start_slot, UINT sampler_count, ID3D11SamplerState *const *samplers)
|
||||
{
|
||||
- FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
|
||||
iface, start_slot, sampler_count, samplers);
|
||||
+
|
||||
+ add_deferred_set_samplers(context, DEFERRED_GSSETSAMPLERS, start_slot, sampler_count, samplers);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargets(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,70 +0,0 @@
|
||||
From d67655d6733fdf62a10f330d9292ced0aa99f809 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:21:32 +0300
|
||||
Subject: [PATCH] d3d11: Implement HSSetSamplers for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 18 +++++++++++++++---
|
||||
1 file changed, 15 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index aabbe38..2d03464 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -57,6 +57,7 @@ enum deferred_cmd
|
||||
DEFERRED_CSSETSAMPLERS, /* samplers_info */
|
||||
DEFERRED_DSSETSAMPLERS, /* samplers_info */
|
||||
DEFERRED_GSSETSAMPLERS, /* samplers_info */
|
||||
+ DEFERRED_HSSETSAMPLERS, /* samplers_info */
|
||||
DEFERRED_PSSETSAMPLERS, /* samplers_info */
|
||||
|
||||
DEFERRED_CSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
@@ -296,8 +297,8 @@ static void add_deferred_set_shader_resources(struct d3d11_deferred_context *con
|
||||
}
|
||||
}
|
||||
|
||||
-/* for DEFERRED_CSSETSAMPLERS, DEFERRED_DSSETSAMPLERS, DEFERRED_GSSETSAMPLERS and
|
||||
- * DEFERRED_PSSETSAMPLERS */
|
||||
+/* for DEFERRED_CSSETSAMPLERS, DEFERRED_DSSETSAMPLERS, DEFERRED_GSSETSAMPLERS,
|
||||
+ * DEFERRED_HSSETSAMPLERS and DEFERRED_PSSETSAMPLERS */
|
||||
static void add_deferred_set_samplers(struct d3d11_deferred_context *context, enum deferred_cmd cmd,
|
||||
UINT start_slot, UINT sampler_count, ID3D11SamplerState *const *samplers)
|
||||
{
|
||||
@@ -460,6 +461,7 @@ static void free_deferred_calls(struct list *commands)
|
||||
case DEFERRED_CSSETSAMPLERS:
|
||||
case DEFERRED_DSSETSAMPLERS:
|
||||
case DEFERRED_GSSETSAMPLERS:
|
||||
+ case DEFERRED_HSSETSAMPLERS:
|
||||
case DEFERRED_PSSETSAMPLERS:
|
||||
{
|
||||
for (i = 0; i < call->samplers_info.num_samplers; i++)
|
||||
@@ -679,6 +681,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->samplers_info.num_samplers, call->samplers_info.samplers);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_HSSETSAMPLERS:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_HSSetSamplers(iface, call->samplers_info.start_slot,
|
||||
+ call->samplers_info.num_samplers, call->samplers_info.samplers);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_PSSETSAMPLERS:
|
||||
{
|
||||
ID3D11DeviceContext1_PSSetSamplers(iface, call->samplers_info.start_slot,
|
||||
@@ -4599,8 +4607,12 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetShader(ID3D11DeviceCon
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetSamplers(ID3D11DeviceContext *iface,
|
||||
UINT start_slot, UINT sampler_count, ID3D11SamplerState *const *samplers)
|
||||
{
|
||||
- FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
|
||||
iface, start_slot, sampler_count, samplers);
|
||||
+
|
||||
+ add_deferred_set_samplers(context, DEFERRED_HSSETSAMPLERS, start_slot, sampler_count, samplers);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetConstantBuffers(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,68 +0,0 @@
|
||||
From ae628cd9b5dcb81d43dbae1c7db76844658556a8 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:23:51 +0300
|
||||
Subject: [PATCH] d3d11: Implement VSSetSamplers 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 2d03464..178cd7f 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -59,6 +59,7 @@ enum deferred_cmd
|
||||
DEFERRED_GSSETSAMPLERS, /* samplers_info */
|
||||
DEFERRED_HSSETSAMPLERS, /* samplers_info */
|
||||
DEFERRED_PSSETSAMPLERS, /* samplers_info */
|
||||
+ DEFERRED_VSSETSAMPLERS, /* samplers_info */
|
||||
|
||||
DEFERRED_CSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
DEFERRED_DSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
@@ -298,7 +299,7 @@ static void add_deferred_set_shader_resources(struct d3d11_deferred_context *con
|
||||
}
|
||||
|
||||
/* for DEFERRED_CSSETSAMPLERS, DEFERRED_DSSETSAMPLERS, DEFERRED_GSSETSAMPLERS,
|
||||
- * DEFERRED_HSSETSAMPLERS and DEFERRED_PSSETSAMPLERS */
|
||||
+ * DEFERRED_HSSETSAMPLERS, DEFERRED_PSSETSAMPLERS and DEFERRED_VSSETSAMPLERS */
|
||||
static void add_deferred_set_samplers(struct d3d11_deferred_context *context, enum deferred_cmd cmd,
|
||||
UINT start_slot, UINT sampler_count, ID3D11SamplerState *const *samplers)
|
||||
{
|
||||
@@ -463,6 +464,7 @@ static void free_deferred_calls(struct list *commands)
|
||||
case DEFERRED_GSSETSAMPLERS:
|
||||
case DEFERRED_HSSETSAMPLERS:
|
||||
case DEFERRED_PSSETSAMPLERS:
|
||||
+ case DEFERRED_VSSETSAMPLERS:
|
||||
{
|
||||
for (i = 0; i < call->samplers_info.num_samplers; i++)
|
||||
{
|
||||
@@ -693,6 +695,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->samplers_info.num_samplers, call->samplers_info.samplers);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_VSSETSAMPLERS:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_VSSetSamplers(iface, call->samplers_info.start_slot,
|
||||
+ call->samplers_info.num_samplers, call->samplers_info.samplers);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETCONSTANTBUFFERS:
|
||||
{
|
||||
ID3D11DeviceContext1_CSSetConstantBuffers(iface, call->constant_buffers_info.start_slot,
|
||||
@@ -4230,8 +4238,12 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_VSSetShaderResources(ID3D11
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_VSSetSamplers(ID3D11DeviceContext *iface,
|
||||
UINT start_slot, UINT sampler_count, ID3D11SamplerState *const *samplers)
|
||||
{
|
||||
- FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
|
||||
iface, start_slot, sampler_count, samplers);
|
||||
+
|
||||
+ add_deferred_set_samplers(context, DEFERRED_VSSETSAMPLERS, start_slot, sampler_count, samplers);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_Begin(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,104 +0,0 @@
|
||||
From 8e5acc9396447816d520f1c24c08a9f76e8c7561 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Fri, 7 Jul 2017 11:26:21 +0300
|
||||
Subject: [PATCH] d3d11: Implement Begin and End for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 46 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 178cd7f..67feab6 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -80,6 +80,9 @@ enum deferred_cmd
|
||||
DEFERRED_CLEARSTATE,
|
||||
DEFERRED_CLEARRENDERTARGETVIEW, /* clear_rtv_info */
|
||||
DEFERRED_CLEARDEPTHSTENCILVIEW, /* clear_depth_info */
|
||||
+
|
||||
+ DEFERRED_BEGIN, /* async_info */
|
||||
+ DEFERRED_END, /* async_info */
|
||||
};
|
||||
|
||||
struct deferred_call
|
||||
@@ -237,6 +240,10 @@ struct deferred_call
|
||||
FLOAT depth;
|
||||
UINT8 stencil;
|
||||
} clear_depth_info;
|
||||
+ struct
|
||||
+ {
|
||||
+ ID3D11Asynchronous *asynchronous;
|
||||
+ } async_info;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -527,6 +534,13 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11DepthStencilView_Release(call->clear_depth_info.view);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_BEGIN:
|
||||
+ case DEFERRED_END:
|
||||
+ {
|
||||
+ if (call->async_info.asynchronous)
|
||||
+ ID3D11Asynchronous_Release(call->async_info.asynchronous);
|
||||
+ break;
|
||||
+ }
|
||||
default:
|
||||
{
|
||||
FIXME("Unimplemented command type %u\n", call->cmd);
|
||||
@@ -802,6 +816,16 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->clear_depth_info.stencil);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_BEGIN:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_Begin(iface, call->async_info.asynchronous);
|
||||
+ break;
|
||||
+ }
|
||||
+ case DEFERRED_END:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_End(iface, call->async_info.asynchronous);
|
||||
+ break;
|
||||
+ }
|
||||
default:
|
||||
{
|
||||
FIXME("Unimplemented command type %u\n", call->cmd);
|
||||
@@ -4249,13 +4273,33 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_VSSetSamplers(ID3D11DeviceC
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_Begin(ID3D11DeviceContext *iface,
|
||||
ID3D11Asynchronous *asynchronous)
|
||||
{
|
||||
- FIXME("iface %p, asynchronous %p stub!\n", iface, asynchronous);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, asynchronous %p.\n", iface, asynchronous);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_BEGIN;
|
||||
+ if (asynchronous) ID3D11Asynchronous_AddRef(asynchronous);
|
||||
+ call->async_info.asynchronous = asynchronous;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_End(ID3D11DeviceContext *iface,
|
||||
ID3D11Asynchronous *asynchronous)
|
||||
{
|
||||
- FIXME("iface %p, asynchronous %p stub!\n", iface, asynchronous);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, asynchronous %p.\n", iface, asynchronous);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_END;
|
||||
+ if (asynchronous) ID3D11Asynchronous_AddRef(asynchronous);
|
||||
+ call->async_info.asynchronous = asynchronous;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_GetData(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,88 +0,0 @@
|
||||
From e9e4f687334712d9e63ffbd1727b485d6ed6059b Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Thu, 31 Aug 2017 20:24:35 +0200
|
||||
Subject: [PATCH] d3d11: Implement CopyResource for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 37 ++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 36 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 67feab6..242a758 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -40,6 +40,8 @@ enum deferred_cmd
|
||||
DEFERRED_OMSETBLENDSTATE, /* blend_state_info */
|
||||
DEFERRED_OMSETRENDERTARGETS, /* render_target_info */
|
||||
|
||||
+ DEFERRED_COPYRESOURCE, /* copy_resource_info */
|
||||
+
|
||||
DEFERRED_CSSETSHADER, /* cs_info */
|
||||
DEFERRED_DSSETSHADER, /* ds_info */
|
||||
DEFERRED_GSSETSHADER, /* gs_info */
|
||||
@@ -141,6 +143,11 @@ struct deferred_call
|
||||
} render_target_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11Resource *dst_resource;
|
||||
+ ID3D11Resource *src_resource;
|
||||
+ } copy_resource_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11ComputeShader *shader;
|
||||
/* FIXME: add class instances */
|
||||
} cs_info;
|
||||
@@ -416,6 +423,14 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11DepthStencilView_Release(call->render_target_info.depth_stencil);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_COPYRESOURCE:
|
||||
+ {
|
||||
+ if (call->copy_resource_info.dst_resource)
|
||||
+ ID3D11Resource_Release(call->copy_resource_info.dst_resource);
|
||||
+ if (call->copy_resource_info.src_resource)
|
||||
+ ID3D11Resource_Release(call->copy_resource_info.src_resource);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
if (call->cs_info.shader)
|
||||
@@ -613,6 +628,13 @@ 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_COPYRESOURCE:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_CopyResource(iface,
|
||||
+ call->copy_resource_info.dst_resource,
|
||||
+ call->copy_resource_info.src_resource);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
ID3D11DeviceContext1_CSSetShader(iface, call->cs_info.shader, NULL, 0);
|
||||
@@ -4523,7 +4545,20 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CopySubresourceRegion(ID3D1
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_CopyResource(ID3D11DeviceContext *iface,
|
||||
ID3D11Resource *dst_resource, ID3D11Resource *src_resource)
|
||||
{
|
||||
- FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, dst_resource %p, src_resource %p.\n", iface, dst_resource, src_resource);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ if (dst_resource) ID3D11Resource_AddRef(dst_resource);
|
||||
+ if (src_resource) ID3D11Resource_AddRef(src_resource);
|
||||
+
|
||||
+ call->cmd = DEFERRED_COPYRESOURCE;
|
||||
+ call->copy_resource_info.dst_resource = dst_resource;
|
||||
+ call->copy_resource_info.src_resource = src_resource;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_UpdateSubresource(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,83 +0,0 @@
|
||||
From 98b443232d7d86ab2eb30182a11ba2c5b660c878 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 02:19:00 +0200
|
||||
Subject: [PATCH] d3d11: Implement SetResourceMinLOD for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 32 +++++++++++++++++++++++++++++++-
|
||||
1 file changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 242a758..22e2c8f 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -41,6 +41,7 @@ enum deferred_cmd
|
||||
DEFERRED_OMSETRENDERTARGETS, /* render_target_info */
|
||||
|
||||
DEFERRED_COPYRESOURCE, /* copy_resource_info */
|
||||
+ DEFERRED_SETRESOURCEMINLOD, /* set_resource_min_lod_info */
|
||||
|
||||
DEFERRED_CSSETSHADER, /* cs_info */
|
||||
DEFERRED_DSSETSHADER, /* ds_info */
|
||||
@@ -148,6 +149,11 @@ struct deferred_call
|
||||
} copy_resource_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11Resource *resource;
|
||||
+ FLOAT min_lod;
|
||||
+ } set_resource_min_lod_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11ComputeShader *shader;
|
||||
/* FIXME: add class instances */
|
||||
} cs_info;
|
||||
@@ -431,6 +437,12 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11Resource_Release(call->copy_resource_info.src_resource);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_SETRESOURCEMINLOD:
|
||||
+ {
|
||||
+ if (call->set_resource_min_lod_info.resource)
|
||||
+ ID3D11Resource_Release(call->set_resource_min_lod_info.resource);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
if (call->cs_info.shader)
|
||||
@@ -635,6 +647,13 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->copy_resource_info.src_resource);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_SETRESOURCEMINLOD:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_SetResourceMinLOD(iface,
|
||||
+ call->set_resource_min_lod_info.resource,
|
||||
+ call->set_resource_min_lod_info.min_lod);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
ID3D11DeviceContext1_CSSetShader(iface, call->cs_info.shader, NULL, 0);
|
||||
@@ -4639,7 +4658,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_GenerateMips(ID3D11DeviceCo
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_SetResourceMinLOD(ID3D11DeviceContext *iface,
|
||||
ID3D11Resource *resource, FLOAT min_lod)
|
||||
{
|
||||
- FIXME("iface %p, resource %p, min_lod %f stub!\n", iface, resource, min_lod);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, resource %p, min_lod %f.\n", iface, resource, min_lod);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_SETRESOURCEMINLOD;
|
||||
+ if (resource) ID3D11Resource_AddRef(resource);
|
||||
+ call->set_resource_min_lod_info.resource = resource;
|
||||
+ call->set_resource_min_lod_info.min_lod = min_lod;
|
||||
}
|
||||
|
||||
static FLOAT STDMETHODCALLTYPE d3d11_deferred_context_GetResourceMinLOD(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,117 +0,0 @@
|
||||
From 2b8aa187dc5d42baae67d42d91589343c2fe6cda Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 02:21:30 +0200
|
||||
Subject: [PATCH] d3d11: Implement CopySubresourceRegion for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 62 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 22e2c8f..0c5360a 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -42,6 +42,7 @@ enum deferred_cmd
|
||||
|
||||
DEFERRED_COPYRESOURCE, /* copy_resource_info */
|
||||
DEFERRED_SETRESOURCEMINLOD, /* set_resource_min_lod_info */
|
||||
+ DEFERRED_COPYSUBRESOURCEREGION, /* copy_subresource_region_info */
|
||||
|
||||
DEFERRED_CSSETSHADER, /* cs_info */
|
||||
DEFERRED_DSSETSHADER, /* ds_info */
|
||||
@@ -154,6 +155,17 @@ struct deferred_call
|
||||
} set_resource_min_lod_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11Resource *dst_resource;
|
||||
+ UINT dst_subresource_idx;
|
||||
+ UINT dst_x;
|
||||
+ UINT dst_y;
|
||||
+ UINT dst_z;
|
||||
+ ID3D11Resource *src_resource;
|
||||
+ UINT src_subresource_idx;
|
||||
+ D3D11_BOX *src_box;
|
||||
+ } copy_subresource_region_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11ComputeShader *shader;
|
||||
/* FIXME: add class instances */
|
||||
} cs_info;
|
||||
@@ -443,6 +455,14 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11Resource_Release(call->set_resource_min_lod_info.resource);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_COPYSUBRESOURCEREGION:
|
||||
+ {
|
||||
+ if (call->copy_subresource_region_info.dst_resource)
|
||||
+ ID3D11Resource_Release(call->copy_subresource_region_info.dst_resource);
|
||||
+ if (call->copy_subresource_region_info.src_resource)
|
||||
+ ID3D11Resource_Release(call->copy_subresource_region_info.src_resource);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
if (call->cs_info.shader)
|
||||
@@ -654,6 +674,19 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->set_resource_min_lod_info.min_lod);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_COPYSUBRESOURCEREGION:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_CopySubresourceRegion(iface,
|
||||
+ call->copy_subresource_region_info.dst_resource,
|
||||
+ call->copy_subresource_region_info.dst_subresource_idx,
|
||||
+ call->copy_subresource_region_info.dst_x,
|
||||
+ call->copy_subresource_region_info.dst_y,
|
||||
+ call->copy_subresource_region_info.dst_z,
|
||||
+ call->copy_subresource_region_info.src_resource,
|
||||
+ call->copy_subresource_region_info.src_subresource_idx,
|
||||
+ call->copy_subresource_region_info.src_box);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
ID3D11DeviceContext1_CSSetShader(iface, call->cs_info.shader, NULL, 0);
|
||||
@@ -4555,10 +4588,37 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CopySubresourceRegion(ID3D1
|
||||
ID3D11Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
|
||||
ID3D11Resource *src_resource, UINT src_subresource_idx, const D3D11_BOX *src_box)
|
||||
{
|
||||
- FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u, "
|
||||
- "src_resource %p, src_subresource_idx %u, src_box %p stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u, "
|
||||
+ "src_resource %p, src_subresource_idx %u, src_box %p.\n",
|
||||
iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
|
||||
src_resource, src_subresource_idx, src_box);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, src_box ? sizeof(D3D11_BOX) : 0)))
|
||||
+ return;
|
||||
+
|
||||
+ if (dst_resource) ID3D11Resource_AddRef(dst_resource);
|
||||
+ if (src_resource) ID3D11Resource_AddRef(src_resource);
|
||||
+
|
||||
+ call->cmd = DEFERRED_COPYSUBRESOURCEREGION;
|
||||
+ call->copy_subresource_region_info.dst_resource = dst_resource;
|
||||
+ call->copy_subresource_region_info.dst_subresource_idx = dst_subresource_idx;
|
||||
+ call->copy_subresource_region_info.dst_x = dst_x;
|
||||
+ call->copy_subresource_region_info.dst_y = dst_y;
|
||||
+ call->copy_subresource_region_info.dst_z = dst_z;
|
||||
+ call->copy_subresource_region_info.src_resource = src_resource;
|
||||
+ call->copy_subresource_region_info.src_subresource_idx = src_subresource_idx;
|
||||
+ if (src_box)
|
||||
+ {
|
||||
+ call->copy_subresource_region_info.src_box = (void *)(call + 1);
|
||||
+ *call->copy_subresource_region_info.src_box = *src_box;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ call->copy_subresource_region_info.src_box = NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_CopyResource(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,100 +0,0 @@
|
||||
From c040d0aaf9fb1cff798a5c632b4f18f0c12e8282 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 02:30:32 +0200
|
||||
Subject: [PATCH] d3d11: Implement ResolveSubresource for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 47 +++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 45 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 0c5360a..5709bf0 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -43,6 +43,7 @@ enum deferred_cmd
|
||||
DEFERRED_COPYRESOURCE, /* copy_resource_info */
|
||||
DEFERRED_SETRESOURCEMINLOD, /* set_resource_min_lod_info */
|
||||
DEFERRED_COPYSUBRESOURCEREGION, /* copy_subresource_region_info */
|
||||
+ DEFERRED_RESOLVESUBRESOURCE, /* resolve_subresource_info */
|
||||
|
||||
DEFERRED_CSSETSHADER, /* cs_info */
|
||||
DEFERRED_DSSETSHADER, /* ds_info */
|
||||
@@ -166,6 +167,14 @@ struct deferred_call
|
||||
} copy_subresource_region_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11Resource *dst_resource;
|
||||
+ UINT dst_subresource_idx;
|
||||
+ ID3D11Resource *src_resource;
|
||||
+ UINT src_subresource_idx;
|
||||
+ DXGI_FORMAT format;
|
||||
+ } resolve_subresource_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11ComputeShader *shader;
|
||||
/* FIXME: add class instances */
|
||||
} cs_info;
|
||||
@@ -463,6 +472,14 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11Resource_Release(call->copy_subresource_region_info.src_resource);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_RESOLVESUBRESOURCE:
|
||||
+ {
|
||||
+ if (call->resolve_subresource_info.dst_resource)
|
||||
+ ID3D11Resource_Release(call->resolve_subresource_info.dst_resource);
|
||||
+ if (call->resolve_subresource_info.src_resource)
|
||||
+ ID3D11Resource_Release(call->resolve_subresource_info.src_resource);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
if (call->cs_info.shader)
|
||||
@@ -687,6 +704,16 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->copy_subresource_region_info.src_box);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_RESOLVESUBRESOURCE:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_ResolveSubresource(iface,
|
||||
+ call->resolve_subresource_info.dst_resource,
|
||||
+ call->resolve_subresource_info.dst_subresource_idx,
|
||||
+ call->resolve_subresource_info.src_resource,
|
||||
+ call->resolve_subresource_info.src_subresource_idx,
|
||||
+ call->resolve_subresource_info.format);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
ID3D11DeviceContext1_CSSetShader(iface, call->cs_info.shader, NULL, 0);
|
||||
@@ -4745,10 +4772,26 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_ResolveSubresource(ID3D11De
|
||||
ID3D11Resource *src_resource, UINT src_subresource_idx,
|
||||
DXGI_FORMAT format)
|
||||
{
|
||||
- FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, src_resource %p, src_subresource_idx %u, "
|
||||
- "format %s stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, dst_resource %p, dst_subresource_idx %u, src_resource %p, src_subresource_idx %u, "
|
||||
+ "format %s.\n",
|
||||
iface, dst_resource, dst_subresource_idx, src_resource, src_subresource_idx,
|
||||
debug_dxgi_format(format));
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ if (dst_resource) ID3D11Resource_AddRef(dst_resource);
|
||||
+ if (src_resource) ID3D11Resource_AddRef(src_resource);
|
||||
+
|
||||
+ call->cmd = DEFERRED_RESOLVESUBRESOURCE;
|
||||
+ call->resolve_subresource_info.dst_resource = dst_resource;
|
||||
+ call->resolve_subresource_info.dst_subresource_idx = dst_subresource_idx;
|
||||
+ call->resolve_subresource_info.src_resource = src_resource;
|
||||
+ call->resolve_subresource_info.src_subresource_idx = src_subresource_idx;
|
||||
+ call->resolve_subresource_info.format = format;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_ExecuteCommandList(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,92 +0,0 @@
|
||||
From 2b6928fe7faa40ff4e18508cffcea60d5156735f Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 02:33:19 +0200
|
||||
Subject: [PATCH] d3d11: Implement CopyStructureCount for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 41 +++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 39 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 5709bf0..4241b5a 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -44,6 +44,7 @@ enum deferred_cmd
|
||||
DEFERRED_SETRESOURCEMINLOD, /* set_resource_min_lod_info */
|
||||
DEFERRED_COPYSUBRESOURCEREGION, /* copy_subresource_region_info */
|
||||
DEFERRED_RESOLVESUBRESOURCE, /* resolve_subresource_info */
|
||||
+ DEFERRED_COPYSTRUCTURECOUNT, /* copy_structure_count_info */
|
||||
|
||||
DEFERRED_CSSETSHADER, /* cs_info */
|
||||
DEFERRED_DSSETSHADER, /* ds_info */
|
||||
@@ -175,6 +176,12 @@ struct deferred_call
|
||||
} resolve_subresource_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11Buffer *dst_buffer;
|
||||
+ UINT dst_offset;
|
||||
+ ID3D11UnorderedAccessView *src_view;
|
||||
+ } copy_structure_count_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11ComputeShader *shader;
|
||||
/* FIXME: add class instances */
|
||||
} cs_info;
|
||||
@@ -480,6 +487,14 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11Resource_Release(call->resolve_subresource_info.src_resource);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_COPYSTRUCTURECOUNT:
|
||||
+ {
|
||||
+ if (call->copy_structure_count_info.dst_buffer)
|
||||
+ ID3D11Buffer_Release(call->copy_structure_count_info.dst_buffer);
|
||||
+ if (call->copy_structure_count_info.src_view)
|
||||
+ ID3D11UnorderedAccessView_Release(call->copy_structure_count_info.src_view);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
if (call->cs_info.shader)
|
||||
@@ -714,6 +729,14 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->resolve_subresource_info.format);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_COPYSTRUCTURECOUNT:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_CopyStructureCount(iface,
|
||||
+ call->copy_structure_count_info.dst_buffer,
|
||||
+ call->copy_structure_count_info.dst_offset,
|
||||
+ call->copy_structure_count_info.src_view);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
ID3D11DeviceContext1_CSSetShader(iface, call->cs_info.shader, NULL, 0);
|
||||
@@ -4678,8 +4701,22 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_UpdateSubresource(ID3D11Dev
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_CopyStructureCount(ID3D11DeviceContext *iface,
|
||||
ID3D11Buffer *dst_buffer, UINT dst_offset, ID3D11UnorderedAccessView *src_view)
|
||||
{
|
||||
- FIXME("iface %p, dst_buffer %p, dst_offset %u, src_view %p stub!\n",
|
||||
- iface, dst_buffer, dst_offset, src_view);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, dst_buffer %p, dst_offset %u, src_view %p.\n",
|
||||
+ iface, dst_buffer, dst_offset, src_view);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ if (dst_buffer) ID3D11Buffer_AddRef(dst_buffer);
|
||||
+ if (src_view) ID3D11UnorderedAccessView_AddRef(src_view);
|
||||
+
|
||||
+ call->cmd = DEFERRED_COPYSTRUCTURECOUNT;
|
||||
+ call->copy_structure_count_info.dst_buffer = dst_buffer;
|
||||
+ call->copy_structure_count_info.dst_offset = dst_offset;
|
||||
+ call->copy_structure_count_info.src_view = src_view;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_ClearRenderTargetView(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,64 +0,0 @@
|
||||
From 9fd40c39a1e0aa31779433c7e9d36aeade1ed91b Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Thu, 31 Aug 2017 20:40:30 +0200
|
||||
Subject: [PATCH] d3d11: Implement DrawAuto for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 20 +++++++++++++++++++-
|
||||
1 file changed, 19 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 4241b5a..57149f5 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -79,6 +79,7 @@ enum deferred_cmd
|
||||
DEFERRED_DRAW, /* draw_info */
|
||||
DEFERRED_DRAWINDEXED, /* draw_indexed_info */
|
||||
DEFERRED_DRAWINDEXEDINSTANCED, /* draw_indexed_inst_info */
|
||||
+ DEFERRED_DRAWAUTO,
|
||||
|
||||
DEFERRED_MAP, /* map_info */
|
||||
DEFERRED_DISPATCH, /* dispatch_info */
|
||||
@@ -588,6 +589,10 @@ static void free_deferred_calls(struct list *commands)
|
||||
{
|
||||
break; /* nothing to do */
|
||||
}
|
||||
+ case DEFERRED_DRAWAUTO:
|
||||
+ {
|
||||
+ break; /* nothing to do */
|
||||
+ }
|
||||
case DEFERRED_MAP:
|
||||
{
|
||||
ID3D11Resource_Release(call->map_info.resource);
|
||||
@@ -899,6 +904,11 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->draw_indexed_inst_info.base_vertex, call->draw_indexed_inst_info.start_instance);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_DRAWAUTO:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_DrawAuto(iface);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_MAP:
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE mapped;
|
||||
@@ -4556,7 +4566,15 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_SOSetTargets(ID3D11DeviceCo
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawAuto(ID3D11DeviceContext *iface)
|
||||
{
|
||||
- FIXME("iface %p stub!\n", iface);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p.\n", iface);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_DRAWAUTO;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawIndexedInstancedIndirect(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,90 +0,0 @@
|
||||
From fd0ce81e3dcf27aef0d4ad4e8273449a7554a394 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 02:41:23 +0200
|
||||
Subject: [PATCH] d3d11: Implement DrawInstanced for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 37 +++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 35 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 57149f5..7992e39 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -80,6 +80,7 @@ enum deferred_cmd
|
||||
DEFERRED_DRAWINDEXED, /* draw_indexed_info */
|
||||
DEFERRED_DRAWINDEXEDINSTANCED, /* draw_indexed_inst_info */
|
||||
DEFERRED_DRAWAUTO,
|
||||
+ DEFERRED_DRAWINSTANCED, /* draw_instanced_info */
|
||||
|
||||
DEFERRED_MAP, /* map_info */
|
||||
DEFERRED_DISPATCH, /* dispatch_info */
|
||||
@@ -257,6 +258,13 @@ struct deferred_call
|
||||
} draw_indexed_inst_info;
|
||||
struct
|
||||
{
|
||||
+ UINT instance_vertex_count;
|
||||
+ UINT instance_count;
|
||||
+ UINT start_vertex_location;
|
||||
+ UINT start_instance_location;
|
||||
+ } draw_instanced_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11Resource *resource;
|
||||
UINT subresource_idx;
|
||||
D3D11_MAP map_type;
|
||||
@@ -593,6 +601,10 @@ static void free_deferred_calls(struct list *commands)
|
||||
{
|
||||
break; /* nothing to do */
|
||||
}
|
||||
+ case DEFERRED_DRAWINSTANCED:
|
||||
+ {
|
||||
+ break; /* nothing to do */
|
||||
+ }
|
||||
case DEFERRED_MAP:
|
||||
{
|
||||
ID3D11Resource_Release(call->map_info.resource);
|
||||
@@ -909,6 +921,15 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
ID3D11DeviceContext1_DrawAuto(iface);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_DRAWINSTANCED:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_DrawInstanced(iface,
|
||||
+ call->draw_instanced_info.instance_vertex_count,
|
||||
+ call->draw_instanced_info.instance_count,
|
||||
+ call->draw_instanced_info.start_vertex_location,
|
||||
+ call->draw_instanced_info.start_instance_location);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_MAP:
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE mapped;
|
||||
@@ -4333,10 +4354,22 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DrawIndexedInstanced(ID3D11
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawInstanced(ID3D11DeviceContext *iface,
|
||||
UINT instance_vertex_count, UINT instance_count, UINT start_vertex_location, UINT start_instance_location)
|
||||
{
|
||||
- FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u, "
|
||||
- "start_instance_location %u stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u, "
|
||||
+ "start_instance_location %u.\n",
|
||||
iface, instance_vertex_count, instance_count, start_vertex_location,
|
||||
start_instance_location);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_DRAWINSTANCED;
|
||||
+ call->draw_instanced_info.instance_vertex_count = instance_vertex_count;
|
||||
+ call->draw_instanced_info.instance_count = instance_count;
|
||||
+ call->draw_instanced_info.start_vertex_location = start_vertex_location;
|
||||
+ call->draw_instanced_info.start_instance_location = start_instance_location;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetConstantBuffers(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,83 +0,0 @@
|
||||
From 7943656bfca79d996af984a1a8f9dadaf63aa079 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 02:44:05 +0200
|
||||
Subject: [PATCH] d3d11: Implement DrawInstancedIndirect for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 32 +++++++++++++++++++++++++++++++-
|
||||
1 file changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 7992e39..047b38f 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -81,6 +81,7 @@ enum deferred_cmd
|
||||
DEFERRED_DRAWINDEXEDINSTANCED, /* draw_indexed_inst_info */
|
||||
DEFERRED_DRAWAUTO,
|
||||
DEFERRED_DRAWINSTANCED, /* draw_instanced_info */
|
||||
+ DEFERRED_DRAWINSTANCEDINDIRECT, /* draw_instanced_indirect_info */
|
||||
|
||||
DEFERRED_MAP, /* map_info */
|
||||
DEFERRED_DISPATCH, /* dispatch_info */
|
||||
@@ -265,6 +266,11 @@ struct deferred_call
|
||||
} draw_instanced_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11Buffer *buffer;
|
||||
+ UINT offset;
|
||||
+ } draw_instanced_indirect_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11Resource *resource;
|
||||
UINT subresource_idx;
|
||||
D3D11_MAP map_type;
|
||||
@@ -605,6 +611,12 @@ static void free_deferred_calls(struct list *commands)
|
||||
{
|
||||
break; /* nothing to do */
|
||||
}
|
||||
+ case DEFERRED_DRAWINSTANCEDINDIRECT:
|
||||
+ {
|
||||
+ if (call->draw_instanced_indirect_info.buffer)
|
||||
+ ID3D11Buffer_Release(call->draw_instanced_indirect_info.buffer);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_MAP:
|
||||
{
|
||||
ID3D11Resource_Release(call->map_info.resource);
|
||||
@@ -930,6 +942,13 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->draw_instanced_info.start_instance_location);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_DRAWINSTANCEDINDIRECT:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_DrawInstancedIndirect(iface,
|
||||
+ call->draw_instanced_indirect_info.buffer,
|
||||
+ call->draw_instanced_indirect_info.offset);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_MAP:
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE mapped;
|
||||
@@ -4619,7 +4638,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DrawIndexedInstancedIndirec
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawInstancedIndirect(ID3D11DeviceContext *iface,
|
||||
ID3D11Buffer *buffer, UINT offset)
|
||||
{
|
||||
- FIXME("iface %p, buffer %p, offset %u stub!\n", iface, buffer, offset);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, buffer %p, offset %u.\n", iface, buffer, offset);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_DRAWINSTANCEDINDIRECT;
|
||||
+ if (buffer) ID3D11Buffer_AddRef(buffer);
|
||||
+ call->draw_instanced_indirect_info.buffer = buffer;
|
||||
+ call->draw_instanced_indirect_info.offset = offset;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_Dispatch(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,67 +0,0 @@
|
||||
From 8ad3ec7108bae678a090ae8daee13ccc6f3e581d Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 02:49:31 +0200
|
||||
Subject: [PATCH] d3d11: Implement DrawIndexedInstancedIndirect for deferred
|
||||
contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 22 +++++++++++++++++++++-
|
||||
1 file changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 047b38f..d2ac3a8 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -82,6 +82,7 @@ enum deferred_cmd
|
||||
DEFERRED_DRAWAUTO,
|
||||
DEFERRED_DRAWINSTANCED, /* draw_instanced_info */
|
||||
DEFERRED_DRAWINSTANCEDINDIRECT, /* draw_instanced_indirect_info */
|
||||
+ DEFERRED_DRAWINDEXEDINSTANCEDINDIRECT, /* draw_instanced_indirect_info */
|
||||
|
||||
DEFERRED_MAP, /* map_info */
|
||||
DEFERRED_DISPATCH, /* dispatch_info */
|
||||
@@ -612,6 +613,7 @@ static void free_deferred_calls(struct list *commands)
|
||||
break; /* nothing to do */
|
||||
}
|
||||
case DEFERRED_DRAWINSTANCEDINDIRECT:
|
||||
+ case DEFERRED_DRAWINDEXEDINSTANCEDINDIRECT:
|
||||
{
|
||||
if (call->draw_instanced_indirect_info.buffer)
|
||||
ID3D11Buffer_Release(call->draw_instanced_indirect_info.buffer);
|
||||
@@ -949,6 +951,13 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->draw_instanced_indirect_info.offset);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_DRAWINDEXEDINSTANCEDINDIRECT:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_DrawIndexedInstancedIndirect(iface,
|
||||
+ call->draw_instanced_indirect_info.buffer,
|
||||
+ call->draw_instanced_indirect_info.offset);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_MAP:
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE mapped;
|
||||
@@ -4632,7 +4641,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DrawAuto(ID3D11DeviceContex
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawIndexedInstancedIndirect(ID3D11DeviceContext *iface,
|
||||
ID3D11Buffer *buffer, UINT offset)
|
||||
{
|
||||
- FIXME("iface %p, buffer %p, offset %u stub!\n", iface, buffer, offset);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, buffer %p, offset %u.\n", iface, buffer, offset);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_DRAWINDEXEDINSTANCEDINDIRECT;
|
||||
+ if (buffer) ID3D11Buffer_AddRef(buffer);
|
||||
+ call->draw_instanced_indirect_info.buffer = buffer;
|
||||
+ call->draw_instanced_indirect_info.offset = offset;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawInstancedIndirect(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,87 +0,0 @@
|
||||
From 957497472a02cda0e6af687ce7eb4e30dee724f9 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Thu, 31 Aug 2017 20:49:47 +0200
|
||||
Subject: [PATCH] d3d11: Implement ClearUnorderedAccessViewUint for deferred
|
||||
contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 34 +++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 33 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index d2ac3a8..c1a3ab2 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -90,6 +90,7 @@ enum deferred_cmd
|
||||
DEFERRED_CLEARSTATE,
|
||||
DEFERRED_CLEARRENDERTARGETVIEW, /* clear_rtv_info */
|
||||
DEFERRED_CLEARDEPTHSTENCILVIEW, /* clear_depth_info */
|
||||
+ DEFERRED_CLEARUNORDEREDACCESSVIEWUINT, /* clear_unordered_access_view_uint */
|
||||
|
||||
DEFERRED_BEGIN, /* async_info */
|
||||
DEFERRED_END, /* async_info */
|
||||
@@ -299,6 +300,11 @@ struct deferred_call
|
||||
} clear_depth_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11UnorderedAccessView *unordered_access_view;
|
||||
+ UINT values[4];
|
||||
+ } clear_unordered_access_view_uint;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11Asynchronous *asynchronous;
|
||||
} async_info;
|
||||
};
|
||||
@@ -644,6 +650,12 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11DepthStencilView_Release(call->clear_depth_info.view);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_CLEARUNORDEREDACCESSVIEWUINT:
|
||||
+ {
|
||||
+ if (call->clear_unordered_access_view_uint.unordered_access_view)
|
||||
+ ID3D11UnorderedAccessView_Release(call->clear_unordered_access_view_uint.unordered_access_view);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_BEGIN:
|
||||
case DEFERRED_END:
|
||||
{
|
||||
@@ -999,6 +1011,13 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->clear_depth_info.stencil);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_CLEARUNORDEREDACCESSVIEWUINT:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_ClearUnorderedAccessViewUint(iface,
|
||||
+ call->clear_unordered_access_view_uint.unordered_access_view,
|
||||
+ call->clear_unordered_access_view_uint.values);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_BEGIN:
|
||||
{
|
||||
ID3D11DeviceContext1_Begin(iface, call->async_info.asynchronous);
|
||||
@@ -4843,8 +4862,21 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_ClearRenderTargetView(ID3D1
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_ClearUnorderedAccessViewUint(ID3D11DeviceContext *iface,
|
||||
ID3D11UnorderedAccessView *unordered_access_view, const UINT values[4])
|
||||
{
|
||||
- FIXME("iface %p, unordered_access_view %p, values {%u %u %u %u} stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+ int i;
|
||||
+
|
||||
+ TRACE("iface %p, unordered_access_view %p, values {%u %u %u %u}.\n",
|
||||
iface, unordered_access_view, values[0], values[1], values[2], values[3]);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_CLEARUNORDEREDACCESSVIEWUINT;
|
||||
+ if (unordered_access_view) ID3D11UnorderedAccessView_AddRef(unordered_access_view);
|
||||
+ call->clear_unordered_access_view_uint.unordered_access_view = unordered_access_view;
|
||||
+ for (i = 0; i < 4; i++)
|
||||
+ call->clear_unordered_access_view_uint.values[i] = values[i];
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_ClearUnorderedAccessViewFloat(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,87 +0,0 @@
|
||||
From 4aea5432ad3d6d7ee7770b166ade51dcd0835704 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 02:56:57 +0200
|
||||
Subject: [PATCH] d3d11: Implement ClearUnorderedAccessViewFloat for deferred
|
||||
contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 34 +++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 33 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index c1a3ab2..5753855 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -91,6 +91,7 @@ enum deferred_cmd
|
||||
DEFERRED_CLEARRENDERTARGETVIEW, /* clear_rtv_info */
|
||||
DEFERRED_CLEARDEPTHSTENCILVIEW, /* clear_depth_info */
|
||||
DEFERRED_CLEARUNORDEREDACCESSVIEWUINT, /* clear_unordered_access_view_uint */
|
||||
+ DEFERRED_CLEARUNORDEREDACCESSVIEWFLOAT, /* clear_unordered_access_view_float */
|
||||
|
||||
DEFERRED_BEGIN, /* async_info */
|
||||
DEFERRED_END, /* async_info */
|
||||
@@ -305,6 +306,11 @@ struct deferred_call
|
||||
} clear_unordered_access_view_uint;
|
||||
struct
|
||||
{
|
||||
+ ID3D11UnorderedAccessView *unordered_access_view;
|
||||
+ float values[4];
|
||||
+ } clear_unordered_access_view_float;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11Asynchronous *asynchronous;
|
||||
} async_info;
|
||||
};
|
||||
@@ -656,6 +662,12 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11UnorderedAccessView_Release(call->clear_unordered_access_view_uint.unordered_access_view);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_CLEARUNORDEREDACCESSVIEWFLOAT:
|
||||
+ {
|
||||
+ if (call->clear_unordered_access_view_float.unordered_access_view)
|
||||
+ ID3D11UnorderedAccessView_Release(call->clear_unordered_access_view_float.unordered_access_view);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_BEGIN:
|
||||
case DEFERRED_END:
|
||||
{
|
||||
@@ -1018,6 +1030,13 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->clear_unordered_access_view_uint.values);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_CLEARUNORDEREDACCESSVIEWFLOAT:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_ClearUnorderedAccessViewFloat(iface,
|
||||
+ call->clear_unordered_access_view_float.unordered_access_view,
|
||||
+ call->clear_unordered_access_view_float.values);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_BEGIN:
|
||||
{
|
||||
ID3D11DeviceContext1_Begin(iface, call->async_info.asynchronous);
|
||||
@@ -4882,8 +4901,21 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_ClearUnorderedAccessViewUin
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_ClearUnorderedAccessViewFloat(ID3D11DeviceContext *iface,
|
||||
ID3D11UnorderedAccessView *unordered_access_view, const float values[4])
|
||||
{
|
||||
- FIXME("iface %p, unordered_access_view %p, values %s stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+ int i;
|
||||
+
|
||||
+ TRACE("iface %p, unordered_access_view %p, values %s.\n",
|
||||
iface, unordered_access_view, debug_float4(values));
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_CLEARUNORDEREDACCESSVIEWFLOAT;
|
||||
+ if (unordered_access_view) ID3D11UnorderedAccessView_AddRef(unordered_access_view);
|
||||
+ call->clear_unordered_access_view_float.unordered_access_view = unordered_access_view;
|
||||
+ for (i = 0; i < 4; i++)
|
||||
+ call->clear_unordered_access_view_float.values[i] = values[i];
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_ClearDepthStencilView(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,81 +0,0 @@
|
||||
From d527ab4f6f5a9b027b6693eb1db71aa3390fed20 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Thu, 31 Aug 2017 20:57:55 +0200
|
||||
Subject: [PATCH] d3d11: Implement RsSetScissorRects 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 5753855..b63f344 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -35,6 +35,7 @@ enum deferred_cmd
|
||||
|
||||
DEFERRED_RSSETSTATE, /* rstate_info */
|
||||
DEFERRED_RSSETVIEWPORTS, /* viewport_info */
|
||||
+ DEFERRED_RSSETSCISSORRECTS, /* rs_set_scissor_rects_info */
|
||||
|
||||
DEFERRED_OMSETDEPTHSTENCILSTATE, /* stencil_state_info */
|
||||
DEFERRED_OMSETBLENDSTATE, /* blend_state_info */
|
||||
@@ -131,6 +132,11 @@ struct deferred_call
|
||||
} rstate_info;
|
||||
struct
|
||||
{
|
||||
+ UINT rect_count;
|
||||
+ D3D11_RECT *rects;
|
||||
+ } rs_set_scissor_rects_info;
|
||||
+ struct
|
||||
+ {
|
||||
UINT num_viewports;
|
||||
D3D11_VIEWPORT *viewports;
|
||||
} viewport_info;
|
||||
@@ -462,6 +468,10 @@ static void free_deferred_calls(struct list *commands)
|
||||
{
|
||||
break; /* nothing to do */
|
||||
}
|
||||
+ case DEFERRED_RSSETSCISSORRECTS:
|
||||
+ {
|
||||
+ break; /* nothing to do */
|
||||
+ }
|
||||
case DEFERRED_OMSETDEPTHSTENCILSTATE:
|
||||
{
|
||||
if (call->stencil_state_info.state)
|
||||
@@ -729,6 +739,13 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->viewport_info.viewports);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_RSSETSCISSORRECTS:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_RSSetScissorRects(iface,
|
||||
+ call->rs_set_scissor_rects_info.rect_count,
|
||||
+ call->rs_set_scissor_rects_info.rects);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_OMSETDEPTHSTENCILSTATE:
|
||||
{
|
||||
ID3D11DeviceContext1_OMSetDepthStencilState(iface, call->stencil_state_info.state,
|
||||
@@ -4770,7 +4787,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_RSSetViewports(ID3D11Device
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_RSSetScissorRects(ID3D11DeviceContext *iface,
|
||||
UINT rect_count, const D3D11_RECT *rects)
|
||||
{
|
||||
- FIXME("iface %p, rect_count %u, rects %p stub!\n", iface, rect_count, rects);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, rect_count %u, rects %p.\n", iface, rect_count, rects);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, sizeof(D3D11_RECT) * rect_count)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_RSSETSCISSORRECTS;
|
||||
+ call->rs_set_scissor_rects_info.rects = (void *)(call + 1);
|
||||
+ call->rs_set_scissor_rects_info.rect_count = rect_count;
|
||||
+ memcpy(call->rs_set_scissor_rects_info.rects, rects, sizeof(D3D11_RECT) * rect_count);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_CopySubresourceRegion(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,133 +0,0 @@
|
||||
From 3842fc233f25fb4aa07f142ca2a13a40979560fe Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 03:07:13 +0200
|
||||
Subject: [PATCH] d3d11: Implement OMSetRenderTargetsAndUnorderedAccessViews
|
||||
for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 75 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index b63f344..96dd4e1 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -40,6 +40,7 @@ enum deferred_cmd
|
||||
DEFERRED_OMSETDEPTHSTENCILSTATE, /* stencil_state_info */
|
||||
DEFERRED_OMSETBLENDSTATE, /* blend_state_info */
|
||||
DEFERRED_OMSETRENDERTARGETS, /* render_target_info */
|
||||
+ DEFERRED_OMSETRENDERTARGETSANDUNORDEREDACCESVIEWS, /* render_targets_and_unordered_access_views_info */
|
||||
|
||||
DEFERRED_COPYRESOURCE, /* copy_resource_info */
|
||||
DEFERRED_SETRESOURCEMINLOD, /* set_resource_min_lod_info */
|
||||
@@ -194,6 +195,16 @@ struct deferred_call
|
||||
} copy_structure_count_info;
|
||||
struct
|
||||
{
|
||||
+ UINT render_target_view_count;
|
||||
+ ID3D11RenderTargetView **render_target_views;
|
||||
+ ID3D11DepthStencilView *depth_stencil_view;
|
||||
+ UINT unordered_access_view_start_slot;
|
||||
+ UINT unordered_access_view_count;
|
||||
+ ID3D11UnorderedAccessView **unordered_access_views;
|
||||
+ UINT *initial_counts;
|
||||
+ } render_targets_and_unordered_access_views_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11ComputeShader *shader;
|
||||
/* FIXME: add class instances */
|
||||
} cs_info;
|
||||
@@ -495,6 +506,22 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11DepthStencilView_Release(call->render_target_info.depth_stencil);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_OMSETRENDERTARGETSANDUNORDEREDACCESVIEWS:
|
||||
+ {
|
||||
+ for (i = 0; i < call->render_targets_and_unordered_access_views_info.render_target_view_count; i++)
|
||||
+ {
|
||||
+ if (call->render_targets_and_unordered_access_views_info.render_target_views[i])
|
||||
+ ID3D11RenderTargetView_Release(call->render_targets_and_unordered_access_views_info.render_target_views[i]);
|
||||
+ }
|
||||
+ if (call->render_targets_and_unordered_access_views_info.depth_stencil_view)
|
||||
+ ID3D11DepthStencilView_Release(call->render_targets_and_unordered_access_views_info.depth_stencil_view);
|
||||
+ for (i = 0; i < call->render_targets_and_unordered_access_views_info.unordered_access_view_count; i++)
|
||||
+ {
|
||||
+ if (call->render_targets_and_unordered_access_views_info.unordered_access_views[i])
|
||||
+ ID3D11UnorderedAccessView_Release(call->render_targets_and_unordered_access_views_info.unordered_access_views[i]);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_COPYRESOURCE:
|
||||
{
|
||||
if (call->copy_resource_info.dst_resource)
|
||||
@@ -764,6 +791,18 @@ 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_OMSETRENDERTARGETSANDUNORDEREDACCESVIEWS:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_OMSetRenderTargetsAndUnorderedAccessViews(iface,
|
||||
+ call->render_targets_and_unordered_access_views_info.render_target_view_count,
|
||||
+ call->render_targets_and_unordered_access_views_info.render_target_views,
|
||||
+ call->render_targets_and_unordered_access_views_info.depth_stencil_view,
|
||||
+ call->render_targets_and_unordered_access_views_info.unordered_access_view_start_slot,
|
||||
+ call->render_targets_and_unordered_access_views_info.unordered_access_view_count,
|
||||
+ call->render_targets_and_unordered_access_views_info.unordered_access_views,
|
||||
+ call->render_targets_and_unordered_access_views_info.initial_counts);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_COPYRESOURCE:
|
||||
{
|
||||
ID3D11DeviceContext1_CopyResource(iface,
|
||||
@@ -4623,12 +4662,46 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargetsAndUnorde
|
||||
UINT unordered_access_view_start_slot, UINT unordered_access_view_count,
|
||||
ID3D11UnorderedAccessView *const *unordered_access_views, const UINT *initial_counts)
|
||||
{
|
||||
- FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p, "
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+ UINT i;
|
||||
+
|
||||
+ TRACE("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p, "
|
||||
"unordered_access_view_start_slot %u, unordered_access_view_count %u, unordered_access_views %p, "
|
||||
- "initial_counts %p stub!\n",
|
||||
+ "initial_counts %p.\n",
|
||||
iface, render_target_view_count, render_target_views, depth_stencil_view,
|
||||
unordered_access_view_start_slot, unordered_access_view_count, unordered_access_views,
|
||||
initial_counts);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, sizeof(ID3D11RenderTargetView *) * render_target_view_count +
|
||||
+ (sizeof(ID3D11UnorderedAccessView *) + sizeof(UINT)) * unordered_access_view_count)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_OMSETRENDERTARGETSANDUNORDEREDACCESVIEWS;
|
||||
+ call->render_targets_and_unordered_access_views_info.render_target_view_count = render_target_view_count;
|
||||
+ call->render_targets_and_unordered_access_views_info.unordered_access_view_start_slot = unordered_access_view_start_slot;
|
||||
+ call->render_targets_and_unordered_access_views_info.unordered_access_view_count = unordered_access_view_count;
|
||||
+
|
||||
+ if (depth_stencil_view) ID3D11DepthStencilView_AddRef(depth_stencil_view);
|
||||
+ call->render_targets_and_unordered_access_views_info.depth_stencil_view = depth_stencil_view;
|
||||
+
|
||||
+ call->render_targets_and_unordered_access_views_info.render_target_views = (void *)(call + 1);
|
||||
+ call->render_targets_and_unordered_access_views_info.unordered_access_views =
|
||||
+ (void *)&call->render_targets_and_unordered_access_views_info.render_target_views[render_target_view_count];
|
||||
+ call->render_targets_and_unordered_access_views_info.initial_counts = initial_counts ?
|
||||
+ (void *)&call->render_targets_and_unordered_access_views_info.unordered_access_views[unordered_access_view_count] : NULL;
|
||||
+
|
||||
+ for (i = 0; i < render_target_view_count; i++)
|
||||
+ {
|
||||
+ if (render_target_views[i]) ID3D11RenderTargetView_AddRef(render_target_views[i]);
|
||||
+ call->render_targets_and_unordered_access_views_info.render_target_views[i] = render_target_views[i];
|
||||
+ }
|
||||
+ for (i = 0; i < unordered_access_view_count; i++)
|
||||
+ {
|
||||
+ if (unordered_access_views[i]) ID3D11UnorderedAccessView_AddRef(unordered_access_views[i]);
|
||||
+ call->render_targets_and_unordered_access_views_info.unordered_access_views[i] = unordered_access_views[i];
|
||||
+ if (initial_counts) call->render_targets_and_unordered_access_views_info.initial_counts[i] = initial_counts[i];
|
||||
+ }
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetBlendState(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,101 +0,0 @@
|
||||
From bc87e99378af8515cfd0a409cb209d33a82ea9ae Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 04:15:31 +0200
|
||||
Subject: [PATCH] d3d11: Implement SOSetTargets for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 46 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 96dd4e1..728a90b 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -77,6 +77,7 @@ enum deferred_cmd
|
||||
DEFERRED_VSSETCONSTANTBUFFERS, /* constant_buffers_info */
|
||||
|
||||
DEFERRED_CSSETUNORDEREDACCESSVIEWS, /* unordered_view */
|
||||
+ DEFERRED_SOSETTARGETS, /* so_set_targets_info */
|
||||
|
||||
DEFERRED_DRAW, /* draw_info */
|
||||
DEFERRED_DRAWINDEXED, /* draw_indexed_info */
|
||||
@@ -205,6 +206,12 @@ struct deferred_call
|
||||
} render_targets_and_unordered_access_views_info;
|
||||
struct
|
||||
{
|
||||
+ UINT buffer_count;
|
||||
+ ID3D11Buffer **buffers;
|
||||
+ UINT *offsets;
|
||||
+ } so_set_targets_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11ComputeShader *shader;
|
||||
/* FIXME: add class instances */
|
||||
} cs_info;
|
||||
@@ -647,6 +654,15 @@ static void free_deferred_calls(struct list *commands)
|
||||
}
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_SOSETTARGETS:
|
||||
+ {
|
||||
+ for (i = 0; i < call->so_set_targets_info.buffer_count; i++)
|
||||
+ {
|
||||
+ if (call->so_set_targets_info.buffers[i])
|
||||
+ ID3D11Buffer_Release(call->so_set_targets_info.buffers[i]);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_DRAW:
|
||||
case DEFERRED_DRAWINDEXED:
|
||||
case DEFERRED_DRAWINDEXEDINSTANCED:
|
||||
@@ -992,6 +1008,14 @@ 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_SOSETTARGETS:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_SOSetTargets(iface,
|
||||
+ call->so_set_targets_info.buffer_count,
|
||||
+ call->so_set_targets_info.buffers,
|
||||
+ call->so_set_targets_info.offsets);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_DRAW:
|
||||
{
|
||||
ID3D11DeviceContext1_Draw(iface, call->draw_info.count, call->draw_info.start);
|
||||
@@ -4747,10 +4771,29 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetDepthStencilState(ID3D
|
||||
call->stencil_state_info.stencil_ref = stencil_ref;
|
||||
}
|
||||
|
||||
-static void STDMETHODCALLTYPE d3d11_deferred_context_SOSetTargets(ID3D11DeviceContext *iface, UINT buffer_count,
|
||||
- ID3D11Buffer *const *buffers, const UINT *offsets)
|
||||
+static void STDMETHODCALLTYPE d3d11_deferred_context_SOSetTargets(ID3D11DeviceContext *iface,
|
||||
+ UINT buffer_count, ID3D11Buffer *const *buffers, const UINT *offsets)
|
||||
{
|
||||
- FIXME("iface %p, buffer_count %u, buffers %p, offsets %p stub!\n", iface, buffer_count, buffers, offsets);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+ UINT i;
|
||||
+
|
||||
+ TRACE("iface %p, buffer_count %u, buffers %p, offsets %p.\n", iface, buffer_count, buffers, offsets);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, (sizeof(ID3D11Buffer *) + sizeof(UINT)) * buffer_count)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_SOSETTARGETS;
|
||||
+ call->so_set_targets_info.buffer_count = buffer_count;
|
||||
+ call->so_set_targets_info.buffers = (void *)(call + 1);
|
||||
+ call->so_set_targets_info.offsets = (void *)&call->so_set_targets_info.buffers[buffer_count];
|
||||
+
|
||||
+ for (i = 0; i < buffer_count; i++)
|
||||
+ {
|
||||
+ if (buffers[i]) ID3D11Buffer_AddRef(buffers[i]);
|
||||
+ call->so_set_targets_info.buffers[i] = buffers[i];
|
||||
+ call->so_set_targets_info.offsets[i] = offsets[i];
|
||||
+ }
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawAuto(ID3D11DeviceContext *iface)
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,80 +0,0 @@
|
||||
From 046d182f348f916b9e1531a14380420944b714a3 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 04:19:55 +0200
|
||||
Subject: [PATCH] d3d11: Implement GenerateMips 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 728a90b..1ed5010 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -78,6 +78,7 @@ enum deferred_cmd
|
||||
|
||||
DEFERRED_CSSETUNORDEREDACCESSVIEWS, /* unordered_view */
|
||||
DEFERRED_SOSETTARGETS, /* so_set_targets_info */
|
||||
+ DEFERRED_GENERATEMIPS, /* generate_mips_info */
|
||||
|
||||
DEFERRED_DRAW, /* draw_info */
|
||||
DEFERRED_DRAWINDEXED, /* draw_indexed_info */
|
||||
@@ -313,6 +314,10 @@ struct deferred_call
|
||||
} dispatch_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11ShaderResourceView *view;
|
||||
+ } generate_mips_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11RenderTargetView *rtv;
|
||||
float color[4];
|
||||
} clear_rtv_info;
|
||||
@@ -663,6 +668,12 @@ static void free_deferred_calls(struct list *commands)
|
||||
}
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_GENERATEMIPS:
|
||||
+ {
|
||||
+ if (call->generate_mips_info.view)
|
||||
+ ID3D11ShaderResourceView_Release(call->generate_mips_info.view);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_DRAW:
|
||||
case DEFERRED_DRAWINDEXED:
|
||||
case DEFERRED_DRAWINDEXEDINSTANCED:
|
||||
@@ -1016,6 +1027,12 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->so_set_targets_info.offsets);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_GENERATEMIPS:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_GenerateMips(iface,
|
||||
+ call->generate_mips_info.view);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_DRAW:
|
||||
{
|
||||
ID3D11DeviceContext1_Draw(iface, call->draw_info.count, call->draw_info.start);
|
||||
@@ -5085,7 +5102,17 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_ClearDepthStencilView(ID3D1
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_GenerateMips(ID3D11DeviceContext *iface,
|
||||
ID3D11ShaderResourceView *view)
|
||||
{
|
||||
- FIXME("iface %p, view %p stub!\n", iface, view);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, view %p.\n", iface, view);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_GENERATEMIPS;
|
||||
+ if (view) ID3D11ShaderResourceView_AddRef(view);
|
||||
+ call->generate_mips_info.view = view;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_SetResourceMinLOD(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,83 +0,0 @@
|
||||
From bcf5cc6f8d056a6406dccc301ce301ab8e063f56 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 04:22:04 +0200
|
||||
Subject: [PATCH] d3d11: Implement DispatchIndirect for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 32 +++++++++++++++++++++++++++++++-
|
||||
1 file changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 1ed5010..0f710a4 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -90,6 +90,7 @@ enum deferred_cmd
|
||||
|
||||
DEFERRED_MAP, /* map_info */
|
||||
DEFERRED_DISPATCH, /* dispatch_info */
|
||||
+ DEFERRED_DISPATCHINDIRECT, /* dispatch_indirect_info */
|
||||
|
||||
DEFERRED_CLEARSTATE,
|
||||
DEFERRED_CLEARRENDERTARGETVIEW, /* clear_rtv_info */
|
||||
@@ -314,6 +315,11 @@ struct deferred_call
|
||||
} dispatch_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11Buffer *buffer;
|
||||
+ UINT offset;
|
||||
+ } dispatch_indirect_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11ShaderResourceView *view;
|
||||
} generate_mips_info;
|
||||
struct
|
||||
@@ -704,6 +710,12 @@ static void free_deferred_calls(struct list *commands)
|
||||
{
|
||||
break; /* nothing to do */
|
||||
}
|
||||
+ case DEFERRED_DISPATCHINDIRECT:
|
||||
+ {
|
||||
+ if (call->dispatch_indirect_info.buffer)
|
||||
+ ID3D11Buffer_Release(call->dispatch_indirect_info.buffer);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CLEARSTATE:
|
||||
{
|
||||
break; /* nothing to do */
|
||||
@@ -1102,6 +1114,13 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->dispatch_info.count_y, call->dispatch_info.count_z);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_DISPATCHINDIRECT:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_DispatchIndirect(iface,
|
||||
+ call->dispatch_indirect_info.buffer,
|
||||
+ call->dispatch_indirect_info.offset);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CLEARSTATE:
|
||||
{
|
||||
ID3D11DeviceContext1_ClearState(iface);
|
||||
@@ -4881,7 +4900,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_Dispatch(ID3D11DeviceContex
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_DispatchIndirect(ID3D11DeviceContext *iface,
|
||||
ID3D11Buffer *buffer, UINT offset)
|
||||
{
|
||||
- FIXME("iface %p, buffer %p, offset %u stub!\n", iface, buffer, offset);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, buffer %p, offset %u.\n", iface, buffer, offset);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_DISPATCHINDIRECT;
|
||||
+ if (buffer) ID3D11Buffer_AddRef(buffer);
|
||||
+ call->dispatch_indirect_info.buffer = buffer;
|
||||
+ call->dispatch_indirect_info.offset = offset;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_RSSetState(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,83 +0,0 @@
|
||||
From 26b4142fd0a343616a72ddc01595ec66195fa11a Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Specht <jojos_band@gmx.net>
|
||||
Date: Mon, 4 Sep 2017 04:24:37 +0200
|
||||
Subject: [PATCH] d3d11: Implement SetPredication for deferred contexts.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 32 +++++++++++++++++++++++++++++++-
|
||||
1 file changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 0f710a4..c83d6a0 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -91,6 +91,7 @@ enum deferred_cmd
|
||||
DEFERRED_MAP, /* map_info */
|
||||
DEFERRED_DISPATCH, /* dispatch_info */
|
||||
DEFERRED_DISPATCHINDIRECT, /* dispatch_indirect_info */
|
||||
+ DEFERRED_SETPREDICATION, /* set_predication_info */
|
||||
|
||||
DEFERRED_CLEARSTATE,
|
||||
DEFERRED_CLEARRENDERTARGETVIEW, /* clear_rtv_info */
|
||||
@@ -320,6 +321,11 @@ struct deferred_call
|
||||
} dispatch_indirect_info;
|
||||
struct
|
||||
{
|
||||
+ ID3D11Predicate *predicate;
|
||||
+ BOOL value;
|
||||
+ } set_predication_info;
|
||||
+ struct
|
||||
+ {
|
||||
ID3D11ShaderResourceView *view;
|
||||
} generate_mips_info;
|
||||
struct
|
||||
@@ -716,6 +722,12 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11Buffer_Release(call->dispatch_indirect_info.buffer);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_SETPREDICATION:
|
||||
+ {
|
||||
+ if (call->set_predication_info.predicate)
|
||||
+ ID3D11Predicate_Release(call->set_predication_info.predicate);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CLEARSTATE:
|
||||
{
|
||||
break; /* nothing to do */
|
||||
@@ -1121,6 +1133,13 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->dispatch_indirect_info.offset);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_SETPREDICATION:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_SetPredication(iface,
|
||||
+ call->set_predication_info.predicate,
|
||||
+ call->set_predication_info.value);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CLEARSTATE:
|
||||
{
|
||||
ID3D11DeviceContext1_ClearState(iface);
|
||||
@@ -4663,7 +4682,18 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_GetData(ID3D11DeviceCont
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_SetPredication(ID3D11DeviceContext *iface,
|
||||
ID3D11Predicate *predicate, BOOL value)
|
||||
{
|
||||
- FIXME("iface %p, predicate %p, value %#x stub!\n", iface, predicate, value);
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct deferred_call *call;
|
||||
+
|
||||
+ TRACE("iface %p, predicate %p, value %#x.\n", iface, predicate, value);
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, 0)))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_SETPREDICATION;
|
||||
+ if (predicate) ID3D11Predicate_AddRef(predicate);
|
||||
+ call->set_predication_info.predicate = predicate;
|
||||
+ call->set_predication_info.value = value;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShaderResources(ID3D11DeviceContext *iface,
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,259 +0,0 @@
|
||||
From 8fe0dad5a51a6ddd712dfc87949e4b3d453c9e0f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Thu, 31 Aug 2017 05:04:15 +0200
|
||||
Subject: [PATCH] d3d11: Implement d3d11_deferred_context_UpdateSubresource.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 75 ++++++++++++++++++++++++++++++-
|
||||
dlls/wined3d/resource.c | 93 +++++++++++++++++++++++++++++++++++++++
|
||||
dlls/wined3d/wined3d.spec | 1 +
|
||||
include/wine/wined3d.h | 2 +
|
||||
4 files changed, 170 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 21da04547a6..70eecdd5a9e 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -69,6 +69,7 @@ enum deferred_cmd
|
||||
DEFERRED_COPYRESOURCE, /* copy_resource_info */
|
||||
DEFERRED_SETRESOURCEMINLOD, /* set_resource_min_lod_info */
|
||||
DEFERRED_COPYSUBRESOURCEREGION, /* copy_subresource_region_info */
|
||||
+ DEFERRED_UPDATESUBRESOURCE, /* update_subresource_info */
|
||||
DEFERRED_RESOLVESUBRESOURCE, /* resolve_subresource_info */
|
||||
DEFERRED_COPYSTRUCTURECOUNT, /* copy_structure_count_info */
|
||||
|
||||
@@ -208,6 +209,15 @@ struct deferred_call
|
||||
D3D11_BOX *src_box;
|
||||
} copy_subresource_region_info;
|
||||
struct
|
||||
+ {
|
||||
+ ID3D11Resource *resource;
|
||||
+ UINT subresource_idx;
|
||||
+ D3D11_BOX *box;
|
||||
+ void *data;
|
||||
+ UINT row_pitch;
|
||||
+ UINT depth_pitch;
|
||||
+ } update_subresource_info;
|
||||
+ struct
|
||||
{
|
||||
ID3D11Resource *dst_resource;
|
||||
UINT dst_subresource_idx;
|
||||
@@ -592,6 +602,12 @@ static void free_deferred_calls(struct list *commands)
|
||||
ID3D11Resource_Release(call->copy_subresource_region_info.src_resource);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_UPDATESUBRESOURCE:
|
||||
+ {
|
||||
+ if (call->update_subresource_info.resource)
|
||||
+ ID3D11Resource_Release(call->update_subresource_info.resource);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_RESOLVESUBRESOURCE:
|
||||
{
|
||||
if (call->resolve_subresource_info.dst_resource)
|
||||
@@ -923,6 +939,17 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
|
||||
call->copy_structure_count_info.src_view);
|
||||
break;
|
||||
}
|
||||
+ case DEFERRED_UPDATESUBRESOURCE:
|
||||
+ {
|
||||
+ ID3D11DeviceContext1_UpdateSubresource(iface,
|
||||
+ call->update_subresource_info.resource,
|
||||
+ call->update_subresource_info.subresource_idx,
|
||||
+ call->update_subresource_info.box,
|
||||
+ call->update_subresource_info.data,
|
||||
+ call->update_subresource_info.row_pitch,
|
||||
+ call->update_subresource_info.depth_pitch);
|
||||
+ break;
|
||||
+ }
|
||||
case DEFERRED_CSSETSHADER:
|
||||
{
|
||||
ID3D11DeviceContext1_CSSetShader(iface, call->cs_info.shader, NULL, 0);
|
||||
@@ -5281,8 +5308,54 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_UpdateSubresource(ID3D11Dev
|
||||
ID3D11Resource *resource, UINT subresource_idx, const D3D11_BOX *box,
|
||||
const void *data, UINT row_pitch, UINT depth_pitch)
|
||||
{
|
||||
- FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
|
||||
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
|
||||
+ struct wined3d_resource *wined3d_resource;
|
||||
+ struct wined3d_box wined3d_box;
|
||||
+ struct deferred_call *call;
|
||||
+ UINT size;
|
||||
+
|
||||
+ TRACE("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u.\n",
|
||||
iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
|
||||
+
|
||||
+ if (box)
|
||||
+ wined3d_box_set(&wined3d_box, box->left, box->top, box->right, box->bottom, box->front, box->back);
|
||||
+
|
||||
+ wined3d_resource = wined3d_resource_from_d3d11_resource(resource);
|
||||
+ wined3d_mutex_lock();
|
||||
+ size = wined3d_resource_update_info(wined3d_resource, subresource_idx,
|
||||
+ box ? &wined3d_box : NULL, row_pitch, depth_pitch);
|
||||
+ wined3d_mutex_unlock();
|
||||
+
|
||||
+ if (!size)
|
||||
+ {
|
||||
+ FIXME("Failed to calculate size of data\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!(call = add_deferred_call(context, size + (box ? sizeof(D3D11_BOX) : 0))))
|
||||
+ return;
|
||||
+
|
||||
+ call->cmd = DEFERRED_UPDATESUBRESOURCE;
|
||||
+ call->update_subresource_info.resource = resource;
|
||||
+ call->update_subresource_info.subresource_idx = subresource_idx;
|
||||
+ call->update_subresource_info.row_pitch = row_pitch;
|
||||
+ call->update_subresource_info.depth_pitch = depth_pitch;
|
||||
+
|
||||
+ ID3D11Resource_AddRef(resource);
|
||||
+
|
||||
+ if (box)
|
||||
+ {
|
||||
+ call->update_subresource_info.box = (void *)(call + 1);
|
||||
+ call->update_subresource_info.data = (void *)(call->update_subresource_info.box + 1);
|
||||
+ *call->update_subresource_info.box = *box;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ call->update_subresource_info.box = NULL;
|
||||
+ call->update_subresource_info.data = (void *)(call + 1);
|
||||
+ }
|
||||
+
|
||||
+ memcpy(call->update_subresource_info.data, data, size);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_deferred_context_CopyStructureCount(ID3D11DeviceContext *iface,
|
||||
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
|
||||
index b3a46950f4e..fae2cae4398 100644
|
||||
--- a/dlls/wined3d/resource.c
|
||||
+++ b/dlls/wined3d/resource.c
|
||||
@@ -338,6 +338,99 @@ HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned
|
||||
return wined3d_device_context_unmap(&resource->device->cs->c, resource, sub_resource_idx);
|
||||
}
|
||||
|
||||
+UINT CDECL wined3d_resource_update_info(struct wined3d_resource *resource, unsigned int sub_resource_idx,
|
||||
+ const struct wined3d_box *box, unsigned int row_pitch, unsigned int depth_pitch)
|
||||
+{
|
||||
+ unsigned int width, height, depth;
|
||||
+ struct wined3d_box b;
|
||||
+ UINT data_size;
|
||||
+
|
||||
+ TRACE("resource %p, sub_resource_idx %u, box %s, row_pitch %u, depth_pitch %u.\n",
|
||||
+ resource, sub_resource_idx, debug_box(box), row_pitch, depth_pitch);
|
||||
+
|
||||
+ if (resource->type == WINED3D_RTYPE_BUFFER)
|
||||
+ {
|
||||
+ if (sub_resource_idx > 0)
|
||||
+ {
|
||||
+ WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ width = resource->size;
|
||||
+ height = 1;
|
||||
+ depth = 1;
|
||||
+ }
|
||||
+ else if (resource->type == WINED3D_RTYPE_TEXTURE_1D ||
|
||||
+ resource->type == WINED3D_RTYPE_TEXTURE_2D || resource->type == WINED3D_RTYPE_TEXTURE_3D)
|
||||
+ {
|
||||
+ struct wined3d_texture *texture = texture_from_resource(resource);
|
||||
+ unsigned int level;
|
||||
+
|
||||
+ if (sub_resource_idx >= texture->level_count * texture->layer_count)
|
||||
+ {
|
||||
+ WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ level = sub_resource_idx % texture->level_count;
|
||||
+ width = wined3d_texture_get_level_width(texture, level);
|
||||
+ height = wined3d_texture_get_level_height(texture, level);
|
||||
+ depth = wined3d_texture_get_level_depth(texture, level);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!box)
|
||||
+ {
|
||||
+ wined3d_box_set(&b, 0, 0, width, height, 0, depth);
|
||||
+ box = &b;
|
||||
+ }
|
||||
+ else if (box->left >= box->right || box->right > width
|
||||
+ || box->top >= box->bottom || box->bottom > height
|
||||
+ || box->front >= box->back || box->back > depth)
|
||||
+ {
|
||||
+ WARN("Invalid box %s specified.\n", debug_box(box));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (resource->format_flags & WINED3DFMT_FLAG_BLOCKS)
|
||||
+ {
|
||||
+ if (resource->type != WINED3D_RTYPE_TEXTURE_2D)
|
||||
+ {
|
||||
+ FIXME("Calculation of block formats not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ height = (box->bottom - box->top + resource->format->block_height - 1) / resource->format->block_height;
|
||||
+ width = (box->right - box->left + resource->format->block_width - 1) / resource->format->block_width;
|
||||
+ return (height - 1) * row_pitch + width * resource->format->block_byte_count;
|
||||
+ }
|
||||
+
|
||||
+ data_size = 0;
|
||||
+ switch (resource->type)
|
||||
+ {
|
||||
+ case WINED3D_RTYPE_TEXTURE_3D:
|
||||
+ data_size += (box->back - box->front - 1) * depth_pitch;
|
||||
+ /* fall-through */
|
||||
+ case WINED3D_RTYPE_TEXTURE_2D:
|
||||
+ data_size += (box->bottom - box->top - 1) * row_pitch;
|
||||
+ /* fall-through */
|
||||
+ case WINED3D_RTYPE_TEXTURE_1D:
|
||||
+ data_size += (box->right - box->left) * resource->format->byte_count;
|
||||
+ break;
|
||||
+ case WINED3D_RTYPE_BUFFER:
|
||||
+ data_size = box->right - box->left;
|
||||
+ break;
|
||||
+ case WINED3D_RTYPE_NONE:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return data_size;
|
||||
+}
|
||||
+
|
||||
void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
|
||||
{
|
||||
wined3d_cs_emit_preload_resource(resource->device->cs, resource);
|
||||
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
|
||||
index 63e7b82abda..9879f394699 100644
|
||||
--- a/dlls/wined3d/wined3d.spec
|
||||
+++ b/dlls/wined3d/wined3d.spec
|
||||
@@ -235,6 +235,7 @@
|
||||
@ cdecl wined3d_resource_set_parent(ptr ptr)
|
||||
@ cdecl wined3d_resource_set_priority(ptr long)
|
||||
@ cdecl wined3d_resource_unmap(ptr long)
|
||||
+@ cdecl wined3d_resource_update_info(ptr long ptr long long)
|
||||
|
||||
@ cdecl wined3d_rendertarget_view_create(ptr ptr ptr ptr ptr)
|
||||
@ cdecl wined3d_rendertarget_view_create_from_sub_resource(ptr long ptr ptr ptr)
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index 760bb709c2b..7cd6682d494 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -2762,6 +2762,8 @@ 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);
|
||||
HRESULT __cdecl wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx);
|
||||
+UINT __cdecl wined3d_resource_update_info(struct wined3d_resource *resource, unsigned int sub_resource_idx,
|
||||
+ const struct wined3d_box *box, unsigned int row_pitch, unsigned int depth_pitch);
|
||||
|
||||
HRESULT __cdecl wined3d_rendertarget_view_create(const struct wined3d_view_desc *desc,
|
||||
struct wined3d_resource *resource, void *parent, const struct wined3d_parent_ops *parent_ops,
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,276 +0,0 @@
|
||||
From cf45f6b66c0babf760c2a27ff7aa6842696fb22f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 1 Oct 2017 04:43:22 +0200
|
||||
Subject: [PATCH] d3d11: Implement restoring of state after executing a command
|
||||
list.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 233 +++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 229 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 639727e4af4..c2c63d97351 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -391,6 +391,62 @@ struct deferred_call
|
||||
};
|
||||
};
|
||||
|
||||
+/* Replace with D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT as soon as wined3d supports >= 32 streams */
|
||||
+#define MAX_WINED3D_STREAMS 16
|
||||
+
|
||||
+struct d3d11_state
|
||||
+{
|
||||
+ ID3D11ShaderResourceView *vs_resources[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT];
|
||||
+ ID3D11SamplerState *vs_samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT];
|
||||
+ ID3D11Buffer *vs_cbs[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT];
|
||||
+ ID3D11VertexShader *vs;
|
||||
+
|
||||
+ ID3D11ShaderResourceView *gs_resources[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT];
|
||||
+ ID3D11SamplerState *gs_samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT];
|
||||
+ ID3D11Buffer *gs_cbs[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT];
|
||||
+ ID3D11GeometryShader *gs;
|
||||
+
|
||||
+ ID3D11ShaderResourceView *ps_resources[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT];
|
||||
+ ID3D11SamplerState *ps_samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT];
|
||||
+ ID3D11Buffer *ps_cbs[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT];
|
||||
+ ID3D11PixelShader *ps;
|
||||
+
|
||||
+ ID3D11ShaderResourceView *hs_resources[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT];
|
||||
+ ID3D11SamplerState *hs_samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT];
|
||||
+ ID3D11Buffer *hs_cbs[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT];
|
||||
+ ID3D11HullShader *hs;
|
||||
+
|
||||
+ ID3D11ShaderResourceView *ds_resources[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT];
|
||||
+ ID3D11SamplerState *ds_samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT];
|
||||
+ ID3D11Buffer *ds_cbs[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT];
|
||||
+ ID3D11DomainShader *ds;
|
||||
+
|
||||
+ ID3D11Buffer *vbs[MAX_WINED3D_STREAMS];
|
||||
+ UINT vb_strides[MAX_WINED3D_STREAMS];
|
||||
+ UINT vb_offsets[MAX_WINED3D_STREAMS];
|
||||
+ D3D11_PRIMITIVE_TOPOLOGY topology;
|
||||
+ ID3D11InputLayout *il;
|
||||
+ DXGI_FORMAT ib_format;
|
||||
+ ID3D11Buffer *ib;
|
||||
+ UINT ib_offset;
|
||||
+
|
||||
+ ID3D11RenderTargetView *rtvs[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT];
|
||||
+ ID3D11DepthStencilView *dsv;
|
||||
+ ID3D11DepthStencilState *dss;
|
||||
+ float blend_factor[4];
|
||||
+ ID3D11BlendState *bs;
|
||||
+ UINT stencil_ref;
|
||||
+ UINT sample_mask;
|
||||
+
|
||||
+ D3D11_RECT scissor_rects[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
|
||||
+ D3D11_VIEWPORT vps[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
|
||||
+ ID3D11Buffer *so_buffers[D3D11_SO_BUFFER_SLOT_COUNT];
|
||||
+ UINT so_offsets[D3D11_SO_BUFFER_SLOT_COUNT];
|
||||
+ ID3D11Predicate *predicate;
|
||||
+ ID3D11RasterizerState *rs;
|
||||
+ BOOL predicate_value;
|
||||
+};
|
||||
+
|
||||
/* ID3D11CommandList - command list */
|
||||
struct d3d11_command_list
|
||||
{
|
||||
@@ -2730,22 +2786,191 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ResolveSubresource(ID3D11D
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
+static struct d3d11_state *state_capture(ID3D11DeviceContext1 *context)
|
||||
+{
|
||||
+ struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(context);
|
||||
+ unsigned int vp_count = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
|
||||
+ struct d3d11_state *stateblock;
|
||||
+ int i;
|
||||
+
|
||||
+ if (!(stateblock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*stateblock))))
|
||||
+ return NULL;
|
||||
+
|
||||
+ ID3D11DeviceContext1_VSGetShader(context, &stateblock->vs, NULL, 0);
|
||||
+ ID3D11DeviceContext1_VSGetSamplers(context, 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, stateblock->vs_samplers);
|
||||
+ ID3D11DeviceContext1_VSGetShaderResources(context, 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, stateblock->vs_resources);
|
||||
+ ID3D11DeviceContext1_VSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, stateblock->vs_cbs);
|
||||
+
|
||||
+ ID3D11DeviceContext1_GSGetShader(context, &stateblock->gs, NULL, 0);
|
||||
+ ID3D11DeviceContext1_GSGetSamplers(context, 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, stateblock->gs_samplers);
|
||||
+ ID3D11DeviceContext1_GSGetShaderResources(context, 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, stateblock->gs_resources);
|
||||
+ ID3D11DeviceContext1_GSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, stateblock->gs_cbs);
|
||||
+
|
||||
+ ID3D11DeviceContext1_PSGetShader(context, &stateblock->ps, NULL, 0);
|
||||
+ ID3D11DeviceContext1_PSGetSamplers(context, 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, stateblock->ps_samplers);
|
||||
+ ID3D11DeviceContext1_PSGetShaderResources(context, 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, stateblock->ps_resources);
|
||||
+ ID3D11DeviceContext1_PSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, stateblock->ps_cbs);
|
||||
+
|
||||
+ ID3D11DeviceContext1_HSGetShader(context, &stateblock->hs, NULL, 0);
|
||||
+ ID3D11DeviceContext1_HSGetSamplers(context, 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, stateblock->hs_samplers);
|
||||
+ ID3D11DeviceContext1_HSGetShaderResources(context, 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, stateblock->hs_resources);
|
||||
+ ID3D11DeviceContext1_HSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, stateblock->hs_cbs);
|
||||
+
|
||||
+ ID3D11DeviceContext1_DSGetShader(context, &stateblock->ds, NULL, 0);
|
||||
+ ID3D11DeviceContext1_DSGetSamplers(context, 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, stateblock->ds_samplers);
|
||||
+ ID3D11DeviceContext1_DSGetShaderResources(context, 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, stateblock->ds_resources);
|
||||
+ ID3D11DeviceContext1_DSGetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, stateblock->ds_cbs);
|
||||
+
|
||||
+ ID3D11DeviceContext1_IAGetVertexBuffers(context, 0, MAX_WINED3D_STREAMS, stateblock->vbs, stateblock->vb_strides, stateblock->vb_offsets);
|
||||
+ ID3D11DeviceContext1_IAGetIndexBuffer(context, &stateblock->ib, &stateblock->ib_format, &stateblock->ib_offset);
|
||||
+ ID3D11DeviceContext1_IAGetInputLayout(context, &stateblock->il);
|
||||
+ ID3D11DeviceContext1_IAGetPrimitiveTopology(context, &stateblock->topology);
|
||||
+
|
||||
+ ID3D11DeviceContext1_OMGetRenderTargets(context, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, stateblock->rtvs, &stateblock->dsv);
|
||||
+ ID3D11DeviceContext1_OMGetDepthStencilState(context, &stateblock->dss, &stateblock->stencil_ref);
|
||||
+ ID3D11DeviceContext1_OMGetBlendState(context, &stateblock->bs, stateblock->blend_factor, &stateblock->sample_mask);
|
||||
+
|
||||
+ ID3D11DeviceContext1_RSGetViewports(context, &vp_count, stateblock->vps);
|
||||
+ ID3D11DeviceContext1_RSGetScissorRects(context, &vp_count, stateblock->scissor_rects);
|
||||
+ ID3D11DeviceContext1_RSGetState(context, &stateblock->rs);
|
||||
+
|
||||
+ ID3D11DeviceContext1_SOGetTargets(context, D3D11_SO_BUFFER_SLOT_COUNT, stateblock->so_buffers);
|
||||
+ /* For some reason the d3d11 get function is missing the offset parameter */
|
||||
+ for (i = 0; i < D3D11_SO_BUFFER_SLOT_COUNT; i++)
|
||||
+ wined3d_device_context_get_stream_output(device->immediate_context.wined3d_context, i, &stateblock->so_offsets[i]);
|
||||
+
|
||||
+ ID3D11DeviceContext1_GetPredication(context, &stateblock->predicate, &stateblock->predicate_value);
|
||||
+
|
||||
+ return stateblock;
|
||||
+}
|
||||
+
|
||||
+static void state_apply(ID3D11DeviceContext1 *context, struct d3d11_state *stateblock)
|
||||
+{
|
||||
+ static DWORD warn_once;
|
||||
+ int i;
|
||||
+
|
||||
+ if (!stateblock)
|
||||
+ return;
|
||||
+
|
||||
+ if (!warn_once++) FIXME("restoring state is potentially slow and incomplete!\n");
|
||||
+
|
||||
+ ID3D11DeviceContext1_VSSetShader(context, stateblock->vs, NULL, 0);
|
||||
+ ID3D11DeviceContext1_VSSetSamplers(context, 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, stateblock->vs_samplers);
|
||||
+ ID3D11DeviceContext1_VSSetShaderResources(context, 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, stateblock->vs_resources);
|
||||
+ ID3D11DeviceContext1_VSSetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, stateblock->vs_cbs);
|
||||
+
|
||||
+ if (stateblock->vs) ID3D11VertexShader_Release(stateblock->vs);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; i++)
|
||||
+ if (stateblock->vs_samplers[i]) ID3D11SamplerState_Release(stateblock->vs_samplers[i]);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; i++)
|
||||
+ if (stateblock->vs_resources[i]) ID3D11ShaderResourceView_Release(stateblock->vs_resources[i]);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; i++)
|
||||
+ if (stateblock->vs_cbs[i]) ID3D11Buffer_Release(stateblock->vs_cbs[i]);
|
||||
+
|
||||
+ ID3D11DeviceContext1_GSSetShader(context, stateblock->gs, NULL, 0);
|
||||
+ ID3D11DeviceContext1_GSSetSamplers(context, 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, stateblock->gs_samplers);
|
||||
+ ID3D11DeviceContext1_GSSetShaderResources(context, 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, stateblock->gs_resources);
|
||||
+ ID3D11DeviceContext1_GSSetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, stateblock->gs_cbs);
|
||||
+
|
||||
+ if (stateblock->gs) ID3D11GeometryShader_Release(stateblock->gs);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; i++)
|
||||
+ if (stateblock->gs_samplers[i]) ID3D11SamplerState_Release(stateblock->gs_samplers[i]);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; i++)
|
||||
+ if (stateblock->gs_resources[i]) ID3D11ShaderResourceView_Release(stateblock->gs_resources[i]);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; i++)
|
||||
+ if (stateblock->gs_cbs[i]) ID3D11Buffer_Release(stateblock->gs_cbs[i]);
|
||||
+
|
||||
+ ID3D11DeviceContext1_PSSetShader(context, stateblock->ps, NULL, 0);
|
||||
+ ID3D11DeviceContext1_PSSetSamplers(context, 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, stateblock->ps_samplers);
|
||||
+ ID3D11DeviceContext1_PSSetShaderResources(context, 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, stateblock->ps_resources);
|
||||
+ ID3D11DeviceContext1_PSSetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, stateblock->ps_cbs);
|
||||
+
|
||||
+ if (stateblock->ps) ID3D11PixelShader_Release(stateblock->ps);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; i++)
|
||||
+ if (stateblock->ps_samplers[i]) ID3D11SamplerState_Release(stateblock->ps_samplers[i]);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; i++)
|
||||
+ if (stateblock->ps_resources[i]) ID3D11ShaderResourceView_Release(stateblock->ps_resources[i]);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; i++)
|
||||
+ if (stateblock->ps_cbs[i]) ID3D11Buffer_Release(stateblock->ps_cbs[i]);
|
||||
+
|
||||
+ ID3D11DeviceContext1_HSSetShader(context, stateblock->hs, NULL, 0);
|
||||
+ ID3D11DeviceContext1_HSSetSamplers(context, 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, stateblock->hs_samplers);
|
||||
+ ID3D11DeviceContext1_HSSetShaderResources(context, 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, stateblock->hs_resources);
|
||||
+ ID3D11DeviceContext1_HSSetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, stateblock->hs_cbs);
|
||||
+
|
||||
+ if (stateblock->hs) ID3D11HullShader_Release(stateblock->hs);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; i++)
|
||||
+ if (stateblock->hs_samplers[i]) ID3D11SamplerState_Release(stateblock->hs_samplers[i]);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; i++)
|
||||
+ if (stateblock->hs_resources[i]) ID3D11ShaderResourceView_Release(stateblock->hs_resources[i]);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; i++)
|
||||
+ if (stateblock->hs_cbs[i]) ID3D11Buffer_Release(stateblock->hs_cbs[i]);
|
||||
+
|
||||
+ ID3D11DeviceContext1_DSSetShader(context, stateblock->ds, NULL, 0);
|
||||
+ ID3D11DeviceContext1_DSSetSamplers(context, 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, stateblock->ds_samplers);
|
||||
+ ID3D11DeviceContext1_DSSetShaderResources(context, 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, stateblock->ds_resources);
|
||||
+ ID3D11DeviceContext1_DSSetConstantBuffers(context, 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, stateblock->ds_cbs);
|
||||
+
|
||||
+ if (stateblock->ds) ID3D11DomainShader_Release(stateblock->ds);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; i++)
|
||||
+ if (stateblock->ds_samplers[i]) ID3D11SamplerState_Release(stateblock->ds_samplers[i]);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; i++)
|
||||
+ if (stateblock->ds_resources[i]) ID3D11ShaderResourceView_Release(stateblock->ds_resources[i]);
|
||||
+ for (i = 0; i < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; i++)
|
||||
+ if (stateblock->ds_cbs[i]) ID3D11Buffer_Release(stateblock->ds_cbs[i]);
|
||||
+
|
||||
+ ID3D11DeviceContext1_IASetVertexBuffers(context, 0, MAX_WINED3D_STREAMS, stateblock->vbs, stateblock->vb_strides, stateblock->vb_offsets);
|
||||
+ ID3D11DeviceContext1_IASetIndexBuffer(context, stateblock->ib, stateblock->ib_format, stateblock->ib_offset);
|
||||
+ ID3D11DeviceContext1_IASetInputLayout(context, stateblock->il);
|
||||
+ ID3D11DeviceContext1_IASetPrimitiveTopology(context, stateblock->topology);
|
||||
+
|
||||
+ for (i = 0; i < MAX_WINED3D_STREAMS; i++)
|
||||
+ if (stateblock->vbs[i]) ID3D11Buffer_Release(stateblock->vbs[i]);
|
||||
+ if (stateblock->ib) ID3D11Buffer_Release(stateblock->ib);
|
||||
+ if (stateblock->il) ID3D11InputLayout_Release(stateblock->il);
|
||||
+
|
||||
+ ID3D11DeviceContext1_OMSetRenderTargets(context, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, stateblock->rtvs, stateblock->dsv);
|
||||
+ ID3D11DeviceContext1_OMSetDepthStencilState(context, stateblock->dss, stateblock->stencil_ref);
|
||||
+ ID3D11DeviceContext1_OMSetBlendState(context, stateblock->bs, stateblock->blend_factor, stateblock->sample_mask);
|
||||
+
|
||||
+ for (i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
|
||||
+ if (stateblock->rtvs[i]) ID3D11RenderTargetView_Release(stateblock->rtvs[i]);
|
||||
+ if (stateblock->dsv) ID3D11DepthStencilView_Release(stateblock->dsv);
|
||||
+ if (stateblock->dss) ID3D11DepthStencilState_Release(stateblock->dss);
|
||||
+ if (stateblock->bs) ID3D11BlendState_Release(stateblock->bs);
|
||||
+
|
||||
+ ID3D11DeviceContext1_RSSetViewports(context, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE, stateblock->vps);
|
||||
+ ID3D11DeviceContext1_RSSetScissorRects(context, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE, stateblock->scissor_rects);
|
||||
+ ID3D11DeviceContext1_RSSetState(context, stateblock->rs);
|
||||
+
|
||||
+ if (stateblock->rs) ID3D11RasterizerState_Release(stateblock->rs);
|
||||
+
|
||||
+ ID3D11DeviceContext1_SOSetTargets(context, D3D11_SO_BUFFER_SLOT_COUNT, stateblock->so_buffers, stateblock->so_offsets);
|
||||
+ ID3D11DeviceContext1_SetPredication(context, stateblock->predicate, stateblock->predicate_value);
|
||||
+
|
||||
+ for (i = 0; i < D3D11_SO_BUFFER_SLOT_COUNT; i++)
|
||||
+ if (stateblock->so_buffers[i]) ID3D11Buffer_Release(stateblock->so_buffers[i]);
|
||||
+ if (stateblock->predicate) ID3D11Predicate_Release(stateblock->predicate);
|
||||
+
|
||||
+ HeapFree(GetProcessHeap(), 0, stateblock);
|
||||
+}
|
||||
+
|
||||
static void STDMETHODCALLTYPE d3d11_immediate_context_ExecuteCommandList(ID3D11DeviceContext1 *iface,
|
||||
ID3D11CommandList *command_list, BOOL restore_state)
|
||||
{
|
||||
struct d3d11_command_list *cmdlist = unsafe_impl_from_ID3D11CommandList(command_list);
|
||||
+ struct d3d11_state *stateblock = NULL;
|
||||
|
||||
TRACE("iface %p, command_list %p, restore_state %#x.\n", iface, command_list, restore_state);
|
||||
|
||||
if (!cmdlist)
|
||||
return;
|
||||
|
||||
- if (restore_state)
|
||||
- FIXME("restoring state not supported!\n");
|
||||
-
|
||||
wined3d_mutex_lock();
|
||||
+ if (restore_state) stateblock = state_capture(iface);
|
||||
exec_deferred_calls(iface, &cmdlist->commands);
|
||||
- ID3D11DeviceContext1_ClearState(iface);
|
||||
+ if (restore_state) state_apply(iface, stateblock);
|
||||
+ else ID3D11DeviceContext1_ClearState(iface);
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,33 +0,0 @@
|
||||
From a8a3e227939cb3463553c9857d051133820ae011 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Melenchuk <smelenchuk@gmail.com>
|
||||
Date: Sat, 7 Oct 2017 18:33:16 -0600
|
||||
Subject: [PATCH] d3d11: Allow NULL pointer for initial count in
|
||||
d3d11_deferred_context_CSSetUnorderedAccessViews.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index e214202..a011114 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -5659,12 +5659,13 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetUnorderedAccessViews(I
|
||||
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];
|
||||
+ call->unordered_view.initial_counts = initial_counts ?
|
||||
+ (void *)&call->unordered_view.views[view_count] : NULL;
|
||||
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];
|
||||
+ if (initial_counts) call->unordered_view.initial_counts[i] = initial_counts[i];
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,43 +0,0 @@
|
||||
From 3fe8383d68770398720839e579de182e69b16ff5 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Sun, 27 May 2018 11:44:36 +1000
|
||||
Subject: [PATCH] d3d11: Correctly align map info buffer
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 745a22d91b..210f9600d2 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -4692,6 +4692,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_Map(ID3D11DeviceContext
|
||||
struct wined3d_resource *wined3d_resource;
|
||||
struct wined3d_map_info map_info;
|
||||
struct deferred_call *call, *previous = NULL;
|
||||
+ SIZE_T align;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, resource %p, subresource_idx %u, map_type %u, map_flags %#x, mapped_subresource %p.\n",
|
||||
@@ -4727,7 +4728,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_Map(ID3D11DeviceContext
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
- if (!(call = add_deferred_call(context, map_info.size)))
|
||||
+ align = ((sizeof(*call) + 0xf) & ~0xf) - sizeof(*call);
|
||||
+ if (!(call = add_deferred_call(context, map_info.size + align)))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
call->cmd = DEFERRED_MAP;
|
||||
@@ -4736,7 +4738,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_Map(ID3D11DeviceContext
|
||||
call->map_info.subresource_idx = subresource_idx;
|
||||
call->map_info.map_type = map_type;
|
||||
call->map_info.map_flags = map_flags;
|
||||
- call->map_info.buffer = (void *)(call + 1);
|
||||
+ call->map_info.buffer = (BYTE *)(call + 1) + align;
|
||||
call->map_info.size = map_info.size;
|
||||
|
||||
if (previous)
|
||||
--
|
||||
2.17.0
|
||||
|
@ -1,176 +0,0 @@
|
||||
From 929513c89e71d0675dd2c80a29ddf94f2c331dd8 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Fri, 27 Sep 2019 16:26:04 +0300
|
||||
Subject: [PATCH] d3d11/tests: Add a basic test for drawing with deferred
|
||||
context.
|
||||
|
||||
---
|
||||
dlls/d3d11/tests/d3d11.c | 100 +++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 81 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index 214b9b164988..26c9f8555ff6 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -1691,10 +1691,11 @@ static void release_test_context_(unsigned int line, struct d3d11_test_context *
|
||||
ok_(__FILE__, line)(!ref, "Device has %u references left.\n", ref);
|
||||
}
|
||||
|
||||
-#define draw_quad(context) draw_quad_vs_(__LINE__, context, NULL, 0)
|
||||
-#define draw_quad_vs(a, b, c) draw_quad_vs_(__LINE__, a, b, c)
|
||||
+#define draw_quad(context) draw_quad_vs_(__LINE__, context, NULL, 0, (context)->immediate_context)
|
||||
+#define draw_quad_vs(a, b, c) draw_quad_vs_(__LINE__, a, b, c, (a)->immediate_context)
|
||||
+#define draw_quad_ext(a, b, c, d) draw_quad_vs_(__LINE__, a, b, c, d)
|
||||
static void draw_quad_vs_(unsigned int line, struct d3d11_test_context *context,
|
||||
- const DWORD *vs_code, size_t vs_code_size)
|
||||
+ const DWORD *vs_code, size_t vs_code_size, ID3D11DeviceContext *draw_context)
|
||||
{
|
||||
static const D3D11_INPUT_ELEMENT_DESC default_layout_desc[] =
|
||||
{
|
||||
@@ -1763,14 +1764,14 @@ static void draw_quad_vs_(unsigned int line, struct d3d11_test_context *context,
|
||||
if (!context->vb)
|
||||
context->vb = create_buffer(device, D3D11_BIND_VERTEX_BUFFER, sizeof(quad), quad);
|
||||
|
||||
- ID3D11DeviceContext_IASetInputLayout(context->immediate_context, context->input_layout);
|
||||
- ID3D11DeviceContext_IASetPrimitiveTopology(context->immediate_context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
+ ID3D11DeviceContext_IASetInputLayout(draw_context, context->input_layout);
|
||||
+ ID3D11DeviceContext_IASetPrimitiveTopology(draw_context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
stride = sizeof(*quad);
|
||||
offset = 0;
|
||||
- ID3D11DeviceContext_IASetVertexBuffers(context->immediate_context, 0, 1, &context->vb, &stride, &offset);
|
||||
- ID3D11DeviceContext_VSSetShader(context->immediate_context, context->vs, NULL, 0);
|
||||
+ ID3D11DeviceContext_IASetVertexBuffers(draw_context, 0, 1, &context->vb, &stride, &offset);
|
||||
+ ID3D11DeviceContext_VSSetShader(draw_context, context->vs, NULL, 0);
|
||||
|
||||
- ID3D11DeviceContext_Draw(context->immediate_context, 4, 0);
|
||||
+ ID3D11DeviceContext_Draw(draw_context, 4, 0);
|
||||
}
|
||||
|
||||
#define draw_quad_z(context, z) draw_quad_z_(__LINE__, context, z)
|
||||
@@ -1806,19 +1807,27 @@ static void draw_quad_z_(unsigned int line, struct d3d11_test_context *context,
|
||||
(ID3D11Resource *)context->vs_cb, 0, NULL, &data, 0, 0);
|
||||
|
||||
ID3D11DeviceContext_VSSetConstantBuffers(context->immediate_context, 0, 1, &context->vs_cb);
|
||||
- draw_quad_vs_(__LINE__, context, vs_code, sizeof(vs_code));
|
||||
+ draw_quad_vs_(__LINE__, context, vs_code, sizeof(vs_code), context->immediate_context);
|
||||
}
|
||||
|
||||
-static void set_quad_color(struct d3d11_test_context *context, const struct vec4 *color)
|
||||
+static void set_quad_color_ext(struct d3d11_test_context *context, const struct vec4 *color,
|
||||
+ ID3D11DeviceContext *draw_context)
|
||||
{
|
||||
- ID3D11DeviceContext_UpdateSubresource(context->immediate_context,
|
||||
+ ID3D11DeviceContext_UpdateSubresource(draw_context,
|
||||
(ID3D11Resource *)context->ps_cb, 0, NULL, color, 0, 0);
|
||||
}
|
||||
|
||||
-#define draw_color_quad(a, b) draw_color_quad_(__LINE__, a, b, NULL, 0)
|
||||
-#define draw_color_quad_vs(a, b, c, d) draw_color_quad_(__LINE__, a, b, c, d)
|
||||
+static void set_quad_color(struct d3d11_test_context *context, const struct vec4 *color)
|
||||
+{
|
||||
+ set_quad_color_ext(context, color, context->immediate_context);
|
||||
+}
|
||||
+
|
||||
+#define draw_color_quad(a, b) draw_color_quad_(__LINE__, a, b, NULL, 0, (a)->immediate_context)
|
||||
+#define draw_color_quad_vs(a, b, c, d) draw_color_quad_(__LINE__, a, b, c, d, (a)->immediate_context)
|
||||
+#define draw_color_quad_ext(a, b, c, d, e) draw_color_quad_(__LINE__, a, b, c, d, e)
|
||||
static void draw_color_quad_(unsigned int line, struct d3d11_test_context *context,
|
||||
- const struct vec4 *color, const DWORD *vs_code, size_t vs_code_size)
|
||||
+ const struct vec4 *color, const DWORD *vs_code, size_t vs_code_size,
|
||||
+ ID3D11DeviceContext *draw_context)
|
||||
{
|
||||
static const DWORD ps_color_code[] =
|
||||
{
|
||||
@@ -1855,12 +1864,12 @@ static void draw_color_quad_(unsigned int line, struct d3d11_test_context *conte
|
||||
if (!context->ps_cb)
|
||||
context->ps_cb = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, sizeof(*color), NULL);
|
||||
|
||||
- ID3D11DeviceContext_PSSetShader(context->immediate_context, context->ps, NULL, 0);
|
||||
- ID3D11DeviceContext_PSSetConstantBuffers(context->immediate_context, 0, 1, &context->ps_cb);
|
||||
+ ID3D11DeviceContext_PSSetShader(draw_context, context->ps, NULL, 0);
|
||||
+ ID3D11DeviceContext_PSSetConstantBuffers(draw_context, 0, 1, &context->ps_cb);
|
||||
|
||||
- set_quad_color(context, color);
|
||||
+ set_quad_color_ext(context, color, draw_context);
|
||||
|
||||
- draw_quad_vs_(line, context, vs_code, vs_code_size);
|
||||
+ draw_quad_vs_(line, context, vs_code, vs_code_size, draw_context);
|
||||
}
|
||||
|
||||
static void test_create_device(void)
|
||||
@@ -2087,6 +2096,59 @@ static void test_create_device(void)
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
+static void test_draw_deferred_context(void)
|
||||
+{
|
||||
+ static const struct vec4 red = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
+ static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
+ static const float black[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
+ ID3D11DeviceContext *context, *deferred_context;
|
||||
+ struct d3d11_test_context test_context;
|
||||
+ ID3D11CommandList *command_list;
|
||||
+ ID3D11Device *device;
|
||||
+ DWORD color;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ if (!init_test_context(&test_context, NULL))
|
||||
+ return;
|
||||
+
|
||||
+ device = test_context.device;
|
||||
+ context = test_context.immediate_context;
|
||||
+
|
||||
+ hr = ID3D11Device_CreateDeferredContext(device, 0, &deferred_context);
|
||||
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
+
|
||||
+ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, white);
|
||||
+ color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
+ ok(color == 0xffffffff, "Got unexpected color 0x%08x.\n", color);
|
||||
+
|
||||
+ ID3D11DeviceContext_ClearRenderTargetView(deferred_context, test_context.backbuffer_rtv, black);
|
||||
+
|
||||
+ hr = ID3D11DeviceContext_FinishCommandList(deferred_context, FALSE, &command_list);
|
||||
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
+
|
||||
+ ID3D11DeviceContext_ExecuteCommandList(context, command_list, TRUE);
|
||||
+ color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
+ ok(color == 0x00000000, "Got unexpected color 0x%08x.\n", color);
|
||||
+ ID3D11CommandList_Release(command_list);
|
||||
+
|
||||
+ ID3D11DeviceContext_OMSetRenderTargets(deferred_context, 1, &test_context.backbuffer_rtv, NULL);
|
||||
+
|
||||
+ draw_color_quad_ext(&test_context, &red, NULL, 0, deferred_context);
|
||||
+ color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
+ ok(color == 0x00000000, "Got unexpected color 0x%08x.\n", color);
|
||||
+
|
||||
+ hr = ID3D11DeviceContext_FinishCommandList(deferred_context, TRUE, &command_list);
|
||||
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
+ ID3D11DeviceContext_ExecuteCommandList(context, command_list, TRUE);
|
||||
+
|
||||
+ color = get_texture_color(test_context.backbuffer, 320, 240);
|
||||
+ ok(color == 0xff0000ff, "Got unexpected color 0x%08x.\n", color);
|
||||
+ ID3D11CommandList_Release(command_list);
|
||||
+
|
||||
+ ID3D11DeviceContext_Release(deferred_context);
|
||||
+ release_test_context(&test_context);
|
||||
+}
|
||||
+
|
||||
static void test_device_interfaces(const D3D_FEATURE_LEVEL feature_level)
|
||||
{
|
||||
struct device_desc device_desc;
|
||||
@@ -30114,11 +30176,11 @@ START_TEST(d3d11)
|
||||
}
|
||||
|
||||
print_adapter_info();
|
||||
-
|
||||
queue_test(test_create_device);
|
||||
queue_for_each_feature_level(test_device_interfaces);
|
||||
queue_test(test_immediate_context);
|
||||
queue_test(test_create_deferred_context);
|
||||
+ queue_test(test_draw_deferred_context);
|
||||
queue_test(test_create_texture1d);
|
||||
queue_test(test_texture1d_interfaces);
|
||||
queue_test(test_create_texture2d);
|
||||
--
|
||||
2.26.2
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,44 +0,0 @@
|
||||
From 2537d783b525e7ec2239b87b17916d15e0130add Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Mon, 1 Jun 2020 16:34:54 +1000
|
||||
Subject: [PATCH] d3d11: Implement ID3D11Device2 GetImmediateContext1
|
||||
|
||||
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=41636
|
||||
---
|
||||
dlls/d3d11/device.c | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index a649be2f8ea..28100c2f9db 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -7174,9 +7174,24 @@ 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 d3d11_deferred_context *object;
|
||||
|
||||
- return E_NOTIMPL;
|
||||
+ TRACE("iface %p, flags %#x, context %p.\n", iface, flags, context);
|
||||
+
|
||||
+ if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
||||
+ return E_OUTOFMEMORY;
|
||||
+
|
||||
+ object->ID3D11DeviceContext1_iface.lpVtbl = &d3d11_deferred_context_vtbl;
|
||||
+ object->device = (ID3D11Device *)iface;
|
||||
+ object->refcount = 1;
|
||||
+
|
||||
+ list_init(&object->commands);
|
||||
+
|
||||
+ ID3D11Device2_AddRef(iface);
|
||||
+ wined3d_private_store_init(&object->private_store);
|
||||
+
|
||||
+ return ID3D11DeviceContext1_QueryInterface(&object->ID3D11DeviceContext1_iface,
|
||||
+ &IID_ID3D11DeviceContext, (void**)context);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBlendState1(ID3D11Device2 *iface,
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,8 +1,5 @@
|
||||
Fixes: [42191] Add semi-stub for D3D11 deferred context implementation
|
||||
Fixes: [42191] Multiple games require d3d11 deferred contexts (Diablo 3, Dark Souls 3, The Evil Within, Elex, Alien: Isolation, Assassin's Creed III)
|
||||
Fixes: [43743] No 3D graphics in Wolcen: Lords of Mayhem
|
||||
Fixes: [44089] Correcly align the mapinfo buffer.
|
||||
Fixes: [41636] d3d11: Implement ID3D11Device2 GetImmediateContext1
|
||||
Fixes: [41636] Multiple DirectX 11 games need ID3D11Device1::CreateDeferredContext1 implementation (WWE 2K15, Dishonored: Death of the Outsider, Pro Evolution Soccer 2019, Shantae and the Pirate's Curse, Space Engineers)
|
||||
#This is pretty dumb.
|
||||
Depends: nvapi-Stub_DLL
|
||||
# In the process of upstreaming!
|
||||
Disabled: true
|
||||
|
Loading…
Reference in New Issue
Block a user