wined3d: Use more suitable bind target for SRV/UAV buffers.

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-08 11:54:13 +01:00 committed by Alexandre Julliard
parent 0b4ca25198
commit 2249527922
1 changed files with 7 additions and 2 deletions

View File

@ -1353,11 +1353,16 @@ static const struct wined3d_resource_ops buffer_resource_ops =
buffer_resource_sub_resource_unmap,
};
static GLenum buffer_type_hint_from_bind_flags(unsigned int bind_flags)
static GLenum buffer_type_hint_from_bind_flags(const struct wined3d_gl_info *gl_info,
unsigned int bind_flags)
{
if (bind_flags == WINED3D_BIND_INDEX_BUFFER)
return GL_ELEMENT_ARRAY_BUFFER;
if (bind_flags & (WINED3D_BIND_SHADER_RESOURCE | WINED3D_BIND_UNORDERED_ACCESS)
&& gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT])
return GL_TEXTURE_BUFFER;
if (bind_flags & WINED3D_BIND_CONSTANT_BUFFER)
return GL_UNIFORM_BUFFER;
@ -1395,7 +1400,7 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
WARN("Failed to initialize resource, hr %#x.\n", hr);
return hr;
}
buffer->buffer_type_hint = buffer_type_hint_from_bind_flags(bind_flags);
buffer->buffer_type_hint = buffer_type_hint_from_bind_flags(gl_info, bind_flags);
buffer->bind_flags = bind_flags;
buffer->locations = WINED3D_LOCATION_SYSMEM;