wined3d: Simplify device_resource_released() a little.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-03-22 14:22:45 +04:30 committed by Alexandre Julliard
parent e5ab987d60
commit f31ed9837a
1 changed files with 25 additions and 31 deletions

View File

@ -5073,55 +5073,49 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
case WINED3D_RTYPE_TEXTURE_3D:
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
{
struct wined3d_texture *texture = texture_from_resource(resource);
if (device->state.textures[i] == texture)
if (&device->state.textures[i]->resource == resource)
{
ERR("Texture %p is still in use, stage %u.\n", texture, i);
ERR("Texture resource %p is still in use, stage %u.\n", resource, i);
device->state.textures[i] = NULL;
}
if (device->recording && device->update_state->textures[i] == texture)
if (device->recording && &device->update_state->textures[i]->resource == resource)
{
ERR("Texture %p is still in use by recording stateblock %p, stage %u.\n",
texture, device->recording, i);
ERR("Texture resource %p is still in use by recording stateblock %p, stage %u.\n",
resource, device->recording, i);
device->update_state->textures[i] = NULL;
}
}
break;
case WINED3D_RTYPE_BUFFER:
for (i = 0; i < MAX_STREAMS; ++i)
{
struct wined3d_buffer *buffer = buffer_from_resource(resource);
for (i = 0; i < MAX_STREAMS; ++i)
if (&device->state.streams[i].buffer->resource == resource)
{
if (device->state.streams[i].buffer == buffer)
{
ERR("Buffer %p is still in use, stream %u.\n", buffer, i);
device->state.streams[i].buffer = NULL;
}
if (device->recording && device->update_state->streams[i].buffer == buffer)
{
ERR("Buffer %p is still in use by stateblock %p, stream %u.\n",
buffer, device->recording, i);
device->update_state->streams[i].buffer = NULL;
}
ERR("Buffer resource %p is still in use, stream %u.\n", resource, i);
device->state.streams[i].buffer = NULL;
}
if (device->state.index_buffer == buffer)
if (device->recording && &device->update_state->streams[i].buffer->resource == resource)
{
ERR("Buffer %p is still in use as index buffer.\n", buffer);
device->state.index_buffer = NULL;
ERR("Buffer resource %p is still in use by stateblock %p, stream %u.\n",
resource, device->recording, i);
device->update_state->streams[i].buffer = NULL;
}
}
if (device->recording && device->update_state->index_buffer == buffer)
{
ERR("Buffer %p is still in use by stateblock %p as index buffer.\n",
buffer, device->recording);
device->update_state->index_buffer = NULL;
}
if (&device->state.index_buffer->resource == resource)
{
ERR("Buffer resource %p is still in use as index buffer.\n", resource);
device->state.index_buffer = NULL;
}
if (device->recording && &device->update_state->index_buffer->resource == resource)
{
ERR("Buffer resource %p is still in use by stateblock %p as index buffer.\n",
resource, device->recording);
device->update_state->index_buffer = NULL;
}
break;