From 45bf95278d669779e6ca3cde9215556a043a8cf8 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 30 Oct 2018 13:18:47 +0330 Subject: [PATCH] wined3d: Store resource bind flags in the wined3d_resource structure. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/buffer.c | 13 ++++++------- dlls/wined3d/resource.c | 5 +++-- dlls/wined3d/texture.c | 2 +- dlls/wined3d/wined3d_private.h | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 8c7a23fd461..4c90d820a89 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -155,11 +155,11 @@ static void wined3d_buffer_gl_destroy_buffer_object(struct wined3d_buffer_gl *bu * rarely. */ if (resource->bind_count) { - if (buffer_gl->b.bind_flags & WINED3D_BIND_VERTEX_BUFFER) + if (resource->bind_flags & WINED3D_BIND_VERTEX_BUFFER) device_invalidate_state(resource->device, STATE_STREAMSRC); - if (buffer_gl->b.bind_flags & WINED3D_BIND_INDEX_BUFFER) + if (resource->bind_flags & WINED3D_BIND_INDEX_BUFFER) device_invalidate_state(resource->device, STATE_INDEXBUFFER); - if (buffer_gl->b.bind_flags & WINED3D_BIND_CONSTANT_BUFFER) + if (resource->bind_flags & WINED3D_BIND_CONSTANT_BUFFER) { device_invalidate_state(resource->device, STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_VERTEX)); device_invalidate_state(resource->device, STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_HULL)); @@ -168,7 +168,7 @@ static void wined3d_buffer_gl_destroy_buffer_object(struct wined3d_buffer_gl *bu device_invalidate_state(resource->device, STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_PIXEL)); device_invalidate_state(resource->device, STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE)); } - if (buffer_gl->b.bind_flags & WINED3D_BIND_STREAM_OUTPUT) + if (resource->bind_flags & WINED3D_BIND_STREAM_OUTPUT) { device_invalidate_state(resource->device, STATE_STREAM_OUTPUT); if (context->transform_feedback_active) @@ -1379,13 +1379,12 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d } if (FAILED(hr = resource_init(resource, device, WINED3D_RTYPE_BUFFER, format, - WINED3D_MULTISAMPLE_NONE, 0, desc->usage, desc->access, desc->byte_width, 1, 1, - desc->byte_width, parent, parent_ops, &buffer_resource_ops))) + WINED3D_MULTISAMPLE_NONE, 0, desc->usage, desc->bind_flags, desc->access, + desc->byte_width, 1, 1, desc->byte_width, parent, parent_ops, &buffer_resource_ops))) { WARN("Failed to initialize resource, hr %#x.\n", hr); return hr; } - buffer->bind_flags = desc->bind_flags; buffer->structure_byte_stride = desc->structure_byte_stride; buffer->locations = data ? WINED3D_LOCATION_DISCARDED : WINED3D_LOCATION_SYSMEM; diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 9df0a0923b2..a1b2cbd2a0f 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -56,8 +56,8 @@ static void resource_check_usage(DWORD usage) HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, enum wined3d_resource_type type, const struct wined3d_format *format, - enum wined3d_multisample_type multisample_type, unsigned int multisample_quality, - unsigned int usage, unsigned int access, unsigned int width, unsigned int height, unsigned int depth, + enum wined3d_multisample_type multisample_type, unsigned int multisample_quality, unsigned int usage, + unsigned int bind_flags, unsigned int access, unsigned int width, unsigned int height, unsigned int depth, unsigned int size, void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops) { @@ -183,6 +183,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * resource->multisample_type = multisample_type; resource->multisample_quality = multisample_quality; resource->usage = usage; + resource->bind_flags = bind_flags; resource->access = access; resource->width = width; resource->height = height; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 907ede7010f..87998d5552e 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -2996,7 +2996,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc return WINED3DERR_INVALIDCALL; if (FAILED(hr = resource_init(&texture->resource, device, desc->resource_type, format, - desc->multisample_type, desc->multisample_quality, desc->usage, desc->access, + desc->multisample_type, desc->multisample_quality, desc->usage, 0, desc->access, desc->width, desc->height, desc->depth, offset, parent, parent_ops, &texture_resource_ops))) { static unsigned int once; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 87541aa545e..9a01ed29ff9 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3113,6 +3113,7 @@ struct wined3d_resource enum wined3d_multisample_type multisample_type; UINT multisample_quality; DWORD usage; + unsigned int bind_flags; unsigned int access; WORD draw_binding; WORD map_binding; @@ -3153,8 +3154,8 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource) void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN; HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, enum wined3d_resource_type type, const struct wined3d_format *format, - enum wined3d_multisample_type multisample_type, unsigned int multisample_quality, - unsigned int usage, unsigned int access, unsigned int width, unsigned int height, unsigned int depth, + enum wined3d_multisample_type multisample_type, unsigned int multisample_quality, unsigned int usage, + unsigned int bind_flags, unsigned int access, unsigned int width, unsigned int height, unsigned int depth, unsigned int size, void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -3772,7 +3773,6 @@ struct wined3d_buffer { struct wined3d_resource resource; - unsigned int bind_flags; unsigned int structure_byte_stride; DWORD flags; DWORD locations;