wined3d: Acquire rasterizer state references for command lists by inspecting CS packets.
Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cb853ec2cd
commit
7c0d1595e0
|
@ -66,9 +66,6 @@ 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 invalidate_client_address(struct wined3d_resource *resource)
|
||||
|
@ -550,12 +547,6 @@ 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);
|
||||
|
@ -1859,8 +1850,6 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -2945,11 +2934,6 @@ 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) =
|
||||
|
@ -3188,7 +3172,6 @@ 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)
|
||||
|
@ -3318,7 +3301,6 @@ 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)
|
||||
|
@ -3561,6 +3543,16 @@ static void wined3d_cs_packet_decref_objects(const struct wined3d_cs_packet *pac
|
|||
break;
|
||||
}
|
||||
|
||||
case WINED3D_CS_OP_SET_RASTERIZER_STATE:
|
||||
{
|
||||
struct wined3d_cs_set_rasterizer_state *op;
|
||||
|
||||
op = (struct wined3d_cs_set_rasterizer_state *)packet->data;
|
||||
if (op->state)
|
||||
wined3d_rasterizer_state_decref(op->state);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -3604,6 +3596,16 @@ static void wined3d_cs_packet_incref_objects(struct wined3d_cs_packet *packet)
|
|||
break;
|
||||
}
|
||||
|
||||
case WINED3D_CS_OP_SET_RASTERIZER_STATE:
|
||||
{
|
||||
struct wined3d_cs_set_rasterizer_state *op;
|
||||
|
||||
op = (struct wined3d_cs_set_rasterizer_state *)packet->data;
|
||||
if (op->state)
|
||||
wined3d_rasterizer_state_incref(op->state);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -3633,9 +3635,6 @@ 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)
|
||||
|
@ -3848,18 +3847,6 @@ 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,
|
||||
|
@ -3873,7 +3860,6 @@ 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)
|
||||
|
@ -3936,10 +3922,6 @@ 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);
|
||||
|
||||
while (offset < deferred->data_size)
|
||||
{
|
||||
packet = wined3d_next_cs_packet(deferred->data, &offset);
|
||||
|
@ -3966,7 +3948,6 @@ 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)
|
||||
|
@ -4012,13 +3993,6 @@ 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);
|
||||
|
@ -4029,7 +4003,6 @@ 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)
|
||||
|
@ -4087,8 +4060,6 @@ 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]);
|
||||
|
||||
offset = 0;
|
||||
while (offset < list->data_size)
|
||||
|
|
|
@ -4875,8 +4875,6 @@ 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
|
||||
|
|
Loading…
Reference in New Issue