Rebase against 7fe9858988eabf377ab5e2c64d92f973574b1ae8.

Also modifies a couple of other wined3d-CSMT_Main patches, and uses
wined3d_cs_emit_destroy_object where appropriate.
This commit is contained in:
Sebastian Lackner 2016-06-23 05:50:18 +02:00
parent 6adf92cebb
commit c6a96f3e32
22 changed files with 664 additions and 1387 deletions

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "4afc7470fb630035c911a1bf1d48f66bf16c230c"
echo "7fe9858988eabf377ab5e2c64d92f973574b1ae8"
}
# Show version information

View File

@ -1,16 +1,16 @@
From 26cdea81d5126f3a38d33d1e4c12a7852a1f6bb1 Mon Sep 17 00:00:00 2001
From 1ba3d1dcdb9ee4a1d33a333fdac6cd9f4e86443c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 1 Oct 2013 14:31:56 +0200
Subject: wined3d: Hackily introduce a multithreaded command stream
---
dlls/wined3d/cs.c | 357 +++++++++++++++++++++++++++++++++++++----
dlls/wined3d/wined3d_main.c | 9 ++
dlls/wined3d/wined3d_private.h | 18 +++
3 files changed, 357 insertions(+), 27 deletions(-)
dlls/wined3d/cs.c | 361 +++++++++++++++++++++++++++++++++++++----
dlls/wined3d/wined3d_main.c | 9 +
dlls/wined3d/wined3d_private.h | 18 ++
3 files changed, 360 insertions(+), 28 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 0224cc6..5e0c537 100644
index a83459c..3bcbf19 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -24,8 +24,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@ -33,10 +33,10 @@ index 0224cc6..5e0c537 100644
WINED3D_CS_OP_PRESENT,
WINED3D_CS_OP_CLEAR,
WINED3D_CS_OP_DRAW,
@@ -52,6 +63,18 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_COLOR_KEY,
@@ -53,6 +64,18 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_MATERIAL,
WINED3D_CS_OP_RESET_STATE,
WINED3D_CS_OP_DESTROY_OBJECT,
+ WINED3D_CS_OP_STOP,
+};
+
@ -52,8 +52,8 @@ index 0224cc6..5e0c537 100644
};
struct wined3d_cs_present
@@ -252,7 +275,134 @@ struct wined3d_cs_reset_state
enum wined3d_cs_op opcode;
@@ -260,7 +283,134 @@ struct wined3d_cs_destroy_object
void *object;
};
-static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@ -188,7 +188,7 @@ index 0224cc6..5e0c537 100644
{
const struct wined3d_cs_present *op = data;
struct wined3d_swapchain *swapchain;
@@ -261,6 +411,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -269,6 +419,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
wined3d_swapchain_set_window(swapchain, op->dst_window_override);
swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags);
@ -197,7 +197,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
@@ -279,17 +431,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -287,17 +439,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
cs->ops->submit(cs);
}
@ -219,7 +219,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
@@ -309,7 +464,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
@@ -317,7 +472,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
cs->ops->submit(cs);
}
@ -228,7 +228,7 @@ index 0224cc6..5e0c537 100644
{
struct wined3d_state *state = &cs->device->state;
const struct wined3d_cs_draw *op = data;
@@ -323,6 +478,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
@@ -331,6 +486,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
draw_primitive(cs->device, state, op->base_vertex_idx, op->start_idx,
op->index_count, op->start_instance, op->instance_count, op->indexed);
@ -237,7 +237,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx,
@@ -342,12 +499,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
@@ -350,12 +507,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
cs->ops->submit(cs);
}
@ -253,7 +253,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value)
@@ -362,12 +521,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
@@ -370,12 +529,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
cs->ops->submit(cs);
}
@ -269,7 +269,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport)
@@ -381,12 +542,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -389,12 +550,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
cs->ops->submit(cs);
}
@ -285,7 +285,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -400,12 +563,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -408,12 +571,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
cs->ops->submit(cs);
}
@ -301,7 +301,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx,
@@ -421,7 +586,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
@@ -429,7 +594,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
cs->ops->submit(cs);
}
@ -310,7 +310,7 @@ index 0224cc6..5e0c537 100644
{
const struct wined3d_cs_set_depth_stencil_view *op = data;
struct wined3d_device *device = cs->device;
@@ -460,6 +625,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -468,6 +633,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
}
device_invalidate_state(device, STATE_FRAMEBUFFER);
@ -319,7 +319,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view)
@@ -473,12 +640,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
@@ -481,12 +648,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
cs->ops->submit(cs);
}
@ -335,7 +335,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration)
@@ -492,7 +661,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
@@ -500,7 +669,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
cs->ops->submit(cs);
}
@ -344,7 +344,7 @@ index 0224cc6..5e0c537 100644
{
const struct wined3d_cs_set_stream_source *op = data;
struct wined3d_stream_state *stream;
@@ -510,6 +679,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void
@@ -518,6 +687,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_STREAMSRC);
@ -353,7 +353,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -527,7 +698,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -535,7 +706,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
cs->ops->submit(cs);
}
@ -362,7 +362,7 @@ index 0224cc6..5e0c537 100644
{
const struct wined3d_cs_set_stream_source_freq *op = data;
struct wined3d_stream_state *stream;
@@ -537,6 +708,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const
@@ -545,6 +716,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const
stream->flags = op->flags;
device_invalidate_state(cs->device, STATE_STREAMSRC);
@ -371,7 +371,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags)
@@ -552,7 +725,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
@@ -560,7 +733,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
cs->ops->submit(cs);
}
@ -380,7 +380,7 @@ index 0224cc6..5e0c537 100644
{
const struct wined3d_cs_set_stream_output *op = data;
struct wined3d_stream_output *stream;
@@ -567,6 +740,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void
@@ -575,6 +748,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void
InterlockedIncrement(&op->buffer->resource.bind_count);
if (prev)
InterlockedDecrement(&prev->resource.bind_count);
@ -389,7 +389,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -583,7 +758,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -591,7 +766,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
cs->ops->submit(cs);
}
@ -398,7 +398,7 @@ index 0224cc6..5e0c537 100644
{
const struct wined3d_cs_set_index_buffer *op = data;
struct wined3d_buffer *prev;
@@ -599,6 +774,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *
@@ -607,6 +782,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_INDEXBUFFER);
@ -407,7 +407,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
@@ -615,7 +792,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -623,7 +800,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
cs->ops->submit(cs);
}
@ -416,7 +416,7 @@ index 0224cc6..5e0c537 100644
{
const struct wined3d_cs_set_constant_buffer *op = data;
struct wined3d_buffer *prev;
@@ -629,6 +806,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi
@@ -637,6 +814,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type));
@ -424,7 +424,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -645,7 +823,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
@@ -653,7 +831,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
cs->ops->submit(cs);
}
@ -433,7 +433,7 @@ index 0224cc6..5e0c537 100644
{
const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info;
const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info;
@@ -722,6 +900,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
@@ -730,6 +908,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
if (new_use_color_key)
device_invalidate_state(cs->device, STATE_COLOR_KEY);
@ -442,7 +442,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture)
@@ -736,12 +916,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -744,12 +924,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
cs->ops->submit(cs);
}
@ -458,7 +458,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -758,12 +940,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
@@ -766,12 +948,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
cs->ops->submit(cs);
}
@ -474,7 +474,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -780,13 +964,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -788,13 +972,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
cs->ops->submit(cs);
}
@ -491,7 +491,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader)
@@ -801,12 +987,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -809,12 +995,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
cs->ops->submit(cs);
}
@ -507,7 +507,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value)
@@ -821,12 +1009,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -829,12 +1017,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
cs->ops->submit(cs);
}
@ -523,7 +523,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -843,12 +1033,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -851,12 +1041,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
cs->ops->submit(cs);
}
@ -539,7 +539,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -865,13 +1057,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -873,13 +1065,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
cs->ops->submit(cs);
}
@ -556,7 +556,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state,
@@ -887,12 +1081,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -895,12 +1089,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
cs->ops->submit(cs);
}
@ -572,7 +572,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane)
@@ -907,7 +1103,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -915,7 +1111,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
cs->ops->submit(cs);
}
@ -581,7 +581,7 @@ index 0224cc6..5e0c537 100644
{
const struct wined3d_cs_set_color_key *op = data;
struct wined3d_texture *texture = op->texture;
@@ -968,6 +1164,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat
@@ -976,6 +1172,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat
break;
}
}
@ -590,7 +590,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture,
@@ -990,12 +1188,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -998,12 +1196,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
cs->ops->submit(cs);
}
@ -606,7 +606,7 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material)
@@ -1009,7 +1209,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1017,7 +1217,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
cs->ops->submit(cs);
}
@ -615,7 +615,7 @@ index 0224cc6..5e0c537 100644
{
struct wined3d_adapter *adapter = cs->device->adapter;
HRESULT hr;
@@ -1019,6 +1219,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
@@ -1027,6 +1227,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
if (FAILED(hr = state_init(&cs->state, &adapter->gl_info, &adapter->d3d_info,
WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT)))
ERR("Failed to initialize CS state, hr %#x.\n", hr);
@ -624,7 +624,22 @@ index 0224cc6..5e0c537 100644
}
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1031,8 +1233,9 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1039,11 +1241,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
cs->ops->submit(cs);
}
-static void wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data)
+static UINT wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_destroy_object *op = data;
op->callback(op->object);
+
+ return sizeof(*op);
}
void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object)
@@ -1058,8 +1262,9 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
cs->ops->submit(cs);
}
@ -635,7 +650,7 @@ index 0224cc6..5e0c537 100644
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
@@ -1091,6 +1294,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
@@ -1119,6 +1324,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
wined3d_cs_st_submit,
};
@ -694,7 +709,7 @@ index 0224cc6..5e0c537 100644
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -1117,12 +1372,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1145,12 +1402,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
return NULL;
}
@ -783,7 +798,7 @@ index 434d32e..beeb9fa 100644
if (appkey) RegCloseKey( appkey );
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 427a119..84405f2 100644
index 7bb86d6..d37f30e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -309,6 +309,7 @@ struct wined3d_settings

View File

@ -1,22 +1,20 @@
From 2dd5269b65ca49e2fb0b1d569e9a72366cb5da41 Mon Sep 17 00:00:00 2001
From 2172828bc75b410e54530ced4d11bbf8aaf41ba3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sun, 24 Apr 2016 13:51:03 +0100
Subject: wined3d: Wait for the CS before destroying views.
---
dlls/wined3d/view.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
dlls/wined3d/view.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 1604443..adc6b2c 100644
index e9e62d1..b4bc771 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -41,6 +41,14 @@ ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *v
if (!refcount)
@@ -48,6 +48,12 @@ ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *v
{
+ struct wined3d_device *device = view->resource->device;
+
struct wined3d_device *device = view->resource->device;
+ if (wined3d_settings.cs_multithreaded)
+ {
+ FIXME("Waiting for cs.\n");
@ -26,25 +24,15 @@ index 1604443..adc6b2c 100644
/* Call wined3d_object_destroyed() before releasing the resource,
* since releasing the resource may end up destroying the parent. */
view->parent_ops->wined3d_object_destroyed(view->parent);
@@ -185,6 +193,14 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v
if (!refcount)
@@ -230,6 +236,12 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v
{
+ struct wined3d_device *device = view->resource->device;
+
struct wined3d_device *device = view->resource->device;
+ if (wined3d_settings.cs_multithreaded)
+ {
+ FIXME("Waiting for cs.\n");
+ device->cs->ops->finish(device->cs);
+ }
+
if (view->object)
{
const struct wined3d_gl_info *gl_info;
@@ -196,6 +212,7 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v
checkGLcall("glDeleteTextures");
context_release(context);
}
+
/* Call wined3d_object_destroyed() before releasing the resource,
* since releasing the resource may end up destroying the parent. */

View File

@ -1,4 +1,4 @@
From 570923096c7d723b11def8056265f42e188434e7 Mon Sep 17 00:00:00 2001
From d9d7cda0f5c3aae336843cceddecb3464db7e4f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 1 Oct 2013 15:30:26 +0200
Subject: wined3d: Give the cs its own state
@ -10,19 +10,19 @@ Subject: wined3d: Give the cs its own state
3 files changed, 81 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index ccde86b..1ce55c6 100644
index 185def9..b128af1 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -63,6 +63,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_COLOR_KEY,
@@ -64,6 +64,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_MATERIAL,
WINED3D_CS_OP_RESET_STATE,
WINED3D_CS_OP_DESTROY_OBJECT,
+ WINED3D_CS_OP_STATEBLOCK,
WINED3D_CS_OP_STOP,
};
@@ -275,6 +276,12 @@ struct wined3d_cs_reset_state
enum wined3d_cs_op opcode;
@@ -283,6 +284,12 @@ struct wined3d_cs_destroy_object
void *object;
};
+struct wined3d_cs_stateblock
@ -34,7 +34,7 @@ index ccde86b..1ce55c6 100644
/* FIXME: The list synchronization probably isn't particularly fast. */
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
{
@@ -439,7 +446,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
@@ -447,7 +454,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[op->rect_count]);
device = cs->device;
@ -43,7 +43,7 @@ index ccde86b..1ce55c6 100644
device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
&cs->state.fb, op->rect_count, op->rects, &draw_rect, op->flags,
&op->color, op->depth, op->stencil);
@@ -466,7 +473,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
@@ -474,7 +481,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
{
@ -52,7 +52,7 @@ index ccde86b..1ce55c6 100644
const struct wined3d_cs_draw *op = data;
if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]
@@ -912,6 +919,55 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -920,6 +927,55 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
op->opcode = WINED3D_CS_OP_SET_TEXTURE;
op->stage = stage;
op->texture = texture;
@ -108,15 +108,15 @@ index ccde86b..1ce55c6 100644
cs->ops->submit(cs);
}
@@ -1262,6 +1318,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key,
@@ -1292,6 +1348,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material,
/* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state,
/* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object,
+ /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
@@ -1351,7 +1408,7 @@ done:
@@ -1381,7 +1438,7 @@ done:
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@ -125,7 +125,7 @@ index ccde86b..1ce55c6 100644
if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
return NULL;
@@ -1359,8 +1416,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1389,8 +1446,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (FAILED(state_init(&cs->state, gl_info, &device->adapter->d3d_info,
WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT)))
{
@ -135,7 +135,7 @@ index ccde86b..1ce55c6 100644
}
cs->ops = &wined3d_cs_st_ops;
@@ -1369,17 +1425,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1399,17 +1455,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
cs->data_size = WINED3D_INITIAL_CS_SIZE;
if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
{
@ -155,7 +155,7 @@ index ccde86b..1ce55c6 100644
}
if (wined3d_settings.cs_multithreaded)
@@ -1392,15 +1444,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1422,15 +1474,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL)))
{
ERR("Failed to create wined3d command stream thread.\n");
@ -212,7 +212,7 @@ index d48fbfa..33b7fc3 100644
start_idx, index_count, start_instance, instance_count, TRUE);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b6bbb9f..662f326 100644
index d4903f7..f27dc4e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2917,7 +2917,7 @@ struct wined3d_cs_block
@ -224,7 +224,7 @@ index b6bbb9f..662f326 100644
};
struct wined3d_cs_ops
@@ -2958,6 +2958,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -2960,6 +2960,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type,
UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;

View File

@ -1,4 +1,4 @@
From 5d9fe669f53bba48569e58eab46b21da0e0b322d Mon Sep 17 00:00:00 2001
From 7d7e3691cdb6482d0873883abc6a611e30f57edb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 20 Aug 2013 15:12:26 +0200
Subject: wined3d: Send float constant updates through the command stream
@ -10,19 +10,19 @@ Subject: wined3d: Send float constant updates through the command stream
3 files changed, 76 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 55cd5d6..2668244 100644
index b128af1..1c1987a 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -64,6 +64,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_MATERIAL,
@@ -65,6 +65,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_RESET_STATE,
WINED3D_CS_OP_DESTROY_OBJECT,
WINED3D_CS_OP_STATEBLOCK,
+ WINED3D_CS_OP_SET_VS_CONSTS_F,
+ WINED3D_CS_OP_SET_PS_CONSTS_F,
WINED3D_CS_OP_STOP,
};
@@ -280,6 +282,14 @@ struct wined3d_cs_stateblock
@@ -290,6 +292,14 @@ struct wined3d_cs_stateblock
struct wined3d_state state;
};
@ -37,7 +37,7 @@ index 55cd5d6..2668244 100644
/* FIXME: The list synchronization probably isn't particularly fast. */
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
{
@@ -922,11 +932,9 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi
@@ -942,11 +952,9 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi
memcpy(cs->state.vs_consts_b, op->state.vs_consts_b, sizeof(cs->state.vs_consts_b));
memcpy(cs->state.vs_consts_i, op->state.vs_consts_i, sizeof(cs->state.vs_consts_i));
@ -49,7 +49,7 @@ index 55cd5d6..2668244 100644
memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights));
@@ -948,11 +956,9 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win
@@ -967,11 +975,9 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win
memcpy(op->state.vs_consts_b, state->vs_consts_b, sizeof(op->state.vs_consts_b));
memcpy(op->state.vs_consts_i, state->vs_consts_i, sizeof(op->state.vs_consts_i));
@ -61,7 +61,7 @@ index 55cd5d6..2668244 100644
/* FIXME: This is not ideal. CS is still running synchronously, so this is ok.
* It will go away soon anyway. */
@@ -1032,6 +1038,64 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1051,6 +1057,64 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
cs->ops->submit(cs);
}
@ -126,9 +126,9 @@ index 55cd5d6..2668244 100644
static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_render_state *op = data;
@@ -1308,6 +1372,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material,
@@ -1349,6 +1413,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state,
/* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object,
/* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
+ /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f,
+ /* WINED3D_CS_OP_SET_PS_CONSTS_F */ wined3d_cs_exec_set_ps_consts_f,
@ -136,10 +136,10 @@ index 55cd5d6..2668244 100644
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5c10851..0142691 100644
index 33b7fc3..4b2ea91 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2501,7 +2501,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
@@ -2518,7 +2518,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
memset(&device->recording->changed.vs_consts_f[start_idx], 1,
count * sizeof(*device->recording->changed.vs_consts_f));
else
@ -149,7 +149,7 @@ index 5c10851..0142691 100644
return WINED3D_OK;
}
@@ -2735,7 +2736,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
@@ -2752,7 +2753,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
memset(&device->recording->changed.ps_consts_f[start_idx], 1,
count * sizeof(*device->recording->changed.ps_consts_f));
else
@ -160,10 +160,10 @@ index 5c10851..0142691 100644
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b167921..796a3d0 100644
index f27dc4e..07ca86c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2949,6 +2949,8 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -2996,6 +2996,8 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;

View File

@ -1,4 +1,4 @@
From 60240619668343b3c9e6c7aac3b3f053a0d3aa5b Mon Sep 17 00:00:00 2001
From e7526c85b4cb8c71e64234c9a3fa932f80261aa4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 9 Apr 2013 21:50:30 +0200
Subject: wined3d: Send bool constant updates through the command stream
@ -10,11 +10,11 @@ Subject: wined3d: Send bool constant updates through the command stream
3 files changed, 76 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 4f4f21b..4c9e11e 100644
index d240c33..ff98e30 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -65,7 +65,9 @@ enum wined3d_cs_op
WINED3D_CS_OP_RESET_STATE,
@@ -66,7 +66,9 @@ enum wined3d_cs_op
WINED3D_CS_OP_DESTROY_OBJECT,
WINED3D_CS_OP_STATEBLOCK,
WINED3D_CS_OP_SET_VS_CONSTS_F,
+ WINED3D_CS_OP_SET_VS_CONSTS_B,
@ -23,7 +23,7 @@ index 4f4f21b..4c9e11e 100644
WINED3D_CS_OP_GLFINISH,
WINED3D_CS_OP_SET_BASE_VERTEX_INDEX,
WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
@@ -293,6 +295,14 @@ struct wined3d_cs_set_consts_f
@@ -303,6 +305,14 @@ struct wined3d_cs_set_consts_f
struct wined3d_vec4 constants[1];
};
@ -38,7 +38,7 @@ index 4f4f21b..4c9e11e 100644
struct wined3d_cs_finish
{
enum wined3d_cs_op opcode;
@@ -961,10 +971,8 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi
@@ -982,10 +992,8 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi
/* Don't memcpy the entire struct, we'll remove single items as we add dedicated
* ops for setting states */
@ -49,7 +49,7 @@ index 4f4f21b..4c9e11e 100644
memcpy(cs->state.ps_consts_i, op->state.ps_consts_i, sizeof(cs->state.ps_consts_i));
memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights));
@@ -981,10 +989,8 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win
@@ -1002,10 +1010,8 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win
/* Don't memcpy the entire struct, we'll remove single items as we add dedicated
* ops for setting states */
@ -60,7 +60,7 @@ index 4f4f21b..4c9e11e 100644
memcpy(op->state.ps_consts_i, state->ps_consts_i, sizeof(op->state.ps_consts_i));
/* FIXME: This is not ideal. CS is still running synchronously, so this is ok.
@@ -1143,6 +1149,62 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -1164,6 +1170,62 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
op->value = value;
cs->ops->submit(cs);
@ -123,8 +123,8 @@ index 4f4f21b..4c9e11e 100644
}
static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data)
@@ -1471,7 +1533,9 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state,
@@ -1514,7 +1576,9 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object,
/* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
/* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f,
+ /* WINED3D_CS_OP_SET_VS_CONSTS_B */ wined3d_cs_exec_set_vs_consts_b,
@ -134,10 +134,10 @@ index 4f4f21b..4c9e11e 100644
/* WINED3D_CS_OP_SET_BASE_VERTEX_INDEX */ wined3d_cs_exec_set_base_vertex_index,
/* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 799d235..dfb4ceb 100644
index 0b8534a..1b2e7e3 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2353,7 +2353,7 @@ struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3
@@ -2370,7 +2370,7 @@ struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3
return device->state.sampler[WINED3D_SHADER_TYPE_VERTEX][idx];
}
@ -146,7 +146,7 @@ index 799d235..dfb4ceb 100644
{
UINT i;
@@ -2390,7 +2390,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
@@ -2407,7 +2407,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
}
else
{
@ -156,7 +156,7 @@ index 799d235..dfb4ceb 100644
}
return WINED3D_OK;
@@ -2624,7 +2625,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,
@@ -2641,7 +2642,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,
}
else
{
@ -167,10 +167,10 @@ index 799d235..dfb4ceb 100644
return WINED3D_OK;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 834a551..4fd446e 100644
index 016c5c6..eb91406 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2369,6 +2369,7 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -2416,6 +2416,7 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
@ -178,7 +178,7 @@ index 834a551..4fd446e 100644
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2949,6 +2950,8 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
@@ -2996,6 +2997,8 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx,
unsigned int count, const struct wined3d_vec4 *constants, enum wined3d_shader_type type) DECLSPEC_HIDDEN;

View File

@ -1,4 +1,4 @@
From 75acb9a0c48ad7285a75dfd319e19e551c7a88f2 Mon Sep 17 00:00:00 2001
From fb8eb9da970ffe7ce1d39a233375e113c8c5d48c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 10 Apr 2013 17:16:02 +0200
Subject: wined3d: Send light updates through the command stream
@ -10,18 +10,18 @@ Subject: wined3d: Send light updates through the command stream
3 files changed, 174 insertions(+), 64 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 943375a..e632d25 100644
index a7b8f79..556edc0 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -63,7 +63,6 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_COLOR_KEY,
@@ -64,7 +64,6 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_MATERIAL,
WINED3D_CS_OP_RESET_STATE,
WINED3D_CS_OP_DESTROY_OBJECT,
- WINED3D_CS_OP_STATEBLOCK,
WINED3D_CS_OP_SET_VS_CONSTS_F,
WINED3D_CS_OP_SET_VS_CONSTS_B,
WINED3D_CS_OP_SET_VS_CONSTS_I,
@@ -73,6 +72,8 @@ enum wined3d_cs_op
@@ -74,6 +73,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_GLFINISH,
WINED3D_CS_OP_SET_BASE_VERTEX_INDEX,
WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
@ -30,8 +30,8 @@ index 943375a..e632d25 100644
WINED3D_CS_OP_STOP,
};
@@ -285,12 +286,6 @@ struct wined3d_cs_reset_state
enum wined3d_cs_op opcode;
@@ -293,12 +294,6 @@ struct wined3d_cs_destroy_object
void *object;
};
-struct wined3d_cs_stateblock
@ -43,7 +43,7 @@ index 943375a..e632d25 100644
struct wined3d_cs_set_consts_f
{
enum wined3d_cs_op opcode;
@@ -332,6 +327,19 @@ struct wined3d_cs_set_primitive_type
@@ -340,6 +335,19 @@ struct wined3d_cs_set_primitive_type
GLenum gl_primitive_type;
};
@ -63,7 +63,7 @@ index 943375a..e632d25 100644
/* FIXME: The list synchronization probably isn't particularly fast. */
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
{
@@ -988,35 +996,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -996,35 +1004,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
cs->ops->submit(cs);
}
@ -99,7 +99,7 @@ index 943375a..e632d25 100644
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_shader_resource_view *op = data;
@@ -1575,6 +1554,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
@@ -1604,6 +1583,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
cs->ops->submit(cs);
}
@ -252,15 +252,15 @@ index 943375a..e632d25 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -1604,7 +1729,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key,
@@ -1634,7 +1759,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material,
/* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state,
/* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object,
- /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
/* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f,
/* WINED3D_CS_OP_SET_VS_CONSTS_B */ wined3d_cs_exec_set_vs_consts_b,
/* WINED3D_CS_OP_SET_VS_CONSTS_I */ wined3d_cs_exec_set_vs_consts_i,
@@ -1614,6 +1738,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1644,6 +1768,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
/* WINED3D_CS_OP_SET_BASE_VERTEX_INDEX */ wined3d_cs_exec_set_base_vertex_index,
/* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
@ -356,7 +356,7 @@ index 766e393..cb6f2ee 100644
start_idx, index_count, start_instance, instance_count, TRUE);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7c7009b..cd42a74 100644
index fe1cd27..0cf9522 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2913,7 +2913,9 @@ struct wined3d_cs_block
@ -370,7 +370,7 @@ index 7c7009b..cd42a74 100644
};
struct wined3d_cs_ops
@@ -2957,8 +2959,6 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -2959,8 +2961,6 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type,
UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
@ -379,7 +379,7 @@ index 7c7009b..cd42a74 100644
void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs,
struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
@@ -3004,6 +3004,8 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
@@ -3006,6 +3006,8 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
UINT base_vertex_index) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs,
GLenum primitive_type) DECLSPEC_HIDDEN;

View File

@ -1,15 +1,15 @@
From 4e89489b010072ddcd86bdd213efa01edc6aa12e Mon Sep 17 00:00:00 2001
From 3ffcccfe4b97290f5a206933ce25b0737806066b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 4 Jul 2013 23:33:14 +0200
Subject: wined3d: Replace the linked lists with a ringbuffer
---
dlls/wined3d/cs.c | 363 +++++++++++++++++------------------------
dlls/wined3d/cs.c | 365 +++++++++++++++++------------------------
dlls/wined3d/wined3d_private.h | 20 +--
2 files changed, 161 insertions(+), 222 deletions(-)
2 files changed, 162 insertions(+), 223 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 5397fc7..ae9ef50 100644
index 68c7142..d1eb571 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -22,20 +22,10 @@
@ -35,7 +35,7 @@ index 5397fc7..ae9ef50 100644
WINED3D_CS_OP_FENCE,
WINED3D_CS_OP_PRESENT,
WINED3D_CS_OP_CLEAR,
@@ -383,99 +373,30 @@ struct wined3d_cs_texture_unmap
@@ -392,99 +382,30 @@ struct wined3d_cs_texture_unmap
unsigned int sub_resource_idx;
};
@ -149,7 +149,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_fence(struct wined3d_cs *cs, const void *data)
@@ -496,14 +417,14 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled)
@@ -505,14 +426,14 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled)
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_FENCE;
op->signalled = signalled;
@ -166,7 +166,7 @@ index 5397fc7..ae9ef50 100644
/* A busy wait should be fine, we're not supposed to have to wait very
* long. */
@@ -542,7 +463,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -551,7 +472,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
pending = InterlockedIncrement(&cs->pending_presents);
@ -175,7 +175,7 @@ index 5397fc7..ae9ef50 100644
while (pending > 1)
pending = InterlockedCompareExchange(&cs->pending_presents, 0, 0);
@@ -568,8 +489,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
@@ -577,8 +498,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
{
struct wined3d_cs_clear *op;
@ -186,7 +186,7 @@ index 5397fc7..ae9ef50 100644
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags;
op->color = *color;
@@ -578,7 +499,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
@@ -587,7 +508,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
op->rect_count = rect_count;
memcpy(op->rects, rects, sizeof(*rects) * rect_count);
@ -195,7 +195,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
@@ -619,7 +540,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun
@@ -637,7 +558,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
op->instance_count = instance_count;
op->indexed = indexed;
@ -204,7 +204,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data)
@@ -641,7 +562,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
@@ -659,7 +580,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
op->predicate = predicate;
op->value = value;
@ -213,7 +213,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data)
@@ -662,7 +583,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -680,7 +601,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
op->opcode = WINED3D_CS_OP_SET_VIEWPORT;
op->viewport = *viewport;
@ -222,7 +222,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data)
@@ -683,7 +604,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -701,7 +622,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT;
op->rect = *rect;
@ -231,7 +231,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data)
@@ -706,7 +627,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
@@ -724,7 +645,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
op->view_idx = view_idx;
op->view = view;
@ -240,7 +240,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data)
@@ -760,7 +681,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
@@ -778,7 +699,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW;
op->view = view;
@ -249,7 +249,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data)
@@ -781,7 +702,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
@@ -799,7 +720,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION;
op->declaration = declaration;
@ -258,7 +258,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data)
@@ -818,7 +739,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -836,7 +757,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
op->offset = offset;
op->stride = stride;
@ -267,7 +267,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data)
@@ -845,7 +766,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
@@ -863,7 +784,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
op->frequency = frequency;
op->flags = flags;
@ -276,7 +276,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data)
@@ -878,7 +799,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -896,7 +817,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
op->buffer = buffer;
op->offset = offset;
@ -285,7 +285,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data)
@@ -912,7 +833,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -930,7 +851,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
op->format_id = format_id;
op->offset = offset;
@ -294,7 +294,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data)
@@ -943,7 +864,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
@@ -961,7 +882,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
op->cb_idx = cb_idx;
op->buffer = buffer;
@ -303,7 +303,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
@@ -1035,7 +956,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -1053,7 +974,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
op->opcode = WINED3D_CS_OP_SET_TEXTURE;
op->stage = stage;
op->texture = texture;
@ -312,7 +312,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
@@ -1059,7 +980,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
@@ -1077,7 +998,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
op->view_idx = view_idx;
op->view = view;
@ -321,7 +321,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data)
@@ -1083,7 +1004,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1101,7 +1022,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
op->sampler_idx = sampler_idx;
op->sampler = sampler;
@ -330,7 +330,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
@@ -1106,7 +1027,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1124,7 +1045,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
op->type = type;
op->shader = shader;
@ -339,7 +339,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_vs_consts_f(struct wined3d_cs *cs, const void *data)
@@ -1139,8 +1060,9 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1157,8 +1078,9 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx,
const struct wined3d_vec4 *constants, enum wined3d_shader_type type)
{
struct wined3d_cs_set_consts_f *op;
@ -350,7 +350,7 @@ index 5397fc7..ae9ef50 100644
switch (type)
{
case WINED3D_SHADER_TYPE_PIXEL:
@@ -1164,7 +1086,7 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1182,7 +1104,7 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx,
op->count = count;
memcpy(op->constants, constants, sizeof(op->constants[0]) * count);
@ -359,7 +359,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data)
@@ -1186,8 +1108,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -1204,8 +1126,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
op->state = state;
op->value = value;
@ -370,7 +370,7 @@ index 5397fc7..ae9ef50 100644
static UINT wined3d_cs_exec_set_vs_consts_b(struct wined3d_cs *cs, const void *data)
{
@@ -1217,8 +1139,9 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1235,8 +1157,9 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx,
unsigned int count, const BOOL *constants, enum wined3d_shader_type type)
{
struct wined3d_cs_set_consts_b *op;
@ -381,7 +381,7 @@ index 5397fc7..ae9ef50 100644
switch (type)
{
case WINED3D_SHADER_TYPE_PIXEL:
@@ -1242,7 +1165,7 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1260,7 +1183,7 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx,
op->count = count;
memcpy(op->constants, constants, sizeof(op->constants[0]) * count);
@ -390,7 +390,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_vs_consts_i(struct wined3d_cs *cs, const void *data)
@@ -1273,8 +1196,9 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1291,8 +1214,9 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx,
const struct wined3d_ivec4 *constants, enum wined3d_shader_type type)
{
struct wined3d_cs_set_consts_i *op;
@ -401,7 +401,7 @@ index 5397fc7..ae9ef50 100644
switch (type)
{
case WINED3D_SHADER_TYPE_PIXEL:
@@ -1298,7 +1222,7 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1316,7 +1240,7 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx,
op->count = count;
memcpy(op->constants, constants, sizeof(op->constants[0]) * count);
@ -410,7 +410,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data)
@@ -1322,7 +1246,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1340,7 +1264,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
op->state = state;
op->value = value;
@ -419,7 +419,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data)
@@ -1346,7 +1270,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1364,7 +1288,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
op->state = state;
op->value = value;
@ -428,7 +428,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data)
@@ -1370,7 +1294,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -1388,7 +1312,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
op->state = state;
op->matrix = *matrix;
@ -437,7 +437,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data)
@@ -1392,7 +1316,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -1410,7 +1334,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
op->plane_idx = plane_idx;
op->plane = *plane;
@ -446,7 +446,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data)
@@ -1477,7 +1401,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -1495,7 +1419,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
else
op->set = 0;
@ -455,7 +455,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data)
@@ -1498,7 +1422,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1516,7 +1440,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
op->material = *material;
@ -464,16 +464,25 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
@@ -1522,7 +1446,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1540,7 +1464,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_RESET_STATE;
- cs->ops->submit(cs);
+ cs->ops->submit(cs, sizeof(*op));
}
static UINT wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data)
@@ -1561,7 +1485,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
op->callback = callback;
op->object = object;
- cs->ops->submit(cs);
+ cs->ops->submit(cs, sizeof(*op));
}
static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data)
@@ -1548,7 +1472,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
@@ -1587,7 +1511,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_GLFINISH;
@ -482,7 +491,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_base_vertex_index(struct wined3d_cs *cs, const void *data)
@@ -1570,7 +1494,7 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
@@ -1609,7 +1533,7 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
op->opcode = WINED3D_CS_OP_SET_BASE_VERTEX_INDEX;
op->base_vertex_index = base_vertex_index;
@ -491,7 +500,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data)
@@ -1596,7 +1520,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
@@ -1635,7 +1559,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE;
op->gl_primitive_type = primitive_type;
@ -500,7 +509,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
@@ -1653,7 +1577,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
@@ -1692,7 +1616,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
op->opcode = WINED3D_CS_OP_SET_LIGHT;
op->light = *light;
@ -509,7 +518,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data)
@@ -1742,7 +1666,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
@@ -1781,7 +1705,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
op->idx = idx;
op->enable = enable;
@ -518,7 +527,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data)
@@ -1774,7 +1698,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
@@ -1813,7 +1737,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
if (fx)
op->fx = *fx;
@ -527,7 +536,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data)
@@ -1807,7 +1731,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
@@ -1846,7 +1770,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
op->stencil = stencil;
op->blitter = blitter;
@ -536,7 +545,7 @@ index 5397fc7..ae9ef50 100644
}
static UINT wined3d_cs_exec_texture_map(struct wined3d_cs *cs, const void *data)
@@ -1832,12 +1756,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture
@@ -1871,12 +1795,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture
op->flags = flags;
op->mem = &ret;
@ -552,7 +561,7 @@ index 5397fc7..ae9ef50 100644
return ret;
}
@@ -1860,11 +1786,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture
@@ -1899,11 +1825,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
@ -567,7 +576,7 @@ index 5397fc7..ae9ef50 100644
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
@@ -1909,42 +1837,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1949,42 +1877,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap,
};
@ -650,7 +659,7 @@ index 5397fc7..ae9ef50 100644
};
/* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an
@@ -1956,9 +1901,38 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
@@ -1996,9 +1941,38 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
op = wined3d_cs_mt_require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_STOP;
@ -690,7 +699,7 @@ index 5397fc7..ae9ef50 100644
void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs,
struct wined3d_context *context, struct wined3d_surface *depth_stencil)
{
@@ -1982,31 +1956,32 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs,
@@ -2022,31 +1996,32 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs,
static DWORD WINAPI wined3d_cs_run(void *thread_param)
{
struct wined3d_cs *cs = thread_param;
@ -737,7 +746,7 @@ index 5397fc7..ae9ef50 100644
}
done:
@@ -2031,25 +2006,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2071,25 +2046,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
cs->ops = &wined3d_cs_st_ops;
cs->device = device;
@ -763,7 +772,7 @@ index 5397fc7..ae9ef50 100644
if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL)))
{
ERR("Failed to create wined3d command stream thread.\n");
@@ -2061,12 +2021,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2101,12 +2061,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
err:
if (cs)
@ -776,7 +785,7 @@ index 5397fc7..ae9ef50 100644
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
}
@@ -2085,17 +2040,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
@@ -2125,17 +2080,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
CloseHandle(cs->thread);
if (ret != WAIT_OBJECT_0)
ERR("Wait failed (%#x).\n", ret);
@ -795,7 +804,7 @@ index 5397fc7..ae9ef50 100644
HeapFree(GetProcessHeap(), 0, cs);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 51eb280..e13880a 100644
index 159f79e..4ea1f51 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -31,6 +31,7 @@
@ -806,7 +815,7 @@ index 51eb280..e13880a 100644
#include <stdarg.h>
#include <math.h>
#include <limits.h>
@@ -2898,19 +2899,17 @@ struct wined3d_cs_list
@@ -2916,19 +2917,17 @@ struct wined3d_cs_list
struct list blocks;
};
@ -831,7 +840,7 @@ index 51eb280..e13880a 100644
void (*finish)(struct wined3d_cs *cs);
};
@@ -2921,14 +2920,9 @@ struct wined3d_cs
@@ -2939,14 +2938,9 @@ struct wined3d_cs
struct wined3d_state state;
HANDLE thread;
DWORD thread_id;

View File

@ -1,92 +1,18 @@
From 6b9da441bf00c2b644a4bc85dcfea976f78edae3 Mon Sep 17 00:00:00 2001
From 21fc0b94f7981bc3bc1450835abd5534723072c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 21 Aug 2014 22:47:58 +0200
Subject: wined3d: Destroy views through the CS.
Move this ahead. This has caused sporadic test failures ever since blits were moved to the CS.
---
dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++
dlls/wined3d/view.c | 13 ++++++-------
dlls/wined3d/wined3d_private.h | 3 +++
3 files changed, 37 insertions(+), 7 deletions(-)
dlls/wined3d/view.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index f0b21c0..ecb9d9e 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -78,6 +78,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UPDATE_TEXTURE,
WINED3D_CS_OP_EVICT_RESOURCE,
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
+ WINED3D_CS_OP_VIEW_DESTROY,
WINED3D_CS_OP_STOP,
};
@@ -454,6 +455,12 @@ struct wined3d_cs_buffer_preload
struct wined3d_buffer *buffer;
};
+struct wined3d_cs_view_destroy
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_rendertarget_view *view;
+};
+
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2334,6 +2341,26 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer
cs->ops->submit(cs, sizeof(*op));
}
+static UINT wined3d_cs_exec_view_destroy(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_view_destroy *op = data;
+
+ wined3d_rendertarget_view_destroy(op->view);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view)
+{
+ struct wined3d_cs_view_destroy *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_VIEW_DESTROY;
+ op->view = view;
+
+ cs->ops->submit(cs, sizeof(*op));
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2390,6 +2417,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture,
/* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource,
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
+ /* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy,
};
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 5ad4ab0..1a8e88c 100644
index b4bc771..2147cc7 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -33,6 +33,11 @@ ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *v
return refcount;
}
+void wined3d_rendertarget_view_destroy(struct wined3d_rendertarget_view *view)
+{
+ HeapFree(GetProcessHeap(), 0, view);
+}
+
ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view)
{
ULONG refcount = InterlockedDecrement(&view->refcount);
@@ -43,17 +48,11 @@ ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *v
@@ -48,12 +48,6 @@ ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *v
{
struct wined3d_device *device = view->resource->device;
@ -99,33 +25,6 @@ index 5ad4ab0..1a8e88c 100644
/* Call wined3d_object_destroyed() before releasing the resource,
* since releasing the resource may end up destroying the parent. */
view->parent_ops->wined3d_object_destroyed(view->parent);
wined3d_resource_decref(view->resource);
- HeapFree(GetProcessHeap(), 0, view);
+ wined3d_cs_emit_view_destroy(device->cs, view);
}
return refcount;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b5b0246..4714ca7 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3038,6 +3038,7 @@ void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffe
void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs,
struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN;
void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN;
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
@@ -3162,6 +3163,8 @@ static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface(
return texture->sub_resources[view->sub_resource_idx].u.surface;
}
+void wined3d_rendertarget_view_destroy(struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN;
+
struct wined3d_shader_resource_view
{
LONG refcount;
--
2.8.0

View File

@ -1,85 +1,24 @@
From 6d92669e1105b8631d662e6a9b1fd563e93ba090 Mon Sep 17 00:00:00 2001
From 60b42d6c2c6d5d2ce0dde5925a5873a4a051842e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 31 Jul 2013 23:06:27 +0200
Subject: wined3d: Destroy vertex declarations through the CS
---
dlls/wined3d/cs.c | 29 +++++++++++++++++++++++++++++
dlls/wined3d/vertexdeclaration.c | 15 ++++++++-------
dlls/wined3d/wined3d_private.h | 4 ++++
3 files changed, 41 insertions(+), 7 deletions(-)
dlls/wined3d/vertexdeclaration.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index ecb9d9e..9b195f9 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -79,6 +79,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_EVICT_RESOURCE,
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
WINED3D_CS_OP_VIEW_DESTROY,
+ WINED3D_CS_OP_VDECL_DESTROY,
WINED3D_CS_OP_STOP,
};
@@ -461,6 +462,12 @@ struct wined3d_cs_view_destroy
struct wined3d_rendertarget_view *view;
};
+struct wined3d_cs_vertex_declaration_destroy
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_vertex_declaration *declaration;
+};
+
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2361,6 +2368,27 @@ void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_renderta
cs->ops->submit(cs, sizeof(*op));
}
+static UINT wined3d_cs_exec_vertex_declaration_destroy(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_vertex_declaration_destroy *op = data;
+
+ wined3d_vertex_declaration_destroy(op->declaration);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs,
+ struct wined3d_vertex_declaration *declaration)
+{
+ struct wined3d_cs_vertex_declaration_destroy *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_VDECL_DESTROY;
+ op->declaration = declaration;
+
+ cs->ops->submit(cs, sizeof(*op));
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2418,6 +2446,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource,
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
/* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy,
+ /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy,
};
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index 601a5f5..2a1f6a2 100644
index 3349f4f..808e092 100644
--- a/dlls/wined3d/vertexdeclaration.c
+++ b/dlls/wined3d/vertexdeclaration.c
@@ -50,6 +50,12 @@ ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration
@@ -50,6 +50,14 @@ ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration
return refcount;
}
+void wined3d_vertex_declaration_destroy(struct wined3d_vertex_declaration *declaration)
+static void wined3d_vertex_declaration_destroy_object(void *object)
+{
+ struct wined3d_vertex_declaration *declaration = object;
+
+ HeapFree(GetProcessHeap(), 0, declaration->elements);
+ HeapFree(GetProcessHeap(), 0, declaration);
+}
@ -87,7 +26,7 @@ index 601a5f5..2a1f6a2 100644
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)
{
ULONG refcount = InterlockedDecrement(&declaration->ref);
@@ -58,14 +64,9 @@ ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration
@@ -58,14 +66,9 @@ ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration
if (!refcount)
{
@ -100,32 +39,10 @@ index 601a5f5..2a1f6a2 100644
+ const struct wined3d_device *device = declaration->device;
declaration->parent_ops->wined3d_object_destroyed(declaration->parent);
- HeapFree(GetProcessHeap(), 0, declaration);
+ wined3d_cs_emit_vertex_declaration_destroy(device->cs, declaration);
+ wined3d_cs_emit_destroy_object(device->cs, wined3d_vertex_declaration_destroy_object, declaration);
}
return refcount;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4714ca7..a6b8142 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2834,6 +2834,8 @@ struct wined3d_vertex_declaration
BOOL half_float_conv_needed;
};
+void wined3d_vertex_declaration_destroy(struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
+
struct wined3d_saved_states
{
DWORD transform[(HIGHEST_TRANSFORMSTATE >> 5) + 1];
@@ -3039,6 +3041,8 @@ void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs,
struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN;
void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs,
+ struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
--
2.8.0

View File

@ -1,89 +1,32 @@
From 2c2611d940789f2697c8eb515b284fafd53a0f5f Mon Sep 17 00:00:00 2001
From 2bba243cce7043d8cbac3f670d994a032db0fc77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 31 Jul 2013 23:18:28 +0200
Subject: wined3d: Destroy shaders through the CS
---
dlls/wined3d/cs.c | 29 +++++++++++++++++++++++++++++
dlls/wined3d/shader.c | 12 ++++--------
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 35 insertions(+), 8 deletions(-)
dlls/wined3d/shader.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 9b195f9..b58cc89 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -80,6 +80,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
WINED3D_CS_OP_VIEW_DESTROY,
WINED3D_CS_OP_VDECL_DESTROY,
+ WINED3D_CS_OP_SHADER_CLEANUP,
WINED3D_CS_OP_STOP,
};
@@ -468,6 +469,12 @@ struct wined3d_cs_vertex_declaration_destroy
struct wined3d_vertex_declaration *declaration;
};
+struct wined3d_cs_shader_cleanup
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_shader *shader;
+};
+
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2389,6 +2396,27 @@ void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs,
cs->ops->submit(cs, sizeof(*op));
}
+static UINT wined3d_cs_exec_shader_cleanup(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_shader_cleanup *op = data;
+
+ shader_cleanup(op->shader);
+ HeapFree(GetProcessHeap(), 0, op->shader);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader *shader)
+{
+ struct wined3d_cs_shader_cleanup *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SHADER_CLEANUP;
+ op->shader = shader;
+
+ cs->ops->submit(cs, sizeof(*op));
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2447,6 +2475,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
/* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy,
/* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy,
+ /* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup,
};
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 21ecdd5..8b10fa5 100644
index 72ea8bc..f5e29b4 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -2309,7 +2309,7 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
string_buffer_free(&buffer);
@@ -2612,6 +2612,14 @@ ULONG CDECL wined3d_shader_incref(struct wined3d_shader *shader)
return refcount;
}
-static void shader_cleanup(struct wined3d_shader *shader)
+void shader_cleanup(struct wined3d_shader *shader)
+static void wined3d_shader_destroy_object(void *object)
+{
+ struct wined3d_shader *shader = object;
+
+ shader_cleanup(shader);
+ HeapFree(GetProcessHeap(), 0, shader);
+}
+
ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader)
{
HeapFree(GetProcessHeap(), 0, shader->output_signature.elements);
HeapFree(GetProcessHeap(), 0, shader->input_signature.elements);
@@ -2578,14 +2578,10 @@ ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader)
ULONG refcount = InterlockedDecrement(&shader->ref);
@@ -2620,14 +2628,10 @@ ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader)
if (!refcount)
{
@ -97,30 +40,10 @@ index 21ecdd5..8b10fa5 100644
+
shader->parent_ops->wined3d_object_destroyed(shader->parent);
- HeapFree(GetProcessHeap(), 0, shader);
+ wined3d_cs_emit_shader_cleanup(device->cs, shader);
+ wined3d_cs_emit_destroy_object(device->cs, wined3d_shader_destroy_object, shader);
}
return refcount;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index a6b8142..44a77ce 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3043,6 +3043,7 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer
void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN;
void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN;
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
@@ -3425,6 +3426,7 @@ unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_map
void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer,
const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN;
BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN;
+void shader_cleanup(struct wined3d_shader *shader) DECLSPEC_HIDDEN;
static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg)
{
--
2.8.0

View File

@ -1,4 +1,4 @@
From c7a8885b345150606ee93c1ada440109f8e26126 Mon Sep 17 00:00:00 2001
From 9b3cf0aa76222ef02934a1689065411f5a2c3ac2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 2 Oct 2013 21:47:08 +0200
Subject: wined3d: Create VBOs through the command stream.
@ -44,19 +44,19 @@ index 5566c1e..b611daf 100644
flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index bd40193..badc0b1 100644
index 477af0b..f501fa4 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -81,6 +81,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_VIEW_DESTROY,
WINED3D_CS_OP_VDECL_DESTROY,
WINED3D_CS_OP_SHADER_CLEANUP,
@@ -79,6 +79,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UPDATE_TEXTURE,
WINED3D_CS_OP_EVICT_RESOURCE,
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
+ WINED3D_CS_OP_CREATE_VBO,
WINED3D_CS_OP_STOP,
};
@@ -478,6 +479,12 @@ struct wined3d_cs_shader_cleanup
struct wined3d_shader *shader;
@@ -467,6 +468,12 @@ struct wined3d_cs_buffer_preload
struct wined3d_buffer *buffer;
};
+struct wined3d_cs_create_vbo
@ -68,7 +68,7 @@ index bd40193..badc0b1 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2411,6 +2418,30 @@ void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader
@@ -2370,6 +2377,30 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer
cs->ops->submit(cs, sizeof(*op));
}
@ -99,27 +99,27 @@ index bd40193..badc0b1 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2470,6 +2501,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy,
/* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy,
/* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup,
@@ -2427,6 +2458,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture,
/* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource,
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
+ /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo,
};
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4bf5313..0cfe28a 100644
index 399e310..012494d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3066,6 +3066,7 @@ void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_renderta
void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN;
@@ -3085,6 +3085,7 @@ void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffe
void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs,
struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN;
void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
@@ -3158,6 +3159,8 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
@@ -3177,6 +3178,8 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN;
void buffer_invalidate_bo_range(struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN;
void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) DECLSPEC_HIDDEN;

View File

@ -1,4 +1,4 @@
From 790ed84dedaba0c7dbbb31c28d6d304cf92c312b Mon Sep 17 00:00:00 2001
From c2e47132931b0ace4129f74f3905732be5575277 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 2 Oct 2013 22:38:51 +0200
Subject: wined3d: Clean up resource data through the CS.
@ -13,10 +13,10 @@ Subject: wined3d: Clean up resource data through the CS.
6 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 62360c0..348a24a 100644
index b611daf..e1ce265 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -571,6 +571,9 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
@@ -570,6 +570,9 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
}
resource_cleanup(&buffer->resource);
@ -26,7 +26,7 @@ index 62360c0..348a24a 100644
buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent);
HeapFree(GetProcessHeap(), 0, buffer->maps);
HeapFree(GetProcessHeap(), 0, buffer);
@@ -1357,6 +1360,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
@@ -1354,6 +1357,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
ERR("Out of memory.\n");
buffer_unload(&buffer->resource);
resource_cleanup(&buffer->resource);
@ -35,7 +35,7 @@ index 62360c0..348a24a 100644
return E_OUTOFMEMORY;
}
buffer->maps_size = 1;
@@ -1367,6 +1372,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
@@ -1364,6 +1369,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
buffer_unload(&buffer->resource);
resource_cleanup(&buffer->resource);
HeapFree(GetProcessHeap(), 0, buffer->maps);
@ -45,18 +45,18 @@ index 62360c0..348a24a 100644
}
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index badc0b1..d727e71 100644
index f501fa4..fec2ac3 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -82,6 +82,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_VDECL_DESTROY,
WINED3D_CS_OP_SHADER_CLEANUP,
@@ -80,6 +80,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_EVICT_RESOURCE,
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
WINED3D_CS_OP_CREATE_VBO,
+ WINED3D_CS_OP_RESOURCE_CLEANUP,
WINED3D_CS_OP_STOP,
};
@@ -485,6 +486,12 @@ struct wined3d_cs_create_vbo
@@ -474,6 +475,12 @@ struct wined3d_cs_create_vbo
struct wined3d_buffer *buffer;
};
@ -69,7 +69,7 @@ index badc0b1..d727e71 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2442,6 +2449,26 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu
@@ -2401,6 +2408,26 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu
cs->ops->finish_prio(cs);
}
@ -96,19 +96,19 @@ index badc0b1..d727e71 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2502,6 +2529,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy,
/* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup,
@@ -2459,6 +2486,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource,
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
/* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo,
+ /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup,
};
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index b35fa06..627eca6 100644
index f1c8eae..5bf3dfb 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4982,8 +4982,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
@@ -5000,8 +5000,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type));
@ -148,7 +148,7 @@ index 9acc7be..3af6851 100644
void resource_unload(struct wined3d_resource *resource)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index eacdca1..8190279 100644
index d810267..53dfea6 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -521,6 +521,8 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
@ -161,10 +161,10 @@ index eacdca1..8190279 100644
void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0cfe28a..e0ce86e 100644
index 012494d..0477ef9 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2484,6 +2484,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
@@ -2507,6 +2507,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN;
void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
@ -172,9 +172,9 @@ index 0cfe28a..e0ce86e 100644
void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN;
GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN;
@@ -3067,6 +3068,8 @@ void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN;
@@ -3086,6 +3087,8 @@ void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs,
struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN;
void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
+ struct wined3d_resource *resource) DECLSPEC_HIDDEN;

View File

@ -1,24 +1,23 @@
From aaf9ef9f3a7faffd7be99a68a8d788c71db7b376 Mon Sep 17 00:00:00 2001
From 0be542d41f7f87ac5b400b92dcca2c0cb9c63f52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 2 Oct 2013 22:50:08 +0200
Subject: wined3d: Clean up buffer resource data through the CS.
---
dlls/wined3d/buffer.c | 39 ++++++++++++++++++++-------------------
dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 50 insertions(+), 19 deletions(-)
dlls/wined3d/buffer.c | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index b06c502..c4d9740 100644
index e1ce265..31c2629 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -553,37 +553,38 @@ static void buffer_unload(struct wined3d_resource *resource)
@@ -545,37 +545,39 @@ static void buffer_unload(struct wined3d_resource *resource)
resource_unload(resource);
}
+void wined3d_buffer_cleanup_cs(struct wined3d_buffer *buffer)
+static void wined3d_buffer_destroy_object(void *object)
+{
+ struct wined3d_buffer *buffer = object;
+ struct wined3d_context *context;
+ struct wined3d_device *device = buffer->resource.device;
+
@ -67,90 +66,10 @@ index b06c502..c4d9740 100644
buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent);
- HeapFree(GetProcessHeap(), 0, buffer->maps);
- HeapFree(GetProcessHeap(), 0, buffer);
+ wined3d_cs_emit_buffer_cleanup(device->cs, buffer);
+ wined3d_cs_emit_destroy_object(device->cs, wined3d_buffer_destroy_object, buffer);
}
return refcount;
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index f8c14ce..b08ca4b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -83,6 +83,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SHADER_CLEANUP,
WINED3D_CS_OP_CREATE_VBO,
WINED3D_CS_OP_RESOURCE_CLEANUP,
+ WINED3D_CS_OP_BUFFER_CLEANUP,
WINED3D_CS_OP_STOP,
};
@@ -489,6 +490,12 @@ struct wined3d_cs_resource_cleanup
struct wined3d_resource *resource;
};
+struct wined3d_cs_buffer_cleanup
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_buffer *buffer;
+};
+
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2475,6 +2482,26 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, struct wined3d_reso
cs->ops->submit(cs, sizeof(*op));
}
+static UINT wined3d_cs_exec_buffer_cleanup(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_buffer_cleanup *op = data;
+
+ wined3d_buffer_cleanup_cs(op->buffer);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer)
+{
+ struct wined3d_cs_buffer_cleanup *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_BUFFER_CLEANUP;
+ op->buffer = buffer;
+
+ cs->ops->submit(cs, sizeof(*op));
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2536,6 +2563,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup,
/* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo,
/* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup,
+ /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup,
};
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0f16e5f..3d972d3 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3048,6 +3048,7 @@ void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader
void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
struct wined3d_resource *resource) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
@@ -3142,6 +3143,7 @@ void buffer_invalidate_bo_range(struct wined3d_buffer *buffer, unsigned int offs
void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) DECLSPEC_HIDDEN;
void buffer_create_buffer_object(struct wined3d_buffer *This,
struct wined3d_context *context) DECLSPEC_HIDDEN;
+void wined3d_buffer_cleanup_cs(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
struct wined3d_rendertarget_view
{
--
2.8.0

View File

@ -1,89 +1,29 @@
From 964c9547663bccec6e1dc8d1e6de8c66d1651d99 Mon Sep 17 00:00:00 2001
From 70d900c4a460e27e5b6da3de623df8fffa0b9b68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sat, 7 May 2016 13:02:33 +0100
Subject: wined3d: Clean up textures through the command stream.
FIXME: This HeapFree stuff when creation fails is ugly.
---
dlls/wined3d/cs.c | 28 +++++++++++++++
dlls/wined3d/texture.c | 79 ++++++++++++++++++++++--------------------
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 72 insertions(+), 37 deletions(-)
dlls/wined3d/texture.c | 82 +++++++++++++++++++++++++++-----------------------
1 file changed, 44 insertions(+), 38 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 5a521d3..452b16f 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -84,6 +84,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_CREATE_VBO,
WINED3D_CS_OP_RESOURCE_CLEANUP,
WINED3D_CS_OP_BUFFER_CLEANUP,
+ WINED3D_CS_OP_TEXTURE_CLEANUP,
WINED3D_CS_OP_STOP,
};
@@ -499,6 +500,12 @@ struct wined3d_cs_buffer_cleanup
struct wined3d_buffer *buffer;
};
+struct wined3d_cs_texture_cleanup
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_texture *texture;
+};
+
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2496,6 +2503,26 @@ void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer
cs->ops->submit(cs, sizeof(*op));
}
+static UINT wined3d_cs_exec_texture_cleanup(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_texture_cleanup *op = data;
+
+ wined3d_texture_cleanup(op->texture);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture)
+{
+ struct wined3d_cs_texture_cleanup *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_TEXTURE_CLEANUP;
+ op->texture = texture;
+
+ cs->ops->submit(cs, sizeof(*op));
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2558,6 +2585,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo,
/* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup,
/* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup,
+ /* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup,
};
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 4db6bb4..4a4c4f8 100644
index 53dfea6..18e71ff 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -404,7 +404,7 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture)
@@ -479,8 +479,9 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture)
resource_unload(&texture->resource);
}
-static void wined3d_texture_cleanup(struct wined3d_texture *texture)
+void wined3d_texture_cleanup(struct wined3d_texture *texture)
+static void wined3d_texture_destroy_object(void *object)
{
+ struct wined3d_texture *texture = object;
unsigned int sub_count = texture->level_count * texture->layer_count;
struct wined3d_device *device = texture->resource.device;
@@ -414,12 +414,6 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
struct wined3d_context *context = NULL;
@@ -489,12 +490,6 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
TRACE("texture %p.\n", texture);
@ -96,7 +36,16 @@ index 4db6bb4..4a4c4f8 100644
for (i = 0; i < sub_count; ++i)
{
if (texture->sub_resources[i].buffer != texture->sub_resources[i].map_buffer)
@@ -445,9 +439,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
@@ -506,7 +501,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
TRACE("Deleting buffer object %u.\n", buffer->name);
- /* We may not be able to get a context in wined3d_texture_cleanup() in
+ /* We may not be able to get a context in wined3d_texture_destroy_object() in
* general, but if a buffer object was previously created we can. */
if (!context)
context = context_acquire(device, NULL);
@@ -520,9 +515,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
texture->texture_ops->texture_cleanup_sub_resources(texture);
wined3d_texture_unload_gl_texture(texture);
@ -107,7 +56,7 @@ index 4db6bb4..4a4c4f8 100644
}
void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain)
@@ -741,6 +733,23 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
@@ -816,6 +809,23 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
return refcount;
}
@ -125,13 +74,13 @@ index 4db6bb4..4a4c4f8 100644
+ }
+
+ resource_cleanup(&texture->resource);
+ wined3d_cs_emit_texture_cleanup(device->cs, texture);
+ wined3d_cs_emit_destroy_object(device->cs, wined3d_texture_destroy_object, texture);
+}
+
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
{
ULONG refcount;
@@ -755,9 +764,8 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
@@ -830,9 +840,8 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
if (!refcount)
{
@ -142,7 +91,7 @@ index 4db6bb4..4a4c4f8 100644
}
return refcount;
@@ -1502,8 +1510,6 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture)
@@ -1546,8 +1555,6 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture)
list_remove(&overlay->overlay_entry);
overlay->overlay_dest = NULL;
}
@ -151,7 +100,7 @@ index 4db6bb4..4a4c4f8 100644
}
if (context)
context_release(context);
@@ -1903,6 +1909,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -1947,6 +1954,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
&& !gl_info->supported[EXT_TEXTURE_ARRAY])
{
WARN("OpenGL implementation does not support array textures.\n");
@ -159,7 +108,7 @@ index 4db6bb4..4a4c4f8 100644
return WINED3DERR_INVALIDCALL;
}
@@ -1911,6 +1918,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -1955,6 +1963,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if (WINED3DFMT_UNKNOWN >= desc->format)
{
WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture);
@ -167,7 +116,7 @@ index 4db6bb4..4a4c4f8 100644
return WINED3DERR_INVALIDCALL;
}
@@ -1933,6 +1941,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -1977,6 +1986,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if (desc->pool != WINED3D_POOL_SCRATCH)
{
WARN("Attempted to create a mipmapped/cube/array NPOT texture without unconditional NPOT support.\n");
@ -175,7 +124,7 @@ index 4db6bb4..4a4c4f8 100644
return WINED3DERR_INVALIDCALL;
}
@@ -1950,6 +1959,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -1994,6 +2004,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
{
FIXME("Compressed or height scaled non-power-of-two (%ux%u) textures are not supported.\n",
desc->width, desc->height);
@ -183,7 +132,7 @@ index 4db6bb4..4a4c4f8 100644
return WINED3DERR_NOTAVAILABLE;
}
@@ -1981,6 +1991,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -2025,6 +2036,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if (desc->pool == WINED3D_POOL_DEFAULT || desc->pool == WINED3D_POOL_MANAGED)
{
WARN("Dimensions (%ux%u) exceed the maximum texture size.\n", pow2_width, pow2_height);
@ -191,7 +140,7 @@ index 4db6bb4..4a4c4f8 100644
return WINED3DERR_NOTAVAILABLE;
}
@@ -1994,12 +2005,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -2038,12 +2050,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if (!gl_info->supported[SGIS_GENERATE_MIPMAP])
{
WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n");
@ -206,7 +155,7 @@ index 4db6bb4..4a4c4f8 100644
return WINED3DERR_INVALIDCALL;
}
}
@@ -2008,6 +2021,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -2052,6 +2066,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
flags, device, parent, parent_ops, &texture_resource_ops)))
{
WARN("Failed to initialize texture, returning %#x.\n", hr);
@ -214,7 +163,7 @@ index 4db6bb4..4a4c4f8 100644
return hr;
}
@@ -2049,7 +2063,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -2093,7 +2108,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if (level_count > ~(SIZE_T)0 / layer_count
|| !(surfaces = wined3d_calloc(level_count * layer_count, sizeof(*surfaces))))
{
@ -223,7 +172,7 @@ index 4db6bb4..4a4c4f8 100644
return E_OUTOFMEMORY;
}
@@ -2092,7 +2106,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -2136,7 +2151,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
texture, idx, &sub_resource->parent, &sub_resource->parent_ops)))
{
WARN("Failed to create surface parent, hr %#x.\n", hr);
@ -232,7 +181,7 @@ index 4db6bb4..4a4c4f8 100644
return hr;
}
@@ -2103,7 +2117,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -2147,7 +2162,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if (((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D))
&& FAILED(hr = wined3d_surface_create_dc(surface)))
{
@ -241,7 +190,7 @@ index 4db6bb4..4a4c4f8 100644
return hr;
}
}
@@ -2160,21 +2174,6 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi
@@ -2215,21 +2230,6 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi
static void texture3d_cleanup_sub_resources(struct wined3d_texture *texture)
{
@ -263,7 +212,7 @@ index 4db6bb4..4a4c4f8 100644
HeapFree(GetProcessHeap(), 0, texture->sub_resources[0].u.volume);
}
@@ -2228,6 +2227,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2283,6 +2283,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
if (layer_count != 1)
{
ERR("Invalid layer count for volume texture.\n");
@ -271,7 +220,7 @@ index 4db6bb4..4a4c4f8 100644
return E_INVALIDARG;
}
@@ -2236,12 +2236,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2291,12 +2292,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
if (WINED3DFMT_UNKNOWN >= desc->format)
{
WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture);
@ -286,7 +235,7 @@ index 4db6bb4..4a4c4f8 100644
return WINED3DERR_INVALIDCALL;
}
@@ -2251,12 +2253,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2306,12 +2309,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
if (!gl_info->supported[SGIS_GENERATE_MIPMAP])
{
WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n");
@ -301,7 +250,7 @@ index 4db6bb4..4a4c4f8 100644
return WINED3DERR_INVALIDCALL;
}
}
@@ -2265,6 +2269,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2320,6 +2325,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
|| desc->pool == WINED3D_POOL_SCRATCH))
{
WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool));
@ -309,7 +258,7 @@ index 4db6bb4..4a4c4f8 100644
return WINED3DERR_INVALIDCALL;
}
@@ -2291,6 +2296,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2346,6 +2352,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
{
WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n",
desc->width, desc->height, desc->depth);
@ -317,7 +266,7 @@ index 4db6bb4..4a4c4f8 100644
return WINED3DERR_INVALIDCALL;
}
}
@@ -2300,6 +2306,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2355,6 +2362,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
0, device, parent, parent_ops, &texture_resource_ops)))
{
WARN("Failed to initialize texture, returning %#x.\n", hr);
@ -325,7 +274,7 @@ index 4db6bb4..4a4c4f8 100644
return hr;
}
@@ -2318,7 +2325,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2373,7 +2381,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
if (!(volumes = wined3d_calloc(level_count, sizeof(*volumes))))
{
@ -334,7 +283,7 @@ index 4db6bb4..4a4c4f8 100644
return E_OUTOFMEMORY;
}
@@ -2340,7 +2347,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2395,7 +2403,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
texture, i, &sub_resource->parent, &sub_resource->parent_ops)))
{
WARN("Failed to create volume parent, hr %#x.\n", hr);
@ -343,7 +292,7 @@ index 4db6bb4..4a4c4f8 100644
return hr;
}
@@ -2637,7 +2644,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
@@ -2692,7 +2700,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
if (FAILED(hr))
{
WARN("Failed to initialize texture, returning %#x.\n", hr);
@ -351,7 +300,7 @@ index 4db6bb4..4a4c4f8 100644
return hr;
}
@@ -2645,8 +2651,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
@@ -2700,8 +2707,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
* in this case. */
if (data && FAILED(hr = wined3d_texture_upload_data(object, data)))
{
@ -361,26 +310,6 @@ index 4db6bb4..4a4c4f8 100644
return hr;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b366807..6f0656e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2652,6 +2652,7 @@ void wined3d_texture_changed(struct wined3d_texture *texture,
void *swap_heap_memory) DECLSPEC_HIDDEN;
BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN;
+void wined3d_texture_cleanup(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN;
void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_bo_address *data, DWORD locations, BOOL map) DECLSPEC_HIDDEN;
@@ -3065,6 +3066,7 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu
void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN;
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
--
2.8.0

View File

@ -1,4 +1,4 @@
From ceb5e15dca96c44ee25df8830a26d75f0f1f931d Mon Sep 17 00:00:00 2001
From 025efa13f043ec294bea8f5efac0c39782d4f774 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 3 Sep 2014 20:20:39 +0200
Subject: wined3d: Wait for the resource to be idle when destroying user memory
@ -9,10 +9,10 @@ Subject: wined3d: Wait for the resource to be idle when destroying user memory
1 file changed, 6 insertions(+)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 77ef2e8..44d38f8 100644
index c075b3c..2f57373 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -746,6 +746,12 @@ static void wined3d_texture_cleanup_main(struct wined3d_texture *texture)
@@ -822,6 +822,12 @@ static void wined3d_texture_cleanup_main(struct wined3d_texture *texture)
sub_resource->parent_ops->wined3d_object_destroyed(sub_resource->parent);
}
@ -23,7 +23,7 @@ index 77ef2e8..44d38f8 100644
+ wined3d_resource_wait_fence(&texture->resource);
+
resource_cleanup(&texture->resource);
wined3d_cs_emit_texture_cleanup(device->cs, texture);
wined3d_cs_emit_destroy_object(device->cs, wined3d_texture_destroy_object, texture);
}
--
2.8.0

View File

@ -1,84 +1,23 @@
From dc11fbb6d581044d08aa04f76d7c264b276054b0 Mon Sep 17 00:00:00 2001
From 4dc96ab42f9d44017ed6510922c1a324a3e1f2bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 27 Aug 2015 23:43:08 +0200
Subject: wined3d: Destroy samplers through the command stream.
---
dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++
dlls/wined3d/sampler.c | 21 +++++++++++++--------
dlls/wined3d/wined3d_private.h | 3 +++
3 files changed, 44 insertions(+), 8 deletions(-)
dlls/wined3d/sampler.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index b8ee474..4ec6260 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -85,6 +85,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_RESOURCE_CLEANUP,
WINED3D_CS_OP_BUFFER_CLEANUP,
WINED3D_CS_OP_TEXTURE_CLEANUP,
+ WINED3D_CS_OP_SAMPLER_DESTROY,
WINED3D_CS_OP_STOP,
};
@@ -503,6 +504,12 @@ struct wined3d_cs_texture_cleanup
struct wined3d_texture *texture;
};
+struct wined3d_cs_sampler_destroy
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_sampler *sampler;
+};
+
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2551,6 +2558,26 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
cs->ops->submit(cs, sizeof(*op));
}
+static UINT wined3d_cs_exec_sampler_destroy(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_sampler_destroy *op = data;
+
+ wined3d_sampler_destroy(op->sampler);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler)
+{
+ struct wined3d_cs_sampler_destroy *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SAMPLER_DESTROY;
+ op->sampler = sampler;
+
+ cs->ops->submit(cs, sizeof(*op));
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2614,6 +2641,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup,
/* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup,
/* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup,
+ /* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy,
};
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c
index 865198b..7c04472 100644
index 865198b..8c73466 100644
--- a/dlls/wined3d/sampler.c
+++ b/dlls/wined3d/sampler.c
@@ -33,22 +33,27 @@ ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler)
@@ -33,22 +33,28 @@ ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler)
return refcount;
}
+void wined3d_sampler_destroy(struct wined3d_sampler *sampler)
+static void wined3d_sampler_destroy_object(void *object)
+{
+ struct wined3d_sampler *sampler = object;
+ struct wined3d_context *context = context_acquire(sampler->device, NULL);
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
@ -105,31 +44,10 @@ index 865198b..7c04472 100644
-
- HeapFree(GetProcessHeap(), 0, sampler);
+ struct wined3d_device *device = sampler->device;
+ wined3d_cs_emit_sampler_destroy(device->cs, sampler);
+ wined3d_cs_emit_destroy_object(device->cs, wined3d_sampler_destroy_object, sampler);
}
return refcount;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9f966fa..dc1386a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2808,6 +2808,8 @@ struct wined3d_sampler
GLuint name;
};
+void wined3d_sampler_destroy(struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
+
struct wined3d_vertex_declaration_element
{
const struct wined3d_format *format;
@@ -3056,6 +3058,7 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
--
2.8.0

View File

@ -1,103 +1,17 @@
From c9eddaea0012e092e914b997cbeda8ebf5d00ba4 Mon Sep 17 00:00:00 2001
From 44d9ed38c0388ba76f6bcfa79f003754564c5ed4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 5 Nov 2015 16:39:01 +0100
Subject: wined3d: Destroy shader resource views through the CS.
---
dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++
dlls/wined3d/view.c | 37 ++++++++++++++++++-------------------
dlls/wined3d/wined3d_private.h | 4 ++++
3 files changed, 50 insertions(+), 19 deletions(-)
dlls/wined3d/view.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index bf446aa..9965e9b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -86,6 +86,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_BUFFER_CLEANUP,
WINED3D_CS_OP_TEXTURE_CLEANUP,
WINED3D_CS_OP_SAMPLER_DESTROY,
+ WINED3D_CS_OP_SRV_DESTROY,
WINED3D_CS_OP_STOP,
};
@@ -514,6 +515,12 @@ struct wined3d_cs_sampler_destroy
struct wined3d_sampler *sampler;
};
+struct wined3d_cs_shader_resource_view_destroy
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_shader_resource_view *view;
+};
+
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2575,6 +2582,26 @@ void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampl
cs->ops->submit(cs, sizeof(*op));
}
+static UINT wined3d_cs_exec_shader_resource_view_destroy(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_shader_resource_view_destroy *op = data;
+
+ wined3d_shader_resource_view_destroy_cs(op->view);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs, struct wined3d_shader_resource_view *view)
+{
+ struct wined3d_cs_shader_resource_view_destroy *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SRV_DESTROY;
+ op->view = view;
+
+ cs->ops->submit(cs, sizeof(*op));
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2639,6 +2666,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup,
/* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup,
/* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy,
+ /* WINED3D_CS_OP_SRV_DESTROY */ wined3d_cs_exec_shader_resource_view_destroy,
};
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 070694e..7797c58 100644
index dc68687..6dd7ae2 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -184,6 +184,23 @@ ULONG CDECL wined3d_shader_resource_view_incref(struct wined3d_shader_resource_v
return refcount;
}
+void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view)
+{
+ if (view->object)
+ {
+ const struct wined3d_gl_info *gl_info;
+ struct wined3d_context *context;
+
+ context = context_acquire(view->resource->device, NULL);
+ gl_info = context->gl_info;
+ gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->object);
+ checkGLcall("glDeleteTextures");
+ context_release(context);
+ }
+
+ HeapFree(GetProcessHeap(), 0, view);
+}
+
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view)
{
ULONG refcount = InterlockedDecrement(&view->refcount);
@@ -194,29 +211,11 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v
@@ -236,12 +236,6 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v
{
struct wined3d_device *device = view->resource->device;
@ -106,50 +20,10 @@ index 070694e..7797c58 100644
- FIXME("Waiting for cs.\n");
- device->cs->ops->finish(device->cs);
- }
-
- if (view->object)
- {
- const struct wined3d_gl_info *gl_info;
- struct wined3d_context *context;
-
- context = context_acquire(view->resource->device, NULL);
- gl_info = context->gl_info;
- gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->object);
- checkGLcall("glDeleteTextures");
- context_release(context);
- }
-
/* Call wined3d_object_destroyed() before releasing the resource,
* since releasing the resource may end up destroying the parent. */
view->parent_ops->wined3d_object_destroyed(view->parent);
wined3d_resource_decref(view->resource);
- HeapFree(GetProcessHeap(), 0, view);
+ wined3d_cs_emit_shader_resource_view_destroy(device->cs, view);
}
return refcount;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 51ffe6f..c285702 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3096,6 +3096,8 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN;
void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs,
+ struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN;
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
@@ -3240,6 +3242,8 @@ struct wined3d_shader_resource_view
void wined3d_shader_resource_view_bind(struct wined3d_shader_resource_view *view,
struct wined3d_context *context) DECLSPEC_HIDDEN;
+void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN;
+
struct wined3d_swapchain_ops
{
void (*swapchain_present)(struct wined3d_swapchain *swapchain,
--
2.8.0

View File

@ -1,4 +1,4 @@
From 242374f346ff9108cd2d450f2fe79d7d1d48752b Mon Sep 17 00:00:00 2001
From 3bf5e65dbf7f9c4afd8b48c277c354222a9761c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sun, 16 Mar 2014 14:13:42 +0100
Subject: wined3d: Send getdc and releasedc through the command stream.
@ -11,20 +11,20 @@ Another hacky patch to avoid using GL outside the worker thread.
3 files changed, 113 insertions(+), 34 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 6de25ab..3208c35 100644
index 64585f6..959ce85 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -87,6 +87,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_TEXTURE_CLEANUP,
WINED3D_CS_OP_SAMPLER_DESTROY,
WINED3D_CS_OP_SRV_DESTROY,
@@ -81,6 +81,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
WINED3D_CS_OP_CREATE_VBO,
WINED3D_CS_OP_RESOURCE_CLEANUP,
+ WINED3D_CS_OP_GET_DC,
+ WINED3D_CS_OP_RELEASE_DC,
WINED3D_CS_OP_STOP,
};
@@ -517,6 +519,13 @@ struct wined3d_cs_shader_resource_view_destroy
struct wined3d_shader_resource_view *view;
@@ -481,6 +483,13 @@ struct wined3d_cs_resource_cleanup
struct wined3d_resource *resource;
};
+struct wined3d_cs_get_release_dc
@ -37,7 +37,7 @@ index 6de25ab..3208c35 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2605,6 +2614,52 @@ void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs, struct
@@ -2450,6 +2459,52 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, struct wined3d_reso
cs->ops->submit(cs, sizeof(*op));
}
@ -90,20 +90,20 @@ index 6de25ab..3208c35 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2670,6 +2725,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup,
/* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy,
/* WINED3D_CS_OP_SRV_DESTROY */ wined3d_cs_exec_shader_resource_view_destroy,
@@ -2509,6 +2564,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
/* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo,
/* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup,
+ /* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc,
+ /* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc,
};
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 7b27fd5..4b6c1d8 100644
index 2f57373..f36ae61 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -2677,13 +2677,39 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
@@ -2734,13 +2734,39 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
return WINED3D_OK;
}
@ -145,7 +145,7 @@ index 7b27fd5..4b6c1d8 100644
TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc);
@@ -2701,35 +2727,30 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
@@ -2758,35 +2784,30 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT))
return WINED3DERR_INVALIDCALL;
@ -200,7 +200,7 @@ index 7b27fd5..4b6c1d8 100644
}
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
@@ -2760,14 +2781,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
@@ -2817,14 +2838,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
return WINED3DERR_INVALIDCALL;
}
@ -217,10 +217,10 @@ index 7b27fd5..4b6c1d8 100644
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 496f521..38ab06c 100644
index 6753579..7141256 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2538,6 +2538,7 @@ struct wined3d_texture
@@ -2587,6 +2587,7 @@ struct wined3d_texture
DWORD flags;
GLenum target;
DWORD update_map_binding;
@ -228,15 +228,15 @@ index 496f521..38ab06c 100644
GLuint rb_multisample;
GLuint rb_resolved;
@@ -2633,6 +2634,7 @@ void wined3d_texture_changed(struct wined3d_texture *texture,
@@ -2681,6 +2682,7 @@ void wined3d_texture_changed(struct wined3d_texture *texture,
void *swap_heap_memory) DECLSPEC_HIDDEN;
BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN;
void wined3d_texture_cleanup(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
+void wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN;
void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_bo_address *data, DWORD locations, BOOL map) DECLSPEC_HIDDEN;
@@ -2652,6 +2654,8 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int
@@ -2700,6 +2702,8 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int
DWORD flags) DECLSPEC_HIDDEN;
void wined3d_texture_prepare_texture(struct wined3d_texture *texture,
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
@ -245,10 +245,10 @@ index 496f521..38ab06c 100644
void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN;
void wined3d_texture_set_swapchain(struct wined3d_texture *texture,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
@@ -3061,6 +3065,10 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs,
struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN;
@@ -3094,6 +3098,10 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer
void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
struct wined3d_resource *resource) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
+ unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,

View File

@ -1,4 +1,4 @@
From 3088a7530fb33a12a44cba688a5d14ea86f55590 Mon Sep 17 00:00:00 2001
From 287c22bdc1ce3cc81fcd80ea9b2e555acb07895b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 10 Oct 2013 16:29:42 +0200
Subject: wined3d: Create dummy textures through the CS.
@ -12,18 +12,18 @@ crash.
3 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 83eb233..a7dde00 100644
index 959ce85..e50d2fa 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -89,6 +89,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SRV_DESTROY,
@@ -83,6 +83,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_RESOURCE_CLEANUP,
WINED3D_CS_OP_GET_DC,
WINED3D_CS_OP_RELEASE_DC,
+ WINED3D_CS_OP_CREATE_DUMMY_TEXTURES,
WINED3D_CS_OP_STOP,
};
@@ -530,6 +531,11 @@ struct wined3d_cs_get_release_dc
@@ -490,6 +491,11 @@ struct wined3d_cs_get_release_dc
unsigned int sub_resource_idx;
};
@ -35,7 +35,7 @@ index 83eb233..a7dde00 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2657,6 +2663,28 @@ void wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *t
@@ -2505,6 +2511,28 @@ void wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *t
cs->ops->finish(cs);
}
@ -64,8 +64,8 @@ index 83eb233..a7dde00 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2724,6 +2752,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SRV_DESTROY */ wined3d_cs_exec_shader_resource_view_destroy,
@@ -2566,6 +2594,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup,
/* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc,
/* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc,
+ /* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures,
@ -73,7 +73,7 @@ index 83eb233..a7dde00 100644
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index bc2ffd8..2c93215 100644
index 5c47a70..bca71ad 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -664,7 +664,7 @@ out:
@ -85,7 +85,7 @@ index bc2ffd8..2c93215 100644
{
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -1044,17 +1044,15 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -1045,17 +1045,15 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
device->swapchains[0] = swapchain;
device_init_swapchain_state(device, swapchain);
@ -105,7 +105,7 @@ index bc2ffd8..2c93215 100644
/* Clear the screen */
if (swapchain->back_buffers && swapchain->back_buffers[0])
clear_flags |= WINED3DCLEAR_TARGET;
@@ -4602,7 +4600,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
@@ -4604,7 +4602,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
swapchain->context[0] = context;
swapchain->num_contexts = 1;
@ -115,10 +115,10 @@ index bc2ffd8..2c93215 100644
context_release(context);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f61681d..41de5fb 100644
index 7141256..bd4abc9 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2417,7 +2417,7 @@ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT
@@ -2435,7 +2435,7 @@ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT
GLenum type_hint, struct wined3d_context *context) DECLSPEC_HIDDEN;
void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_bo *bo,
const struct wined3d_context *context) DECLSPEC_HIDDEN;
@ -127,7 +127,7 @@ index f61681d..41de5fb 100644
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -3096,6 +3096,7 @@ void wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *textu
@@ -3102,6 +3102,7 @@ void wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *textu
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
void wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;

View File

@ -1,62 +1,48 @@
From b4e606f58cff1cdcd57d77686342bd938833225c Mon Sep 17 00:00:00 2001
From 3672080dca25e19d625417d907ec26ac1f8d4b5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sat, 7 May 2016 22:07:22 +0100
Subject: wined3d: Do the sampler GL init through the CS.
This extra parameter is barf-inducing.
---
dlls/wined3d/cs.c | 28 ++++++++++++++++++++---
dlls/wined3d/cs.c | 28 +++++++++++++++++++++++
dlls/wined3d/sampler.c | 51 ++++++++++++++++++++++++------------------
dlls/wined3d/state.c | 2 +-
dlls/wined3d/wined3d_private.h | 5 +++++
4 files changed, 60 insertions(+), 26 deletions(-)
4 files changed, 63 insertions(+), 23 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index c3e50ef..d59ffb7 100644
index 70d3e1f..028003f 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -86,6 +86,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_BUFFER_CLEANUP,
WINED3D_CS_OP_TEXTURE_CLEANUP,
WINED3D_CS_OP_SAMPLER_DESTROY,
@@ -81,6 +81,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
WINED3D_CS_OP_CREATE_VBO,
WINED3D_CS_OP_RESOURCE_CLEANUP,
+ WINED3D_CS_OP_SAMPLER_INIT,
WINED3D_CS_OP_SRV_DESTROY,
WINED3D_CS_OP_GET_DC,
WINED3D_CS_OP_RELEASE_DC,
@@ -511,7 +512,7 @@ struct wined3d_cs_texture_cleanup
struct wined3d_texture *texture;
WINED3D_CS_OP_CREATE_DUMMY_TEXTURES,
@@ -487,6 +488,12 @@ struct wined3d_cs_resource_cleanup
struct wined3d_resource *resource;
};
-struct wined3d_cs_sampler_destroy
+struct wined3d_cs_sampler_init_destroy
+struct wined3d_cs_sampler_init
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_sampler *sampler;
+};
+
struct wined3d_cs_get_release_dc
{
enum wined3d_cs_op opcode;
struct wined3d_sampler *sampler;
@@ -2604,7 +2605,7 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
static UINT wined3d_cs_exec_sampler_destroy(struct wined3d_cs *cs, const void *data)
{
- const struct wined3d_cs_sampler_destroy *op = data;
+ const struct wined3d_cs_sampler_init_destroy *op = data;
wined3d_sampler_destroy(op->sampler);
@@ -2613,7 +2614,7 @@ static UINT wined3d_cs_exec_sampler_destroy(struct wined3d_cs *cs, const void *d
void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler)
{
- struct wined3d_cs_sampler_destroy *op;
+ struct wined3d_cs_sampler_init_destroy *op;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_SAMPLER_DESTROY;
@@ -2622,6 +2623,26 @@ void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampl
@@ -2487,6 +2494,26 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, struct wined3d_reso
cs->ops->submit(cs, sizeof(*op));
}
+static UINT wined3d_cs_exec_sampler_init(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_sampler_init_destroy *op = data;
+ const struct wined3d_cs_sampler_init *op = data;
+
+ wined3d_sampler_init(op->sampler);
+
@ -65,7 +51,7 @@ index c3e50ef..d59ffb7 100644
+
+void wined3d_cs_emit_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler *sampler)
+{
+ struct wined3d_cs_sampler_init_destroy *op;
+ struct wined3d_cs_sampler_init *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SAMPLER_INIT;
@ -74,22 +60,22 @@ index c3e50ef..d59ffb7 100644
+ cs->ops->submit(cs, sizeof(*op));
+}
+
static UINT wined3d_cs_exec_shader_resource_view_destroy(struct wined3d_cs *cs, const void *data)
static UINT wined3d_cs_exec_get_dc(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_shader_resource_view_destroy *op = data;
@@ -2841,6 +2862,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup,
/* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup,
/* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy,
const struct wined3d_cs_get_release_dc *op = data;
@@ -2681,6 +2708,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
/* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo,
/* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup,
+ /* WINED3D_CS_OP_SAMPLER_INIT */ wined3d_cs_exec_sampler_init,
/* WINED3D_CS_OP_SRV_DESTROY */ wined3d_cs_exec_shader_resource_view_destroy,
/* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc,
/* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc,
/* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures,
diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c
index 7c04472..714b7e9 100644
index 8c73466..bc165a8 100644
--- a/dlls/wined3d/sampler.c
+++ b/dlls/wined3d/sampler.c
@@ -66,43 +66,37 @@ void * CDECL wined3d_sampler_get_parent(const struct wined3d_sampler *sampler)
@@ -67,43 +67,37 @@ void * CDECL wined3d_sampler_get_parent(const struct wined3d_sampler *sampler)
return sampler->parent;
}
@ -148,7 +134,7 @@ index 7c04472..714b7e9 100644
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT));
checkGLcall("sampler creation");
@@ -114,6 +108,12 @@ static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d
@@ -115,6 +109,12 @@ static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d
HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct wined3d_sampler_desc *desc,
void *parent, struct wined3d_sampler **sampler)
{
@ -161,7 +147,7 @@ index 7c04472..714b7e9 100644
struct wined3d_sampler *object;
TRACE("device %p, desc %p, parent %p, sampler %p.\n", device, desc, parent, sampler);
@@ -134,7 +134,14 @@ HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct
@@ -135,7 +135,14 @@ HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
@ -178,7 +164,7 @@ index 7c04472..714b7e9 100644
TRACE("Created sampler %p.\n", object);
*sampler = object;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 67aae67..d7ad944 100644
index ed578b8..a513298 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3604,7 +3604,7 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
@ -191,29 +177,28 @@ index 67aae67..d7ad944 100644
ERR("Failed to create sampler.\n");
sampler = NULL;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8b807c9..68ea987 100644
index 629ac6d..8b48d64 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2814,7 +2814,11 @@ struct wined3d_sampler
@@ -2858,6 +2858,10 @@ struct wined3d_sampler
GLuint name;
};
+
+HRESULT wined3d_sampler_create_from_cs(struct wined3d_device *device, const struct wined3d_sampler_desc *desc,
+ void *parent, struct wined3d_sampler **sampler, BOOL from_cs) DECLSPEC_HIDDEN;
void wined3d_sampler_destroy(struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
+void wined3d_sampler_init(struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
+
struct wined3d_vertex_declaration_element
{
@@ -3065,6 +3069,7 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN;
void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
const struct wined3d_format *format;
@@ -3100,6 +3104,7 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer
void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
struct wined3d_resource *resource) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs,
struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN;
void wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
void wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
--
2.8.0

File diff suppressed because it is too large Load Diff