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.
This commit is contained in:
Henri Verbeet 2013-04-15 08:14:51 +02:00 committed by Alexandre Julliard
parent f91c0356e7
commit 12a05be5b6
1 changed files with 4 additions and 11 deletions

View File

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