Stefan Dösinger : wined3d: Set WINED3D_BUFFER_CREATEBO in buffer_init().
Alexandre Julliard
julliard at winehq.org
Mon Jan 4 10:54:18 CST 2010
Module: wine
Branch: master
Commit: 1bd98719e6bcf02185b34ba6246d0aad4570236e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1bd98719e6bcf02185b34ba6246d0aad4570236e
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Mon Dec 28 00:31:12 2009 +0100
wined3d: Set WINED3D_BUFFER_CREATEBO in buffer_init().
---
dlls/wined3d/buffer.c | 25 +++++++++++++++++++++++++
dlls/wined3d/device.c | 26 ++------------------------
2 files changed, 27 insertions(+), 24 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index c5b8b44..ceeede0 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1098,6 +1098,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
{
const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(format, &device->adapter->gl_info);
HRESULT hr;
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
if (!size)
{
@@ -1119,6 +1120,30 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
TRACE("size %#x, usage %#x, format %s, memory @ %p, iface @ %p.\n", buffer->resource.size, buffer->resource.usage,
debug_d3dformat(buffer->resource.format_desc->format), buffer->resource.allocatedMemory, buffer);
+ /* Observations show that drawStridedSlow is faster on dynamic VBs than converting +
+ * drawStridedFast (half-life 2 and others).
+ *
+ * Basically converting the vertices in the buffer is quite expensive, and observations
+ * show that drawStridedSlow is faster than converting + uploading + drawStridedFast.
+ * Therefore do not create a VBO for WINED3DUSAGE_DYNAMIC buffers.
+ */
+ if (!gl_info->supported[ARB_VERTEX_BUFFER_OBJECT])
+ {
+ TRACE("Not creating a vbo because GL_ARB_vertex_buffer is not supported\n");
+ }
+ else if(buffer->resource.pool == WINED3DPOOL_SYSTEMMEM)
+ {
+ TRACE("Not creating a vbo because the vertex buffer is in system memory\n");
+ }
+ else if(buffer->resource.usage & WINED3DUSAGE_DYNAMIC)
+ {
+ TRACE("Not creating a vbo because the buffer has dynamic usage\n");
+ }
+ else
+ {
+ buffer->flags |= WINED3D_BUFFER_CREATEBO;
+ }
+
if (data)
{
BYTE *ptr;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 78db960..34495d3 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -520,23 +520,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
TRACE("Created buffer %p.\n", object);
*ppVertexBuffer = (IWineD3DBuffer *)object;
- /* Observations show that drawStridedSlow is faster on dynamic VBs than converting +
- * drawStridedFast (half-life 2).
- *
- * Basically converting the vertices in the buffer is quite expensive, and observations
- * show that drawStridedSlow is faster than converting + uploading + drawStridedFast.
- * Therefore do not create a VBO for WINED3DUSAGE_DYNAMIC buffers.
- */
- if (!This->adapter->gl_info.supported[ARB_VERTEX_BUFFER_OBJECT])
- {
- TRACE("Not creating a vbo because GL_ARB_vertex_buffer is not supported\n");
- } else if(Pool == WINED3DPOOL_SYSTEMMEM) {
- TRACE("Not creating a vbo because the vertex buffer is in system memory\n");
- } else if(Usage & WINED3DUSAGE_DYNAMIC) {
- TRACE("Not creating a vbo because the buffer has dynamic usage\n");
- } else {
- object->flags |= WINED3D_BUFFER_CREATEBO;
- }
return WINED3D_OK;
}
@@ -560,7 +543,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface
}
hr = buffer_init(object, This, Length, Usage | WINED3DUSAGE_STATICDECL,
- WINED3DFMT_UNKNOWN, Pool, GL_ELEMENT_ARRAY_BUFFER_ARB, NULL, parent, parent_ops);
+ WINED3DFMT_UNKNOWN, Pool, GL_ELEMENT_ARRAY_BUFFER_ARB, NULL,
+ parent, parent_ops);
if (FAILED(hr))
{
WARN("Failed to initialize buffer, hr %#x\n", hr);
@@ -570,12 +554,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface
TRACE("Created buffer %p.\n", object);
- if (Pool != WINED3DPOOL_SYSTEMMEM && !(Usage & WINED3DUSAGE_DYNAMIC)
- && This->adapter->gl_info.supported[ARB_VERTEX_BUFFER_OBJECT])
- {
- object->flags |= WINED3D_BUFFER_CREATEBO;
- }
-
*ppIndexBuffer = (IWineD3DBuffer *) object;
return WINED3D_OK;
More information about the wine-cvs
mailing list