Commit de43de51 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Move the resource bind_count field up to wined3d_resource.

parent 9fd2d34d
...@@ -767,7 +767,7 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) ...@@ -767,7 +767,7 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer)
} }
/* Reading the declaration makes only sense if the stateblock is finalized and the buffer bound to a stream */ /* Reading the declaration makes only sense if the stateblock is finalized and the buffer bound to a stream */
if (device->isInDraw && buffer->bind_count > 0) if (device->isInDraw && buffer->resource.bind_count > 0)
{ {
decl_changed = buffer_find_decl(buffer); decl_changed = buffer_find_decl(buffer);
buffer->flags |= WINED3D_BUFFER_HASDESC; buffer->flags |= WINED3D_BUFFER_HASDESC;
...@@ -836,7 +836,7 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) ...@@ -836,7 +836,7 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer)
FIXME("Too many full buffer conversions, stopping converting.\n"); FIXME("Too many full buffer conversions, stopping converting.\n");
buffer_unload(&buffer->resource); buffer_unload(&buffer->resource);
buffer->flags &= ~WINED3D_BUFFER_CREATEBO; buffer->flags &= ~WINED3D_BUFFER_CREATEBO;
if (buffer->bind_count) if (buffer->resource.bind_count)
device_invalidate_state(device, STATE_STREAMSRC); device_invalidate_state(device, STATE_STREAMSRC);
return; return;
} }
...@@ -1063,7 +1063,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN ...@@ -1063,7 +1063,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
TRACE("Dynamic buffer, dropping VBO\n"); TRACE("Dynamic buffer, dropping VBO\n");
buffer_unload(&buffer->resource); buffer_unload(&buffer->resource);
buffer->flags &= ~WINED3D_BUFFER_CREATEBO; buffer->flags &= ~WINED3D_BUFFER_CREATEBO;
if (buffer->bind_count) if (buffer->resource.bind_count)
device_invalidate_state(device, STATE_STREAMSRC); device_invalidate_state(device, STATE_STREAMSRC);
} }
else else
......
...@@ -1696,12 +1696,12 @@ HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UI ...@@ -1696,12 +1696,12 @@ HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UI
if (buffer) if (buffer)
{ {
InterlockedIncrement(&buffer->bind_count); InterlockedIncrement(&buffer->resource.bind_count);
wined3d_buffer_incref(buffer); wined3d_buffer_incref(buffer);
} }
if (prev_buffer) if (prev_buffer)
{ {
InterlockedDecrement(&prev_buffer->bind_count); InterlockedDecrement(&prev_buffer->resource.bind_count);
wined3d_buffer_decref(prev_buffer); wined3d_buffer_decref(prev_buffer);
} }
...@@ -2328,12 +2328,12 @@ HRESULT CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, ...@@ -2328,12 +2328,12 @@ HRESULT CDECL wined3d_device_set_index_buffer(struct wined3d_device *device,
device_invalidate_state(device, STATE_INDEXBUFFER); device_invalidate_state(device, STATE_INDEXBUFFER);
if (buffer) if (buffer)
{ {
InterlockedIncrement(&buffer->bind_count); InterlockedIncrement(&buffer->resource.bind_count);
wined3d_buffer_incref(buffer); wined3d_buffer_incref(buffer);
} }
if (prev_buffer) if (prev_buffer)
{ {
InterlockedDecrement(&prev_buffer->bind_count); InterlockedDecrement(&prev_buffer->resource.bind_count);
wined3d_buffer_decref(prev_buffer); wined3d_buffer_decref(prev_buffer);
} }
} }
...@@ -3669,7 +3669,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, ...@@ -3669,7 +3669,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
if (texture) if (texture)
{ {
LONG bind_count = InterlockedIncrement(&texture->bind_count); LONG bind_count = InterlockedIncrement(&texture->resource.bind_count);
wined3d_texture_incref(texture); wined3d_texture_incref(texture);
...@@ -3691,7 +3691,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, ...@@ -3691,7 +3691,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
if (prev) if (prev)
{ {
LONG bind_count = InterlockedDecrement(&prev->bind_count); LONG bind_count = InterlockedDecrement(&prev->resource.bind_count);
wined3d_texture_decref(prev); wined3d_texture_decref(prev);
......
...@@ -502,7 +502,7 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) ...@@ -502,7 +502,7 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod)
texture->texture_rgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; texture->texture_rgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U;
texture->texture_srgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; texture->texture_srgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U;
if (texture->bind_count) if (texture->resource.bind_count)
device_invalidate_state(texture->resource.device, STATE_SAMPLER(texture->sampler)); device_invalidate_state(texture->resource.device, STATE_SAMPLER(texture->sampler));
} }
...@@ -1056,7 +1056,7 @@ static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB ...@@ -1056,7 +1056,7 @@ static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB
/* TODO: Use already acquired context when possible. */ /* TODO: Use already acquired context when possible. */
context = context_acquire(device, NULL); context = context_acquire(device, NULL);
if (texture->bind_count > 0) if (texture->resource.bind_count > 0)
{ {
BOOL texture_srgb = texture->flags & WINED3D_TEXTURE_IS_SRGB; BOOL texture_srgb = texture->flags & WINED3D_TEXTURE_IS_SRGB;
BOOL sampler_srgb = texture_srgb_mode(texture, srgb); BOOL sampler_srgb = texture_srgb_mode(texture, srgb);
......
...@@ -1837,6 +1837,7 @@ struct wined3d_resource_ops ...@@ -1837,6 +1837,7 @@ struct wined3d_resource_ops
struct wined3d_resource struct wined3d_resource
{ {
LONG ref; LONG ref;
LONG bind_count;
struct wined3d_device *device; struct wined3d_device *device;
enum wined3d_resource_type type; enum wined3d_resource_type type;
const struct wined3d_format *format; const struct wined3d_format *format;
...@@ -1929,7 +1930,6 @@ struct wined3d_texture ...@@ -1929,7 +1930,6 @@ struct wined3d_texture
float pow2_matrix[16]; float pow2_matrix[16];
UINT lod; UINT lod;
enum wined3d_texture_filter_type filter_type; enum wined3d_texture_filter_type filter_type;
LONG bind_count;
DWORD sampler; DWORD sampler;
DWORD flags; DWORD flags;
const struct min_lookup *min_mip_lookup; const struct min_lookup *min_mip_lookup;
...@@ -2408,7 +2408,6 @@ struct wined3d_buffer ...@@ -2408,7 +2408,6 @@ struct wined3d_buffer
GLenum buffer_object_usage; GLenum buffer_object_usage;
GLenum buffer_type_hint; GLenum buffer_type_hint;
UINT buffer_object_size; UINT buffer_object_size;
LONG bind_count;
DWORD flags; DWORD flags;
LONG lock_count; LONG lock_count;
......
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