From 2249527922504ae0e379da738b3ef5986c037b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Wed, 8 Feb 2017 11:54:13 +0100 Subject: [PATCH] wined3d: Use more suitable bind target for SRV/UAV buffers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/buffer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index de5ab17d1d7..5e434f3e31b 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -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;