Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- dlls/wined3d/cs.c | 49 ++++++++++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 2 ++ 2 files changed, 51 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 063e8bd0a04..1c41194eff6 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -67,6 +67,9 @@ struct wined3d_command_list
SIZE_T blend_state_count; struct wined3d_blend_state **blend_states; + + SIZE_T rasterizer_state_count; + struct wined3d_rasterizer_state **rasterizer_states; };
static void wined3d_command_list_destroy_object(void *object) @@ -112,6 +115,8 @@ ULONG CDECL wined3d_command_list_decref(struct wined3d_command_list *list) wined3d_query_decref(list->queries[i].query); for (i = 0; i < list->blend_state_count; ++i) wined3d_blend_state_decref(list->blend_states[i]); + for (i = 0; i < list->rasterizer_state_count; ++i) + wined3d_rasterizer_state_decref(list->rasterizer_states[i]);
wined3d_mutex_lock(); wined3d_cs_destroy_object(device->cs, wined3d_command_list_destroy_object, list); @@ -600,6 +605,12 @@ static inline void wined3d_device_context_acquire_blend_state(struct wined3d_dev context->ops->acquire_blend_state(context, blend_state); }
+static inline void wined3d_device_context_acquire_rasterizer_state(struct wined3d_device_context *context, + struct wined3d_rasterizer_state *rasterizer_state) +{ + context->ops->acquire_rasterizer_state(context, rasterizer_state); +} + static struct wined3d_cs *wined3d_cs_from_context(struct wined3d_device_context *context) { return CONTAINING_RECORD(context, struct wined3d_cs, c); @@ -1891,6 +1902,8 @@ void wined3d_device_context_emit_set_rasterizer_state(struct wined3d_device_cont op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE; op->state = rasterizer_state;
+ if (rasterizer_state) + wined3d_device_context_acquire_rasterizer_state(context, rasterizer_state); wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); }
@@ -2975,6 +2988,11 @@ static void wined3d_cs_acquire_blend_state(struct wined3d_device_context *contex { }
+static void wined3d_cs_acquire_rasterizer_state(struct wined3d_device_context *context, + struct wined3d_rasterizer_state *rasterizer_state) +{ +} + static void wined3d_cs_exec_execute_command_list(struct wined3d_cs *cs, const void *data);
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = @@ -3215,6 +3233,7 @@ static const struct wined3d_device_context_ops wined3d_cs_st_ops = wined3d_cs_acquire_resource, wined3d_cs_acquire_command_list, wined3d_cs_acquire_blend_state, + wined3d_cs_acquire_rasterizer_state, };
static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs *cs, const struct wined3d_cs_queue *queue) @@ -3343,6 +3362,7 @@ static const struct wined3d_device_context_ops wined3d_cs_mt_ops = wined3d_cs_acquire_resource, wined3d_cs_acquire_command_list, wined3d_cs_acquire_blend_state, + wined3d_cs_acquire_rasterizer_state, };
static void poll_queries(struct wined3d_cs *cs) @@ -3572,6 +3592,9 @@ struct wined3d_deferred_context
SIZE_T blend_state_count, blend_states_capacity; struct wined3d_blend_state **blend_states; + + SIZE_T rasterizer_state_count, rasterizer_states_capacity; + struct wined3d_rasterizer_state **rasterizer_states; };
static struct wined3d_deferred_context *wined3d_deferred_context_from_context(struct wined3d_device_context *context) @@ -3782,6 +3805,18 @@ static void wined3d_deferred_context_acquire_blend_state(struct wined3d_device_c wined3d_blend_state_incref(blend_state); }
+static void wined3d_deferred_context_acquire_rasterizer_state(struct wined3d_device_context *context, + struct wined3d_rasterizer_state *rasterizer_state) +{ + struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context); + if (!wined3d_array_reserve((void **)&deferred->rasterizer_states, &deferred->rasterizer_states_capacity, + deferred->rasterizer_state_count + 1, sizeof(*deferred->rasterizer_states))) + return; + + deferred->rasterizer_states[deferred->rasterizer_state_count++] = rasterizer_state; + wined3d_rasterizer_state_incref(rasterizer_state); +} + static const struct wined3d_device_context_ops wined3d_deferred_context_ops = { wined3d_deferred_context_require_space, @@ -3795,6 +3830,7 @@ static const struct wined3d_device_context_ops wined3d_deferred_context_ops = wined3d_deferred_context_acquire_resource, wined3d_deferred_context_acquire_command_list, wined3d_deferred_context_acquire_blend_state, + wined3d_deferred_context_acquire_rasterizer_state, };
HRESULT CDECL wined3d_deferred_context_create(struct wined3d_device *device, struct wined3d_device_context **context) @@ -3856,6 +3892,10 @@ void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *conte wined3d_blend_state_decref(deferred->blend_states[i]); heap_free(deferred->blend_states);
+ for (i = 0; i < deferred->rasterizer_state_count; ++i) + wined3d_rasterizer_state_decref(deferred->rasterizer_states[i]); + heap_free(deferred->rasterizer_states); + wined3d_state_destroy(deferred->c.state); heap_free(deferred->data); heap_free(deferred); @@ -3876,6 +3916,7 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device + deferred->command_list_count * sizeof(*object->command_lists) + deferred->query_count * sizeof(*object->queries) + deferred->blend_state_count * sizeof(*object->blend_states) + + deferred->rasterizer_state_count * sizeof(*object->rasterizer_states) + deferred->data_size);
if (!memory) @@ -3921,6 +3962,13 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device memcpy(object->blend_states, deferred->blend_states, deferred->blend_state_count * sizeof(*object->blend_states)); /* Transfer our references to the blend states to the command list. */
+ object->rasterizer_states = memory; + memory = &object->rasterizer_states[deferred->rasterizer_state_count]; + object->rasterizer_state_count = deferred->rasterizer_state_count; + memcpy(object->rasterizer_states, deferred->rasterizer_states, + deferred->rasterizer_state_count * sizeof(*object->rasterizer_states)); + /* Transfer our references to the rasterizer states to the command list. */ + object->data = memory; object->data_size = deferred->data_size; memcpy(object->data, deferred->data, deferred->data_size); @@ -3931,6 +3979,7 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device deferred->command_list_count = 0; deferred->query_count = 0; deferred->blend_state_count = 0; + deferred->rasterizer_state_count = 0;
/* This is in fact recorded into a subsequent command list. */ if (restore) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 3a4df301dcb..ecdfe1006a3 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4848,6 +4848,8 @@ struct wined3d_device_context_ops void (*acquire_resource)(struct wined3d_device_context *context, struct wined3d_resource *resource); void (*acquire_command_list)(struct wined3d_device_context *context, struct wined3d_command_list *list); void (*acquire_blend_state)(struct wined3d_device_context *context, struct wined3d_blend_state *blend_state); + void (*acquire_rasterizer_state)(struct wined3d_device_context *context, + struct wined3d_rasterizer_state *rasterizer_state); };
struct wined3d_device_context