Module: wine Branch: master Commit: 12140b515871bd4cf672a7776f350b40c89b7cfb URL: http://source.winehq.org/git/wine.git/?a=commit;h=12140b515871bd4cf672a7776f...
Author: Stefan Dösinger stefan@codeweavers.com Date: Tue Apr 19 21:23:15 2011 +0200
wined3d: Drop the VBO when the GL alignment doesn't fit on dynamic buffers.
---
dlls/wined3d/buffer.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 2f6ff2a..d9d9a2a 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1053,8 +1053,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
if (((DWORD_PTR)buffer->resource.allocatedMemory) & (RESOURCE_ALIGNMENT - 1)) { - WARN("Pointer %p is not %u byte aligned, falling back to double buffered operation.\n", - buffer->resource.allocatedMemory, RESOURCE_ALIGNMENT); + WARN("Pointer %p is not %u byte aligned.\n", buffer->resource.allocatedMemory, RESOURCE_ALIGNMENT);
ENTER_GL(); GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint)); @@ -1062,7 +1061,21 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN LEAVE_GL(); buffer->resource.allocatedMemory = NULL;
- buffer_get_sysmem(buffer, gl_info); + if (buffer->resource.usage & WINED3DUSAGE_DYNAMIC) + { + /* The extra copy is more expensive than not using VBOs at + * all on the Nvidia Linux driver, which is the only driver + * that returns unaligned pointers + */ + TRACE("Dynamic buffer, dropping VBO\n"); + buffer_unload(&buffer->resource); + buffer->flags &= ~WINED3D_BUFFER_CREATEBO; + } + else + { + TRACE("Falling back to doublebuffered operation\n"); + buffer_get_sysmem(buffer, gl_info); + } TRACE("New pointer is %p.\n", buffer->resource.allocatedMemory); } context_release(context);