Attached is a patch file of the changes I have made to wined3d and it's
config options.
Summary of the changes :
* Cleaned up graphics tab on winecfg to make room for more DirectX
related options. In an ideal world, options would be automagically
detected but due to the amount of differences between setups and such,
this isn't feasable at the moment.
* User-selectable pixel shader version. Default is 1.4. 2.0 is
selectable and if your card has GLSL support it should return the PS
version to apps as 2.0. 98% of the PS 2.0 functions right now however
are stubs or not implemented so this is why 1.4 is default. Setting the
version to 2.0 will return a warning stating that it will most likely
break any applications that try to use 2.0.
* User-selectable texture memory reporting. The current CVS version is
hardcoded to report 64 megabytes of graphics card texture memory. I
changed the hardcoded variable to be set by a registry setting allowing
the user to set how much graphics card memory this wish to report to D3D
apps. This should help games and applications that use a lot of big or
highly-detailed textures. In the future, default should autodetect
however right now default is 64 megabytes.
I'd appreciate if people could test this patch and see if it breaks any
games. It compiles and runs fine on my system but I'd like to know
regardless. Sometimes I have a tendency to make silly mistakes in coding :P
As for the text that was removed, most of it described what things like
the virtual desktop function did and it took up over half of the tabs
pane. This text should probably be placed in either the user
manual/documentation or through some future help function in winecfg.
Someone suggested I add a seperate DirectX tab however as it is right
now, I do not think it is a good idea to add many more tabs. Too many
tabs can lead to useability issues as people are unable to find where
different settings are located.
I will seperate the patches out later by the specific changes they do
but right now it's just one big patch file.
Thanks
Index: dlls/wined3d/device.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/device.c,v
retrieving revision 1.117
diff -u -p -r1.117 device.c
--- dlls/wined3d/device.c 4 Feb 2006 17:18:46 -0000 1.117
+++ dlls/wined3d/device.c 4 Feb 2006 22:20:58 -0000
@@ -47,9 +47,6 @@ inline static Display *get_display( HDC
return display;
}
-/* Memory tracking and object counting */
-static unsigned int emulated_textureram = 64*1024*1024;
-
/* TODO: setup some flags in the regestry to enable, disable pbuffer support */
/* enable pbuffer support for offscreen textures */
BOOL pbuffer_support = FALSE;
@@ -1679,21 +1676,11 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetDir
}
UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *iface) {
- /** NOTE: There's a probably a hack-around for this one by putting as many pbuffers, VBO's (or whatever)
- * Into the video ram as possible and seeing how many fit
- * you can also get the correct initial value from via X and ATI's driver
- *******************/
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- static BOOL showfixmes = TRUE;
- if (showfixmes) {
- FIXME("(%p) : stub, emulating %dMib for now, returning %dMib\n", This, (emulated_textureram/(1024*1024)),
- ((emulated_textureram - wineD3DGlobalStatistics->glsurfaceram) / (1024*1024)));
- showfixmes = FALSE;
- }
- TRACE("(%p) : emulating %dMib for now, returning %dMib\n", This, (emulated_textureram/(1024*1024)),
- ((emulated_textureram - wineD3DGlobalStatistics->glsurfaceram) / (1024*1024)));
+ TRACE("(%p) : emulating %dMib for now, returning %dMib\n", This, (wined3d_settings.texture_memory/(1024*1024)),
+ ((wined3d_settings.texture_memory - wineD3DGlobalStatistics->glsurfaceram) / (1024*1024)));
/* videomemory is simulated videomemory + AGP memory left */
- return (emulated_textureram - wineD3DGlobalStatistics->glsurfaceram);
+ return (wined3d_settings.texture_memory - wineD3DGlobalStatistics->glsurfaceram);
}
Index: dlls/wined3d/directx.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/directx.c,v
retrieving revision 1.68
diff -u -p -r1.68 directx.c
--- dlls/wined3d/directx.c 2 Feb 2006 13:14:12 -0000 1.68
+++ dlls/wined3d/directx.c 4 Feb 2006 22:20:59 -0000
@@ -487,6 +487,9 @@ static BOOL IWineD3DImpl_FillGLCaps(Wine
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &gl_max);
TRACE_(d3d_caps)(" FOUND: ARB Pixel Shader support - GL_MAX_TEXTURE_IMAGE_UNITS_ARB=%u\n", gl_max);
gl_info->max_samplers = min(MAX_SAMPLERS, gl_max);
+ } else if (strcmp(ThisExtn, "GL_ARB_shading_language_100") == 0) {
+ TRACE_(d3d_caps)(" FOUND: ARB Shading Language support\n");
+ gl_info->supported[ARB_SHADING_LANGUAGE_100] = TRUE;
} else if (strcmp(ThisExtn, "GL_ARB_multisample") == 0) {
TRACE_(d3d_caps)(" FOUND: ARB Multisample support\n");
gl_info->supported[ARB_MULTISAMPLE] = TRUE;
@@ -1308,7 +1311,7 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceT
return hr;
}
}
-
+ FIXME("FORMAT not supported");
return D3DERR_NOTAVAILABLE;
}
@@ -1325,7 +1328,7 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceF
CheckFormat, debug_d3dformat(CheckFormat));
if (Adapter >= IWineD3D_GetAdapterCount(iface)) {
- return D3DERR_INVALIDCALL;
+ return D3DERR_INVALIDCALL;
}
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
@@ -1671,15 +1674,48 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCap
*pCaps->VertexShaderVersion = 0;
*pCaps->MaxVertexShaderConst = 0;
}
-
- if ((wined3d_settings.ps_mode == PS_HW) && GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && (DeviceType != D3DDEVTYPE_REF)) {
- *pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
- *pCaps->PixelShader1xMaxValue = 1.0;
- } else {
- *pCaps->PixelShaderVersion = 0;
- *pCaps->PixelShader1xMaxValue = 0.0;
+
+ if (GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && (DeviceType != D3DDEVTYPE_REF)) {
+ switch (wined3d_settings.ps_mode) {
+ case PS_NONE :
+ *pCaps->PixelShaderVersion = 0;
+ *pCaps->PixelShader1xMaxValue = 0;
+ break;
+ case PS_11 :
+ *pCaps->PixelShaderVersion = D3DPS_VERSION(1,1);
+ *pCaps->PixelShader1xMaxValue = 1.0;
+ break;
+ case PS_12 :
+ *pCaps->PixelShaderVersion = D3DPS_VERSION(1,2);
+ *pCaps->PixelShader1xMaxValue = 1.0;
+ break;
+ case PS_13 :
+ *pCaps->PixelShaderVersion = D3DPS_VERSION(1,3);
+ *pCaps->PixelShader1xMaxValue = 1.0;
+ break;
+ case PS_14 :
+ *pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
+ *pCaps->PixelShader1xMaxValue = 1.0;
+ break;
+ case PS_20 :
+ if(GL_SUPPORT(ARB_SHADING_LANGUAGE_100)) {
+ WARN("PS 2.0 support is mostly incomplete,turning it on will break most applications that attempt to use it.\n");
+ *pCaps->PixelShaderVersion = D3DPS_VERSION(2,0);
+ *pCaps->PixelShader1xMaxValue = 1.0;
+ break;
+ } else {
+ WARN("Your OpenGL driver lacks the needed extensions to support Pixel Shader 2.0\n");
+ WARN("Defaulting back to Pixel Shader version 1.4");
+ *pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
+ *pCaps->PixelShader1xMaxValue = 1.0;
+ }
+ break;
+
+ default :
+ WARN("Invalid Pixel Shader version %d",wined3d_settings.ps_mode);
+ break;
+ }
}
- /* TODO: ARB_FRAGMENT_PROGRAM_100 */
/* ------------------------------------------------
The following fields apply to d3d9 only
Index: dlls/wined3d/wined3d_main.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/wined3d_main.c,v
retrieving revision 1.15
diff -u -p -r1.15 wined3d_main.c
--- dlls/wined3d/wined3d_main.c 10 Nov 2005 12:14:57 -0000 1.15
+++ dlls/wined3d/wined3d_main.c 4 Feb 2006 22:21:00 -0000
@@ -142,19 +142,46 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL,
wined3d_settings.vs_mode = VS_SW;
}
}
+
if ( !get_config_key( hkey, appkey, "PixelShaderMode", buffer, size) )
{
- if (!strcmp(buffer,"enabled"))
- {
- TRACE("Allow pixel shaders\n");
- wined3d_settings.ps_mode = PS_HW;
- }
+ if (!strcmp(buffer,"1.1"))
+ {
+ TRACE("Allow pixel shaders version 1.1\n");
+ wined3d_settings.ps_mode = PS_11;
+ }
+ if (!strcmp(buffer,"1.2"))
+ {
+ TRACE("Allow pixel shaders version 1.2\n");
+ wined3d_settings.ps_mode = PS_12;
+ }
+ if (!strcmp(buffer,"1.3"))
+ {
+ TRACE("Allow pixel shaders version 1.3\n");
+ wined3d_settings.ps_mode = PS_13;
+ }
+ if (!strcmp(buffer,"1.4"))
+ {
+ TRACE("Allow pixel shaders version 1.4\n");
+ wined3d_settings.ps_mode = PS_14;
+ }
+ if (!strcmp(buffer,"2.0"))
+ {
+ TRACE("Allow pixel shaders version 2.0\n");
+ wined3d_settings.ps_mode = PS_20;
+ }
+ if (!strcmp(buffer,"default"))
+ {
+ TRACE("Allow pixel shaders version 1.4\n");
+ wined3d_settings.ps_mode = PS_14;
+ }
if (!strcmp(buffer,"disabled"))
{
TRACE("Disable pixel shaders\n");
wined3d_settings.ps_mode = PS_NONE;
}
}
+
if ( !get_config_key( hkey, appkey, "VertexBufferMode", buffer, size) )
{
if (!strcmp(buffer,"none"))
@@ -183,11 +210,42 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL,
}
/* There will be a couple of other choices for nonpow2, they are: TextureRecrangle and OpenGL 2 */
}
+ if ( !get_config_key( hkey, appkey, "TextureMemory", buffer, size) )
+ {
+ /* D3D expects texture memory to be returned in bytes so we multiply twice to convert from megabytes */
+ if (!strcmp(buffer,"16 Mb")) {
+ TRACE("Setting available texture memory to 16 Mb + AGP");
+ wined3d_settings.texture_memory = 16 * 1024 * 1024;
+ }
+ if (!strcmp(buffer,"32 Mb")) {
+ TRACE("Setting available texture memory to 32 Mb + AGP");
+ wined3d_settings.texture_memory = 32 * 1024 * 1024;
+ }
+ if (!strcmp(buffer,"64 Mb")) {
+ TRACE("Setting available texture memory to 64 Mb + AGP");
+ wined3d_settings.texture_memory = 64 * 1024 * 1024;
+ }
+ if (!strcmp(buffer,"128 Mb")) {
+ TRACE("Setting available texture memory to 128 Mb + AGP");
+ wined3d_settings.texture_memory = 128 * 1024 * 1024;
+ }
+ if (!strcmp(buffer,"256 Mb")) {
+ TRACE("Setting available texture memory to 256 Mb + AGP");
+ wined3d_settings.texture_memory = 256 * 1024 * 1024;
+ }
+ if (!strcmp(buffer,"512 Mb")) {
+ TRACE("Setting available texture memory to 512 Mb + AGP");
+ wined3d_settings.texture_memory = 512 * 1024 * 1024;
+ }
+ if (!strcmp(buffer,"1024 Mb")) {
+ TRACE("Setting available texture memory to 1024 Mb + AGP");
+ wined3d_settings.texture_memory = 1024 * 1024 * 1024;
+ }
+ }
}
+
if (wined3d_settings.vs_mode == VS_HW)
TRACE("Allow HW vertex shaders\n");
- if (wined3d_settings.ps_mode == PS_NONE)
- TRACE("Disable pixel shaders\n");
if (wined3d_settings.vbo_mode == VBO_NONE)
TRACE("Disable Vertex Buffer Hardware support\n");
if (wined3d_settings.nonpower2_mode == NP2_REPACK)
@@ -198,3 +256,5 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL,
}
return TRUE;
}
+
+
Index: dlls/wined3d/wined3d_private.h
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/wined3d_private.h,v
retrieving revision 1.72
diff -u -p -r1.72 wined3d_private.h
--- dlls/wined3d/wined3d_private.h 9 Dec 2005 12:18:30 -0000 1.72
+++ dlls/wined3d/wined3d_private.h 4 Feb 2006 22:21:01 -0000
@@ -115,7 +115,11 @@ UINT static const glTypeLookup[D3DDECLTY
#define VS_SW 2
#define PS_NONE 0
-#define PS_HW 1
+#define PS_11 1
+#define PS_12 2
+#define PS_13 3
+#define PS_14 4
+#define PS_20 5
#define VBO_NONE 0
#define VBO_HW 1
@@ -130,6 +134,8 @@ typedef struct wined3d_settings_s {
int vbo_mode;
/* nonpower 2 function */
int nonpower2_mode;
+/* texture memory */
+ uint texture_memory;
} wined3d_settings_t;
extern wined3d_settings_t wined3d_settings;
Index: include/wine/wined3d_gl.h
===================================================================
RCS file: /home/wine/wine/include/wine/wined3d_gl.h,v
retrieving revision 1.14
diff -u -p -r1.14 wined3d_gl.h
--- include/wine/wined3d_gl.h 30 Nov 2005 20:56:17 -0000 1.14
+++ include/wine/wined3d_gl.h 4 Feb 2006 22:21:03 -0000
@@ -908,6 +908,7 @@ typedef enum _GL_SupportedExt {
ARB_POINT_PARAMETERS,
ARB_PIXEL_BUFFER_OBJECT,
ARB_POINT_SPRITE,
+ ARB_SHADING_LANGUAGE_100,
ARB_TEXTURE_COMPRESSION,
ARB_TEXTURE_CUBE_MAP,
ARB_TEXTURE_ENV_ADD,
@@ -919,6 +920,7 @@ typedef enum _GL_SupportedExt {
ARB_VERTEX_BLEND,
ARB_VERTEX_BUFFER_OBJECT,
/* EXT */
+ EXT_BLEND_FUNC_SEPARATE,
EXT_FOG_COORD,
EXT_FRAMEBUFFER_OBJECT,
EXT_PALETTED_TEXTURE,
@@ -981,6 +983,8 @@ typedef enum _GL_SupportedExt {
USE_GL_FUNC(PGLFNGETBUFFERPARAMETERIVARBPROC, glGetBufferParameterivARB); \
USE_GL_FUNC(PGLFNGETBUFFERPOINTERVARBPROC, glGetBufferPointervARB); \
/** EXT Extensions **/ \
+ /* GL_EXT_blend_func_separate */ \
+ USE_GL_FUNC(PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate); \
/* GL_EXT_fog_coord */ \
/* GL_EXT_framebuffer_object */ \
USE_GL_FUNC(PGLFNGLISRENDERBUFFEREXTPROC, glIsRenderbufferEXT); \
Index: programs/winecfg/En.rc
===================================================================
RCS file: /home/wine/wine/programs/winecfg/En.rc,v
retrieving revision 1.59
diff -u -p -r1.59 En.rc
--- programs/winecfg/En.rc 2 Feb 2006 13:13:48 -0000 1.59
+++ programs/winecfg/En.rc 4 Feb 2006 22:21:03 -0000
@@ -62,31 +62,28 @@ IDD_GRAPHCFG DIALOG DISCARDABLE 0, 0, 2
STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Shell Dlg"
BEGIN
- GROUPBOX " Window settings ",IDC_STATIC,8,25,244,180
-
- CONTROL "Allow DirectX apps to stop the mouse leaving their window",IDC_DX_MOUSE_GRAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,35,230,8
- CONTROL "Enable desktop double buffering",IDC_DOUBLE_BUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,45,230,8
- LTEXT "If windows are managed by your window manager, then they will have the standard borders, they will respect your virtual desktop and appear in your window list. \n\nIf the windows are unmanaged, they will be disconnected from your window manager. This will mean the windows do not integrate as closely with your desktop, but the emulation will be more accurate so it can help some programs to work better.",
- IDC_STATIC,15,58,228,80
- CONTROL "Allow the window manager to control the windows",IDC_ENABLE_MANAGED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,132,230,8
+ GROUPBOX " Window settings ",IDC_STATIC,8,4,244,130
- /* FIXME: the wording of this explanation could be a lot better */
- LTEXT "You can choose to emulate a windows desktop, where all the windows are confined to one 'virtual screen', or you can have the windows placed on your standard desktop.",
- IDC_STATIC,15,146,228,28
- LTEXT "Desktop size:",IDC_DESKTOP_SIZE,15,188,44,8,WS_DISABLED
- LTEXT "X",IDC_DESKTOP_BY,108,188,8,8,WS_DISABLED
+ CONTROL "Allow DirectX apps to stop the mouse leaving their window",IDC_DX_MOUSE_GRAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,20,230,8
+ CONTROL "Enable desktop double buffering",IDC_DOUBLE_BUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,30,230,8
+ CONTROL "Allow the window manager to control the windows",IDC_ENABLE_MANAGED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,40,230,8
+
+ LTEXT "Desktop size:",IDC_DESKTOP_SIZE,26,63,44,8,WS_DISABLED
+ LTEXT "X",IDC_DESKTOP_BY,112,63,8,8,WS_DISABLED
CONTROL "Emulate a virtual desktop",IDC_ENABLE_DESKTOP,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,15,173,230,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,50,230,10
- EDITTEXT IDC_DESKTOP_WIDTH,64,188,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
- EDITTEXT IDC_DESKTOP_HEIGHT,117,188,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
-
- GROUPBOX " Direct3D ",IDC_STATIC,8,210,244,50
+ EDITTEXT IDC_DESKTOP_WIDTH,70,61,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
+ EDITTEXT IDC_DESKTOP_HEIGHT,120,61,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
- LTEXT "Vertex Shader Support: ",IDC_STATIC,15,220,80,30
- COMBOBOX IDC_D3D_VSHADER_MODE,100,218,150,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ GROUPBOX " DirectX ",IDC_STATIC,8,140,244,125
- CONTROL "Allow Pixel Shader (if supported by hardware)",IDC_D3D_PSHADER_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,237,230,10
+ LTEXT "Vertex Shader Support: ",IDC_STATIC,15,152,80,30
+ COMBOBOX IDC_D3D_VSHADER_MODE,100,150,150,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Pixel Shader Support: ",IDC_STATIC,15,172,80,30
+ COMBOBOX IDC_D3D_PSHADER_MODE,100,170,150,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Graphics Card Memory: ",IDC_STATIC,15,192,80,30
+ COMBOBOX IDC_D3D_TEXTURE_MEMORY,100,190,80,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_DLLCFG DIALOG DISCARDABLE 0, 0, 260, 250
@@ -214,9 +211,9 @@ IDD_GRAPHCFG DIALOG DISCARDABLE 0, 0, 2
STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Shell Dlg"
BEGIN
- GROUPBOX " Window settings ",IDC_STATIC,8,4,244,110
+ GROUPBOX " Window settings ",IDC_STATIC,8,4,244,40
- CONTROL "Allow DirectX apps to stop the mouse leaving their window",IDC_DX_MOUSE_GRAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,14,230,8
+ CONTROL "Allow DirectX apps to stop the mouse leaving their window",IDC_DX_MOUSE_GRAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,6,230,8
CONTROL "Enable desktop double buffering",IDC_DOUBLE_BUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,24,230,8
CONTROL "Allow the window manager to manage created windows",IDC_ENABLE_MANAGED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,34,230,8
@@ -231,7 +228,7 @@ BEGIN
EDITTEXT IDC_DESKTOP_WIDTH,64,94,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
EDITTEXT IDC_DESKTOP_HEIGHT,117,94,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
- GROUPBOX " Direct3D ",IDC_STATIC,8,119,244,120
+ GROUPBOX " Direct3D ",IDC_STATIC,8,93,244,150
LTEXT "Vertex Shader Support: ",IDC_STATIC,15,129,80,30
COMBOBOX IDC_D3D_VSHADER_MODE,100,127,145,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
Index: programs/winecfg/resource.h
===================================================================
RCS file: /home/wine/wine/programs/winecfg/resource.h,v
retrieving revision 1.37
diff -u -p -r1.37 resource.h
--- programs/winecfg/resource.h 2 Feb 2006 13:13:48 -0000 1.37
+++ programs/winecfg/resource.h 4 Feb 2006 22:21:04 -0000
@@ -125,7 +125,7 @@
#define IDC_DOUBLE_BUFFER 1104
#define IDC_D3D_VSHADER_MODE 1105
#define IDC_D3D_PSHADER_MODE 1106
-
+#define IDC_D3D_TEXTURE_MEMORY 1107
/* applications tab */
#define IDC_APP_LISTVIEW 1200
#define IDC_APP_ADDAPP 1201
Index: programs/winecfg/x11drvdlg.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/x11drvdlg.c,v
retrieving revision 1.31
diff -u -p -r1.31 x11drvdlg.c
--- programs/winecfg/x11drvdlg.c 2 Feb 2006 13:13:48 -0000 1.31
+++ programs/winecfg/x11drvdlg.c 4 Feb 2006 22:21:04 -0000
@@ -1,26 +1,3 @@
-/*
- * Graphics configuration code
- *
- * Copyright 2003 Mark Westcott
- * Copyright 2003-2004 Mike Hearn
- * Copyright 2005 Raphael Junqueira
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
#define WIN32_LEAN_AND_MEAN
#include <stdarg.h>
@@ -45,6 +22,29 @@ static const char* D3D_VS_Modes[] = {
NULL
};
+static const char* D3D_PS_Modes[] = {
+ "default",
+ "none",
+ "1.1",
+ "1.2",
+ "1.3",
+ "1.4",
+ "2.0",
+ NULL
+};
+
+static const char* D3D_Texture_Memory_Modes[] = {
+ "default",
+ "16 Mb",
+ "32 Mb",
+ "64 Mb",
+ "128 Mb",
+ "256 Mb",
+ "512 Mb",
+ "1024 Mb",
+ NULL
+};
+
int updating_ui;
@@ -76,7 +76,7 @@ static void update_gui_for_desktop_mode(
++bufindex;
SetWindowText(GetDlgItem(dialog, IDC_DESKTOP_WIDTH), buf);
SetWindowText(GetDlgItem(dialog, IDC_DESKTOP_HEIGHT), bufindex);
- } else {
+ } else {
WINE_TRACE("Desktop registry entry is malformed");
SetWindowText(GetDlgItem(dialog, IDC_DESKTOP_WIDTH), "640");
SetWindowText(GetDlgItem(dialog, IDC_DESKTOP_HEIGHT), "480");
@@ -148,12 +148,46 @@ static void init_dialog(HWND dialog)
WINE_ERR("Invalid Direct3D VertexShader Mode read from registry (%s)\n", buf);
}
HeapFree(GetProcessHeap(), 0, buf);
-
+
+ SendDlgItemMessage(dialog, IDC_D3D_PSHADER_MODE, CB_RESETCONTENT, 0, 0);
+ for (it = 0; NULL != D3D_PS_Modes[it]; ++it) {
+ SendDlgItemMessage(dialog, IDC_D3D_PSHADER_MODE, CB_ADDSTRING, 0, (LPARAM) D3D_PS_Modes[it]);
+ }
buf = get_reg_key(config_key, keypath("Direct3D"), "PixelShaderMode", "disabled");
- if (!strcmp(buf, "enabled"))
- CheckDlgButton(dialog, IDC_D3D_PSHADER_MODE, BST_CHECKED);
- else
- CheckDlgButton(dialog, IDC_D3D_PSHADER_MODE, BST_UNCHECKED);
+ for (it = 0; NULL != D3D_PS_Modes[it]; ++it) {
+ if (strcmp(buf, D3D_PS_Modes[it]) == 0) {
+ SendDlgItemMessage(dialog, IDC_D3D_PSHADER_MODE, CB_SETCURSEL, it, 0);
+ break ;
+ }
+ }
+ if (NULL == D3D_PS_Modes[it]) {
+ /* Check to see if we have an old setting in the registry from when the pixel shaders
+ * option was a checkbox. */
+ if (strcmp(buf, "enabled") == 0) {
+ WINE_TRACE("Pixel Shader Registry Entry is using the old format. Setting to new default\n");
+ set_reg_key(config_key, keypath("Direct3D"), "PixelShaderMode", "default");
+ } else {
+ WINE_ERR("Invalid Direct3D PixelShader Mode read from registry (%s)\n", buf);
+ }
+ }
+ HeapFree(GetProcessHeap(), 0, buf);
+
+
+
+ SendDlgItemMessage(dialog, IDC_D3D_TEXTURE_MEMORY, CB_RESETCONTENT, 0 ,0);
+ for (it = 0; NULL != D3D_Texture_Memory_Modes[it]; ++it) {
+ SendDlgItemMessage(dialog, IDC_D3D_TEXTURE_MEMORY, CB_ADDSTRING, 0, (LPARAM) D3D_Texture_Memory_Modes[it]);
+ }
+ buf = get_reg_key(config_key, keypath("Direct3D"), "TextureMemory", "64 Mb");
+ for (it = 0; NULL != D3D_Texture_Memory_Modes[it]; ++it) {
+ if (strcmp(buf, D3D_Texture_Memory_Modes[it]) == 0) {
+ SendDlgItemMessage(dialog, IDC_D3D_TEXTURE_MEMORY, CB_SETCURSEL, it, 0);
+ break ;
+ }
+ }
+ if (NULL == D3D_Texture_Memory_Modes) {
+ WINE_ERR("Invalid Direct3D Texture Memory Value read from registry (%s)\n", buf);
+ }
HeapFree(GetProcessHeap(), 0, buf);
updating_ui = FALSE;
@@ -230,13 +264,15 @@ static void on_d3d_vshader_mode_changed(
set_reg_key(config_key, keypath("Direct3D"), "VertexShaderMode", D3D_VS_Modes[selected_mode]);
}
-static void on_d3d_pshader_mode_clicked(HWND dialog) {
- if (IsDlgButtonChecked(dialog, IDC_D3D_PSHADER_MODE) == BST_CHECKED)
- set_reg_key(config_key, keypath("Direct3D"), "PixelShaderMode", "enabled");
- else
- set_reg_key(config_key, keypath("Direct3D"), "PixelShaderMode", "disabled");
+static void on_d3d_pshader_mode_changed(HWND dialog) {
+ int selected_mode = SendDlgItemMessage(dialog, IDC_D3D_PSHADER_MODE, CB_GETCURSEL, 0 ,0);
+ set_reg_key(config_key, keypath("Direct3D"), "PixelShaderMode", D3D_PS_Modes[selected_mode]);
}
+static void on_d3d_texture_memory_changed(HWND dialog) {
+ int selected_mode = SendDlgItemMessage(dialog, IDC_D3D_TEXTURE_MEMORY, CB_GETCURSEL, 0 ,0);
+ set_reg_key(config_key, keypath("Direct3D"), "TextureMemory", D3D_Texture_Memory_Modes[selected_mode]);
+}
INT_PTR CALLBACK
GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -265,7 +301,6 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARA
case IDC_ENABLE_MANAGED: on_enable_managed_clicked(hDlg); break;
case IDC_DX_MOUSE_GRAB: on_dx_mouse_grab_clicked(hDlg); break;
case IDC_DOUBLE_BUFFER: on_double_buffer_clicked(hDlg); break;
- case IDC_D3D_PSHADER_MODE: on_d3d_pshader_mode_clicked(hDlg); break;
}
break;
}
@@ -273,6 +308,8 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARA
SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
switch (LOWORD(wParam)) {
case IDC_D3D_VSHADER_MODE: on_d3d_vshader_mode_changed(hDlg); break;
+ case IDC_D3D_PSHADER_MODE: on_d3d_pshader_mode_changed(hDlg); break;
+ case IDC_D3D_TEXTURE_MEMORY: on_d3d_texture_memory_changed(hDlg); break;
}
break;
}