[PATCH] wined3d: Add a registry key to configure buffer object placement
Stefan Dösinger
stefan at codeweavers.com
Mon Apr 1 03:30:12 CDT 2013
This can provide huge speed improvements in some games, but please test it properly
before recommending it in HOWTOs.
---
dlls/wined3d/buffer.c | 6 ++++++
dlls/wined3d/wined3d_main.c | 7 +++++++
dlls/wined3d/wined3d_private.h | 4 ++++
3 files changed, 17 insertions(+)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index e9a07a5..8dfcb11 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -118,6 +118,12 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc
TRACE("Creating an OpenGL vertex buffer object for wined3d_buffer %p with usage %s.\n",
This, debug_d3dusage(This->resource.usage));
+ if (wined3d_settings.placebo == PLACEBO_VIDMEM)
+ {
+ TRACE("Placing buffer %p in video memory\n", This);
+ glHint(This->buffer_type_hint, GL_FASTEST);
+ }
+
/* Make sure that the gl error is cleared. Do not use checkGLcall
* here because checkGLcall just prints a fixme and continues. However,
* if an error during VBO creation occurs we can fall back to non-vbo operation
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index f49e5bc..d1b7153 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -85,6 +85,7 @@ struct wined3d_settings wined3d_settings =
~0U, /* No VS shader model limit by default. */
~0U, /* No GS shader model limit by default. */
~0U, /* No PS shader model limit by default. */
+ PLACEBO_SYSMEM, /* Place buffers in sysmem by default */
};
/* Do not call while under the GL lock. */
@@ -309,6 +310,12 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
TRACE("Limiting GS shader model to %u.\n", wined3d_settings.max_sm_gs);
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelPS", &wined3d_settings.max_sm_ps))
TRACE("Limiting PS shader model to %u.\n", wined3d_settings.max_sm_ps);
+ if (!get_config_key(hkey, appkey, "PlaceBO", buffer, size)
+ && !strcmp(buffer,"vidmem"))
+ {
+ TRACE("Attempting to place buffer objects in video memory for performance.\n");
+ wined3d_settings.placebo = PLACEBO_VIDMEM;
+ }
}
if (appkey) RegCloseKey( appkey );
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 2a11286..30ddc8a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -246,6 +246,9 @@ static inline float float_24_to_32(DWORD in)
#define PCI_VENDOR_NONE 0xffff /* e.g. 0x8086 for Intel and 0x10de for Nvidia */
#define PCI_DEVICE_NONE 0xffff /* e.g. 0x14f for a Geforce6200 */
+#define PLACEBO_SYSMEM 0
+#define PLACEBO_VIDMEM 1
+
/* NOTE: When adding fields to this structure, make sure to update the default
* values in wined3d_main.c as well. */
struct wined3d_settings
@@ -267,6 +270,7 @@ struct wined3d_settings
unsigned int max_sm_vs;
unsigned int max_sm_gs;
unsigned int max_sm_ps;
+ unsigned int placebo;
};
extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN;
--
1.8.1.5
More information about the wine-patches
mailing list