wined3d: Factor out acquire_graphics_pipeline_resources().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-11-01 22:08:41 +01:00 committed by Alexandre Julliard
parent f51f86cc19
commit c736181da4
1 changed files with 25 additions and 17 deletions

View File

@ -809,25 +809,11 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
} }
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned int patch_vertex_count, static void acquire_graphics_pipeline_resources(const struct wined3d_state *state,
int base_vertex_idx, unsigned int start_idx, unsigned int index_count, BOOL indexed, const struct wined3d_gl_info *gl_info)
unsigned int start_instance, unsigned int instance_count, BOOL indexed)
{ {
const struct wined3d_state *state = &cs->device->state;
struct wined3d_cs_draw *op;
unsigned int i; unsigned int i;
op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
op->opcode = WINED3D_CS_OP_DRAW;
op->primitive_type = primitive_type;
op->patch_vertex_count = patch_vertex_count;
op->base_vertex_idx = base_vertex_idx;
op->start_idx = start_idx;
op->index_count = index_count;
op->start_instance = start_instance;
op->instance_count = instance_count;
op->indexed = indexed;
if (indexed) if (indexed)
wined3d_resource_acquire(&state->index_buffer->resource); wined3d_resource_acquire(&state->index_buffer->resource);
for (i = 0; i < ARRAY_SIZE(state->streams); ++i) for (i = 0; i < ARRAY_SIZE(state->streams); ++i)
@ -845,7 +831,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned
if (state->textures[i]) if (state->textures[i])
wined3d_resource_acquire(&state->textures[i]->resource); wined3d_resource_acquire(&state->textures[i]->resource);
} }
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) for (i = 0; i < gl_info->limits.buffers; ++i)
{ {
if (state->fb->render_targets[i]) if (state->fb->render_targets[i])
wined3d_resource_acquire(state->fb->render_targets[i]->resource); wined3d_resource_acquire(state->fb->render_targets[i]->resource);
@ -855,6 +841,28 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned
acquire_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE)); acquire_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE));
acquire_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL], acquire_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL],
state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
}
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned int patch_vertex_count,
int base_vertex_idx, unsigned int start_idx, unsigned int index_count,
unsigned int start_instance, unsigned int instance_count, BOOL indexed)
{
const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info;
const struct wined3d_state *state = &cs->device->state;
struct wined3d_cs_draw *op;
op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
op->opcode = WINED3D_CS_OP_DRAW;
op->primitive_type = primitive_type;
op->patch_vertex_count = patch_vertex_count;
op->base_vertex_idx = base_vertex_idx;
op->start_idx = start_idx;
op->index_count = index_count;
op->start_instance = start_instance;
op->instance_count = instance_count;
op->indexed = indexed;
acquire_graphics_pipeline_resources(state, indexed, gl_info);
cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
} }