wined3d: Store resource bind flags in the wined3d_resource structure.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-10-30 13:18:47 +03:30 committed by Alexandre Julliard
parent 22b3a4f044
commit 45bf95278d
4 changed files with 13 additions and 13 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;