Commit c976f8fb authored by Jan Sikorski's avatar Jan Sikorski Committed by Alexandre Julliard

wined3d: Acquire blend state references for command lists by inspecting CS packets.

parent 7c0d1595
......@@ -63,9 +63,6 @@ struct wined3d_command_list
SIZE_T query_count;
struct wined3d_deferred_query_issue *queries;
SIZE_T blend_state_count;
struct wined3d_blend_state **blend_states;
};
static void invalidate_client_address(struct wined3d_resource *resource)
......@@ -541,12 +538,6 @@ static inline void wined3d_device_context_acquire_resource(struct wined3d_device
context->ops->acquire_resource(context, resource);
}
static inline void wined3d_device_context_acquire_blend_state(struct wined3d_device_context *context,
struct wined3d_blend_state *blend_state)
{
context->ops->acquire_blend_state(context, blend_state);
}
static struct wined3d_cs *wined3d_cs_from_context(struct wined3d_device_context *context)
{
return CONTAINING_RECORD(context, struct wined3d_cs, c);
......@@ -1801,8 +1792,6 @@ void wined3d_device_context_emit_set_blend_state(struct wined3d_device_context *
op->factor = *blend_factor;
op->sample_mask = sample_mask;
if (state)
wined3d_device_context_acquire_blend_state(context, state);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
}
......@@ -2929,11 +2918,6 @@ static void wined3d_cs_acquire_resource(struct wined3d_device_context *context,
wined3d_resource_acquire(resource);
}
static void wined3d_cs_acquire_blend_state(struct wined3d_device_context *context,
struct wined3d_blend_state *blend_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) =
......@@ -3171,7 +3155,6 @@ static const struct wined3d_device_context_ops wined3d_cs_st_ops =
wined3d_cs_flush,
wined3d_cs_acquire_resource,
wined3d_cs_acquire_command_list,
wined3d_cs_acquire_blend_state,
};
static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs *cs, const struct wined3d_cs_queue *queue)
......@@ -3300,7 +3283,6 @@ static const struct wined3d_device_context_ops wined3d_cs_mt_ops =
wined3d_cs_flush,
wined3d_cs_acquire_resource,
wined3d_cs_acquire_command_list,
wined3d_cs_acquire_blend_state,
};
static void poll_queries(struct wined3d_cs *cs)
......@@ -3553,6 +3535,16 @@ static void wined3d_cs_packet_decref_objects(const struct wined3d_cs_packet *pac
break;
}
case WINED3D_CS_OP_SET_BLEND_STATE:
{
struct wined3d_cs_set_blend_state *op;
op = (struct wined3d_cs_set_blend_state *)packet->data;
if (op->state)
wined3d_blend_state_decref(op->state);
break;
}
default:
break;
}
......@@ -3606,6 +3598,16 @@ static void wined3d_cs_packet_incref_objects(struct wined3d_cs_packet *packet)
break;
}
case WINED3D_CS_OP_SET_BLEND_STATE:
{
struct wined3d_cs_set_blend_state *op;
op = (struct wined3d_cs_set_blend_state *)packet->data;
if (op->state)
wined3d_blend_state_incref(op->state);
break;
}
default:
break;
}
......@@ -3632,9 +3634,6 @@ struct wined3d_deferred_context
SIZE_T query_count, queries_capacity;
struct wined3d_deferred_query_issue *queries;
SIZE_T blend_state_count, blend_states_capacity;
struct wined3d_blend_state **blend_states;
};
static struct wined3d_deferred_context *wined3d_deferred_context_from_context(struct wined3d_device_context *context)
......@@ -3835,18 +3834,6 @@ static void wined3d_deferred_context_acquire_command_list(struct wined3d_device_
wined3d_command_list_incref(deferred->command_lists[deferred->command_list_count++] = list);
}
static void wined3d_deferred_context_acquire_blend_state(struct wined3d_device_context *context,
struct wined3d_blend_state *blend_state)
{
struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context);
if (!wined3d_array_reserve((void **)&deferred->blend_states, &deferred->blend_states_capacity,
deferred->blend_state_count + 1, sizeof(*deferred->blend_states)))
return;
deferred->blend_states[deferred->blend_state_count++] = blend_state;
wined3d_blend_state_incref(blend_state);
}
static const struct wined3d_device_context_ops wined3d_deferred_context_ops =
{
wined3d_deferred_context_require_space,
......@@ -3859,7 +3846,6 @@ static const struct wined3d_device_context_ops wined3d_deferred_context_ops =
wined3d_deferred_context_flush,
wined3d_deferred_context_acquire_resource,
wined3d_deferred_context_acquire_command_list,
wined3d_deferred_context_acquire_blend_state,
};
HRESULT CDECL wined3d_deferred_context_create(struct wined3d_device *device, struct wined3d_device_context **context)
......@@ -3918,10 +3904,6 @@ void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *conte
wined3d_query_decref(deferred->queries[i].query);
heap_free(deferred->queries);
for (i = 0; i < deferred->blend_state_count; ++i)
wined3d_blend_state_decref(deferred->blend_states[i]);
heap_free(deferred->blend_states);
while (offset < deferred->data_size)
{
packet = wined3d_next_cs_packet(deferred->data, &offset);
......@@ -3947,7 +3929,6 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
+ deferred->upload_count * sizeof(*object->uploads)
+ deferred->command_list_count * sizeof(*object->command_lists)
+ deferred->query_count * sizeof(*object->queries)
+ deferred->blend_state_count * sizeof(*object->blend_states)
+ deferred->data_size);
if (!memory)
......@@ -3987,12 +3968,6 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
memcpy(object->queries, deferred->queries, deferred->query_count * sizeof(*object->queries));
/* Transfer our references to the queries to the command list. */
object->blend_states = memory;
memory = &object->blend_states[deferred->blend_state_count];
object->blend_state_count = deferred->blend_state_count;
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->data = memory;
object->data_size = deferred->data_size;
memcpy(object->data, deferred->data, deferred->data_size);
......@@ -4002,7 +3977,6 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
deferred->upload_count = 0;
deferred->command_list_count = 0;
deferred->query_count = 0;
deferred->blend_state_count = 0;
/* This is in fact recorded into a subsequent command list. */
if (restore)
......@@ -4058,8 +4032,6 @@ ULONG CDECL wined3d_command_list_decref(struct wined3d_command_list *list)
wined3d_resource_decref(list->uploads[i].resource);
for (i = 0; i < list->query_count; ++i)
wined3d_query_decref(list->queries[i].query);
for (i = 0; i < list->blend_state_count; ++i)
wined3d_blend_state_decref(list->blend_states[i]);
offset = 0;
while (offset < list->data_size)
......
......@@ -4874,7 +4874,6 @@ struct wined3d_device_context_ops
void (*flush)(struct wined3d_device_context *context);
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);
};
struct wined3d_device_context
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment