I tried to play Supreme Commander using pbuffer option instead of fbo. I
was quite happy with it, since I gained quite a bunch of performance (I
mean, something I really COULD see), but after a while, the performance
dropped dramatically, to ~4-5 fps.
I tested quite a few thing, and I finally found that pixel bufers were
not taken in account when calculating available texture memory. The game
then allocated more textures, and good opengl didn't dare complain when
putting them in system memory.
Attached is a patch which should solve the problem.
For those who are curious, try setting VideoMemorySize to 200 instead of
256. It works just like a charm.
>From 8e7b7e517b15e2ddb2cdd1526dfab3dfbf856bd5 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=A9r=C3=B4me=20Gardou?= <jerome.gardou(a)laposte.net>
Date: Sun, 25 Jan 2009 02:34:03 +0100
Subject: [PATCH] wined3d: take pixel buffers in account when calculating texture ram.
---
dlls/wined3d/context.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index da3053a..9fad82d 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -898,6 +898,9 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
}
This->frag_pipe->enable_extension((IWineD3DDevice *) This, TRUE);
+ if(create_pbuffer)
+ WineD3DAdapterChangeGLRam(This, ((IWineD3DSurfaceImpl*)(ret->surface))->currentDesc.Width * ((IWineD3DSurfaceImpl*)(ret->surface))->currentDesc.Height * ((IWineD3DSurfaceImpl*)(ret->surface))->bytesPerPixel) ;
+
return ret;
out:
@@ -988,6 +991,7 @@ void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context) {
if(context->isPBuffer) {
GL_EXTCALL(wglReleasePbufferDCARB(context->pbuffer, context->hdc));
GL_EXTCALL(wglDestroyPbufferARB(context->pbuffer));
+ WineD3DAdapterChangeGLRam(This,(-1) * ((IWineD3DSurfaceImpl*)(context->surface))->currentDesc.Width * ((IWineD3DSurfaceImpl*)(context->surface))->currentDesc.Height * ((IWineD3DSurfaceImpl*)(context->surface))->bytesPerPixel) ;
} else ReleaseDC(context->win_handle, context->hdc);
pwglDeleteContext(context->glCtx);
--
1.6.0.6