wined3d: Factor out release_shader_resources() function.

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-02-01 11:26:21 +01:00 committed by Alexandre Julliard
parent 900e6e1478
commit 12058f66cf
1 changed files with 32 additions and 25 deletions

View File

@ -446,14 +446,41 @@ static void acquire_shader_resources(const struct wined3d_state *state)
} }
} }
static void release_shader_resources(const struct wined3d_state *state)
{
struct wined3d_shader_sampler_map_entry *entry;
struct wined3d_shader_resource_view *view;
struct wined3d_shader *shader;
unsigned int i, j;
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
{
if (!(shader = state->shader[i]))
continue;
for (j = 0; j < WINED3D_MAX_CBS; ++j)
{
if (state->cb[i][j])
wined3d_resource_release(&state->cb[i][j]->resource);
}
for (j = 0; j < shader->reg_maps.sampler_map.count; ++j)
{
entry = &shader->reg_maps.sampler_map.entries[j];
if (!(view = state->shader_resource_view[i][entry->resource_idx]))
continue;
wined3d_resource_release(view->resource);
}
}
}
static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
{ {
struct wined3d_state *state = &cs->device->state; struct wined3d_state *state = &cs->device->state;
struct wined3d_shader_sampler_map_entry *entry;
struct wined3d_shader_resource_view *view;
const struct wined3d_cs_draw *op = data; const struct wined3d_cs_draw *op = data;
struct wined3d_shader *shader; unsigned int i;
unsigned int i, j;
if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]
&& state->load_base_vertex_index != op->base_vertex_idx) && state->load_base_vertex_index != op->base_vertex_idx)
@ -484,27 +511,7 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
} }
if (state->fb->depth_stencil) if (state->fb->depth_stencil)
wined3d_resource_release(state->fb->depth_stencil->resource); wined3d_resource_release(state->fb->depth_stencil->resource);
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) release_shader_resources(state);
{
if (!(shader = state->shader[i]))
continue;
for (j = 0; j < WINED3D_MAX_CBS; ++j)
{
if (state->cb[i][j])
wined3d_resource_release(&state->cb[i][j]->resource);
}
for (j = 0; j < shader->reg_maps.sampler_map.count; ++j)
{
entry = &shader->reg_maps.sampler_map.entries[j];
if (!(view = state->shader_resource_view[i][entry->resource_idx]))
continue;
wined3d_resource_release(view->resource);
}
}
} }
void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx,