Module: wine
Branch: master
Commit: 12a05be5b6a081c957619e0e751a56dc28d5b423
URL: http://source.winehq.org/git/wine.git/?a=commit;h=12a05be5b6a081c957619e0e7…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Mon Apr 15 08:14:51 2013 +0200
wined3d: Use GL_STATIC_DRAW_ARB for static buffers.
This mostly affects the initial placement of the VBO. If an application really
does use a static buffer as if it was a dynamic one the driver is likely to
migrate it out of VRAM anyway, we shouldn't penalize more well-behaved
applications for that.
---
dlls/wined3d/buffer.c | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index e9a07a5..dc5b4d2 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -113,7 +113,8 @@ static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_g
/* Context activation is done by the caller. */
static void buffer_create_buffer_object(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info)
{
- GLenum error, gl_usage;
+ GLenum gl_usage = GL_STATIC_DRAW_ARB;
+ GLenum error;
TRACE("Creating an OpenGL vertex buffer object for wined3d_buffer %p with usage %s.\n",
This, debug_d3dusage(This->resource.usage));
@@ -149,12 +150,9 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
goto fail;
}
- /* Don't use static, because dx apps tend to update the buffer
- * quite often even if they specify 0 usage.
- */
- if(This->resource.usage & WINED3DUSAGE_DYNAMIC)
+ if (This->resource.usage & WINED3DUSAGE_DYNAMIC)
{
- TRACE("Gl usage = GL_STREAM_DRAW_ARB\n");
+ TRACE("Buffer has WINED3DUSAGE_DYNAMIC set.\n");
gl_usage = GL_STREAM_DRAW_ARB;
if(gl_info->supported[APPLE_FLUSH_BUFFER_RANGE])
@@ -169,11 +167,6 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
}
/* No setup is needed here for GL_ARB_map_buffer_range */
}
- else
- {
- TRACE("Gl usage = GL_DYNAMIC_DRAW_ARB\n");
- gl_usage = GL_DYNAMIC_DRAW_ARB;
- }
/* Reserve memory for the buffer. The amount of data won't change
* so we are safe with calling glBufferData once and