diff -rupN orig/programs/winecfg/En.rc new/programs/winecfg/En.rc
--- orig/programs/winecfg/En.rc	2009-03-27 19:31:22.000000000 +0100
+++ new/programs/winecfg/En.rc	2009-04-09 11:06:24.000000000 +0200
@@ -78,16 +78,39 @@ BEGIN
     EDITTEXT    IDC_DESKTOP_WIDTH,64,68,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
     EDITTEXT    IDC_DESKTOP_HEIGHT,117,68,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
 
-    GROUPBOX    " Direct3D ",IDC_STATIC,8,95,244,49
-    LTEXT       "&Vertex Shader Support: ",IDC_STATIC,15,110,80,32
-    COMBOBOX    IDC_D3D_VSHADER_MODE,100,108,145,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-    CONTROL     "Allow &Pixel Shader (if supported by hardware)",IDC_D3D_PSHADER_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,126,230,10
-
-    GROUPBOX    " Screen &Resolution ",IDC_STATIC,8,151,244,93
-    CONTROL     "", IDC_RES_TRACKBAR, "msctls_trackbar32",WS_TABSTOP,12,161,187,15
-    EDITTEXT    IDC_RES_DPIEDIT,204,161,23,13,ES_NUMBER|WS_TABSTOP
-    LTEXT       "dpi",IDC_STATIC,235,163,10,8
-    LTEXT       "This is a sample text using 10 point Tahoma",IDC_RES_FONT_PREVIEW,15,181,230,55
+    GROUPBOX    " Direct3D ",IDC_STATIC,8,103,244,76
+    LTEXT       "Support du Vertex Shader: ",IDC_STATIC,15,118,90,32
+    COMBOBOX    IDC_D3D_VSHADER_MODE,110,116,135,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL     "Permettre le Pixel Shader (si supporté par le matériel)",IDC_D3D_PSHADER_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,134,230,10
+    CONTROL     "Use OpenGL Shading Language (&GLSL)",IDC_D3D_GLSL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,146,140,10
+    CONTROL     "Allow Multisampling",IDC_D3D_MULTISAMPLING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,157,85,10
+    PUSHBUTTON  "Advanced settings",IDC_D3D_ADVANCED,165,157,80,14
+
+    GROUPBOX    " Screen &Resolution ",IDC_STATIC,8,186,244,75
+    CONTROL     "", IDC_RES_TRACKBAR, "msctls_trackbar32",WS_TABSTOP,12,196,187,15
+    EDITTEXT    IDC_RES_DPIEDIT,204,196,23,13,ES_NUMBER|WS_TABSTOP
+    LTEXT       "ppp",IDC_STATIC,233,198,12,8
+    LTEXT       "This is a sample text using 10 point Tahoma",IDC_RES_FONT_PREVIEW,15,216,230,25
+END
+
+IDD_ADVANCEDGRAPH DIALOG DISCARDABLE  0, 0, 260, 122
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Edit Settings"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    GROUPBOX        " Advanced Direct3D Settings ", IDC_STATIC, 8, 4, 244, 96
+    LTEXT           "Only change these settings if you know what you're doing. Changing these values may result in unexpected behaviors and unstability.", IDC_STATIC, 16, 14, 224, 26
+    LTEXT           "Video Memory (MB): ", IDC_STATIC, 16, 40, 110, 13
+    EDITTEXT        IDC_D3D_VIDEO_MEMORY, 126, 40, 40, 13, ES_NUMBER | WS_TABSTOP
+    LTEXT           "Offscreen Rendering Mode: ", IDC_STATIC, 16, 53, 110, 13
+    COMBOBOX        IDC_D3D_RENDERING_MODE, 126, 53, 110, 70, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Render Target Lock Mode: ", IDC_STATIC, 16, 66, 110, 13
+    COMBOBOX        IDC_D3D_TARGETLOCK, 126, 66, 110, 70, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "DirectDraw Renderer: ", IDC_STATIC, 16, 79, 110, 13
+    COMBOBOX        IDC_D3D_DDRAW_RENDERER, 126, 79, 110, 70, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    DEFPUSHBUTTON   "OK", IDOK, 99, 104, 45, 14, WS_GROUP
+    PUSHBUTTON      "Cancel", IDCANCEL, 148, 104, 45, 14, WS_GROUP
+    PUSHBUTTON      "Reset settings", IDC_D3D_ADVANCED_RESET, 197, 104, 55, 14, WS_GROUP
 END
 
 IDD_DLLCFG DIALOG DISCARDABLE  0, 0, 260, 250
@@ -247,6 +270,17 @@ STRINGTABLE DISCARDABLE
 BEGIN
     IDS_SHADER_MODE_HARDWARE    "Hardware"
     IDS_SHADER_MODE_NONE        "None"
+    IDS_RENDERING_BACKBUFFER    "BackBuffer (default)"
+    IDS_RENDERING_PBUFFER       "PixelBuffer"
+    IDS_RENDERING_FBO           "FrameBuffer Object (faster)"
+    IDS_TLOCK_AUTO              "Auto (default)"
+    IDS_TLOCK_DISABLED          "Disabled"
+    IDS_TLOCK_READDRAW          "ReadDraw"
+    IDS_TLOCK_READTEX           "ReadTex"
+    IDS_TLOCK_TEXDRAW           "TexDraw"
+    IDS_TLOCK_TEXTEX            "TexTex"
+    IDS_DDRAW_MODE_GDI          "GDI (default)"
+    IDS_DDRAW_MODE_OPENGL       "OpenGL (faster)"
 END
 
 STRINGTABLE DISCARDABLE
diff -rupN orig/programs/winecfg/resource.h new/programs/winecfg/resource.h
--- orig/programs/winecfg/resource.h	2009-03-27 19:31:22.000000000 +0100
+++ new/programs/winecfg/resource.h	2009-04-09 11:08:59.000000000 +0200
@@ -151,8 +151,28 @@
 #define IDC_DOUBLE_BUFFER               1104
 #define IDC_D3D_VSHADER_MODE            1105
 #define IDC_D3D_PSHADER_MODE            1106
+#define IDC_D3D_MULTISAMPLING           8434
+#define IDC_D3D_GLSL                    8435
 #define IDS_SHADER_MODE_HARDWARE        8100
 #define IDS_SHADER_MODE_NONE            8101
+#define IDC_D3D_VIDEO_MEMORY            8436
+#define IDC_D3D_RENDERING_MODE          8437
+#define IDC_D3D_TARGETLOCK              8438
+#define IDS_RENDERING_BACKBUFFER        8439
+#define IDS_RENDERING_PBUFFER           8440
+#define IDS_RENDERING_FBO               8441
+#define IDS_TLOCK_AUTO                  8442
+#define IDS_TLOCK_DISABLED              8443
+#define IDS_TLOCK_READDRAW              8444
+#define IDS_TLOCK_READTEX               8445
+#define IDS_TLOCK_TEXDRAW               8446
+#define IDS_TLOCK_TEXTEX                8447
+#define IDC_D3D_DDRAW_RENDERER          8448
+#define IDS_DDRAW_MODE_OPENGL           8448
+#define IDS_DDRAW_MODE_GDI              8449
+#define IDC_D3D_ADVANCED                8450
+#define IDD_ADVANCEDGRAPH               8451
+#define IDC_D3D_ADVANCED_RESET          8452
 
 #define IDC_RES_TRACKBAR                1107
 #define IDC_RES_DPIEDIT                 1108
diff -rupN orig/programs/winecfg/x11drvdlg.c new/programs/winecfg/x11drvdlg.c
--- orig/programs/winecfg/x11drvdlg.c	2009-03-27 19:31:22.000000000 +0100
+++ new/programs/winecfg/x11drvdlg.c	2009-04-09 11:18:11.000000000 +0200
@@ -55,6 +55,41 @@ static const WCHAR x11_driverW[] = {'X',
 static const WCHAR default_resW[] = {'8','0','0','x','6','0','0',0};
 
 
+static struct RENDERING
+{
+  UINT renderStrID;
+  const char* configStr;
+} const D3D_OR_Modes[] = {
+  {IDS_RENDERING_BACKBUFFER,  "backbuffer"},
+  {IDS_RENDERING_PBUFFER,     "pbuffer"},
+  {IDS_RENDERING_FBO,         "fbo"},
+  {0, 0}
+};
+
+static struct TARGETLOCK
+{
+  UINT tlockStrID;
+  const char* prefStr;
+} const D3D_TL_Modes[] = {
+  {IDS_TLOCK_AUTO,        "auto"},
+  {IDS_TLOCK_DISABLED,    "disabled"},
+  {IDS_TLOCK_READDRAW,    "readdraw"},
+  {IDS_TLOCK_READTEX,     "readtex"},
+  {IDS_TLOCK_TEXDRAW,     "texdraw"},
+  {IDS_TLOCK_TEXTEX,      "textex"},
+  {0, 0}
+};
+
+static struct DDRAWRENDER
+{
+  UINT ddrawStrID;
+  const char* choiceStr;
+} const D3D_DD_Modes[] = {
+  {IDS_DDRAW_MODE_GDI,      "gdi"},
+  {IDS_DDRAW_MODE_OPENGL,   "opengl"},
+  {0, 0}
+};
+
 static struct SHADERMODE
 {
   UINT displayStrID;
@@ -181,6 +216,20 @@ static void init_dialog(HWND dialog)
       CheckDlgButton(dialog, IDC_D3D_PSHADER_MODE, BST_UNCHECKED);
     HeapFree(GetProcessHeap(), 0, buf);
 
+    buf = get_reg_key(config_key, keypath("Direct3D"), "Multisampling", "disabled");
+    if (!strcmp(buf, "enabled"))
+        CheckDlgButton(dialog, IDC_D3D_MULTISAMPLING, BST_CHECKED);
+    else
+        CheckDlgButton(dialog, IDC_D3D_MULTISAMPLING, BST_UNCHECKED);
+        HeapFree(GetProcessHeap(), 0, buf);
+
+    buf = get_reg_key(config_key, keypath("Direct3D"), "UseGLSL", "enabled");
+    if (!strcmp(buf, "enabled"))
+        CheckDlgButton(dialog, IDC_D3D_GLSL, BST_CHECKED);
+    else
+        CheckDlgButton(dialog, IDC_D3D_GLSL, BST_UNCHECKED);
+    HeapFree(GetProcessHeap(), 0, buf);
+
     updating_ui = FALSE;
 }
 
@@ -271,6 +320,21 @@ static void on_d3d_pshader_mode_clicked(
     else
         set_reg_key(config_key, keypath("Direct3D"), "PixelShaderMode", "disabled");
 }
+
+static void on_d3d_multisampling_clicked(HWND dialog) {
+    if (IsDlgButtonChecked(dialog, IDC_D3D_MULTISAMPLING) == BST_CHECKED)
+        set_reg_key(config_key, keypath("Direct3D"), "Multisampling", "enabled");
+    else
+        set_reg_key(config_key, keypath("Direct3D"), "Multisampling", "disabled");
+}
+
+static void on_d3d_glsl_clicked(HWND dialog) {
+    if (IsDlgButtonChecked(dialog, IDC_D3D_GLSL) == BST_CHECKED)
+        set_reg_key(config_key, keypath("Direct3D"), "UseGLSL", "enabled");
+    else
+        set_reg_key(config_key, keypath("Direct3D"), "UseGLSL", "disabled");
+}
+
 static INT read_logpixels_reg(void)
 {
     DWORD dwLogPixels;
@@ -375,6 +439,136 @@ static void update_font_preview(HWND hDl
     updating_ui = FALSE;
 }
 
+static void d3d_advanced_settings_save(HWND hDlg)
+{
+    char *memory;
+    if (updating_ui) return;
+
+    memory = get_text(hDlg, IDC_D3D_VIDEO_MEMORY);
+    set_reg_key(config_key, keypath("Direct3D"), "VideoMemorySize", memory);
+    HeapFree(GetProcessHeap(), 0, memory);
+
+    int selected_mode = selected_mode = SendDlgItemMessage(hDlg, IDC_D3D_RENDERING_MODE, CB_GETCURSEL, 0, 0);
+    set_reg_key(config_key, keypath("Direct3D"), "OffscreenRenderingMode", D3D_OR_Modes[selected_mode].configStr);
+
+    selected_mode = SendDlgItemMessage(hDlg, IDC_D3D_TARGETLOCK, CB_GETCURSEL, 0, 0);
+    set_reg_key(config_key, keypath("Direct3D"), "RenderTargetLockMode", D3D_TL_Modes[selected_mode].prefStr);
+
+    selected_mode = SendDlgItemMessage(hDlg, IDC_D3D_DDRAW_RENDERER, CB_GETCURSEL, 0, 0);
+    set_reg_key(config_key, keypath("Direct3D"), "DirectDrawRenderer", D3D_DD_Modes[selected_mode].choiceStr);
+}
+
+static void d3d_advanced_settings_reset(hDlg)
+{
+    SetDlgItemText(hDlg, IDC_D3D_VIDEO_MEMORY, "");
+
+    unsigned int it = SendMessage(IDC_D3D_RENDERING_MODE, CB_GETTOPINDEX, 0, 0);
+    SendDlgItemMessage(hDlg, IDC_D3D_RENDERING_MODE, CB_SETCURSEL, it, 0);
+
+    it = SendMessage(IDC_D3D_TARGETLOCK, CB_GETTOPINDEX, 0, 0);
+    SendDlgItemMessage(hDlg, IDC_D3D_TARGETLOCK, CB_SETCURSEL, it, 0);
+
+    it = SendMessage(IDC_D3D_DDRAW_RENDERER, CB_GETTOPINDEX, 0, 0);
+    SendDlgItemMessage(hDlg, IDC_D3D_DDRAW_RENDERER, CB_SETCURSEL, it, 0);
+}
+
+static INT_PTR CALLBACK d3d_advanced_dlgproc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    char* buf;
+    unsigned int it;
+
+    switch(uMsg) 
+    {
+    case WM_INITDIALOG:
+        buf = get_reg_key(config_key, keypath("Direct3D"), "VideoMemorySize", "");
+        SetWindowText(GetDlgItem(hDlg, IDC_D3D_VIDEO_MEMORY), buf);
+        HeapFree(GetProcessHeap(), 0, buf);
+
+        SendDlgItemMessage(hDlg, IDC_D3D_RENDERING_MODE, CB_RESETCONTENT, 0, 0);
+        for (it = 0; 0 != D3D_OR_Modes[it].renderStrID; ++it) {
+            SendDlgItemMessageW (hDlg, IDC_D3D_RENDERING_MODE, CB_ADDSTRING, 0, (LPARAM)load_string (D3D_OR_Modes[it].renderStrID));
+        }
+        buf = get_reg_key(config_key, keypath("Direct3D"), "OffscreenRenderingMode", "backbuffer");
+        for (it = 0; NULL != D3D_OR_Modes[it].configStr; ++it) {
+            if (strcmp(buf, D3D_OR_Modes[it].configStr) == 0) {
+                SendDlgItemMessage(hDlg, IDC_D3D_RENDERING_MODE, CB_SETCURSEL, it, 0);
+                break ;
+            }
+        }
+        if (D3D_OR_Modes[it].configStr == NULL) {
+            WINE_ERR("Invalid Direct3D Offscreen Rendering Mode read from registry (%s)\n", buf);
+        }
+        HeapFree(GetProcessHeap(), 0, buf);
+
+        SendDlgItemMessage(hDlg, IDC_D3D_TARGETLOCK, CB_RESETCONTENT, 0, 0);
+        for (it = 0; 0 != D3D_TL_Modes[it].tlockStrID; ++it) {
+            SendDlgItemMessageW (hDlg, IDC_D3D_TARGETLOCK, CB_ADDSTRING, 0, (LPARAM)load_string (D3D_TL_Modes[it].tlockStrID));
+        }  
+        buf = get_reg_key(config_key, keypath("Direct3D"), "RenderTargetLockMode", "auto");
+        for (it = 0; NULL != D3D_TL_Modes[it].prefStr; ++it) {
+            if (strcmp(buf, D3D_TL_Modes[it].prefStr) == 0) {
+                SendDlgItemMessage(hDlg, IDC_D3D_TARGETLOCK, CB_SETCURSEL, it, 0);
+                break ;
+            }
+        }
+        if (D3D_TL_Modes[it].prefStr == NULL) {
+            WINE_ERR("Invalid Direct3D Render Target Lock Mode read from registry (%s)\n", buf);
+        }
+        HeapFree(GetProcessHeap(), 0, buf);
+
+        SendDlgItemMessage(hDlg, IDC_D3D_DDRAW_RENDERER, CB_RESETCONTENT, 0, 0);
+        for (it = 0; 0 != D3D_DD_Modes[it].ddrawStrID; ++it) {
+            SendDlgItemMessageW (hDlg, IDC_D3D_DDRAW_RENDERER, CB_ADDSTRING, 0, (LPARAM)load_string (D3D_DD_Modes[it].ddrawStrID));
+        }  
+        buf = get_reg_key(config_key, keypath("Direct3D"), "DirectDrawRenderer", "gdi");
+        for (it = 0; NULL != D3D_DD_Modes[it].choiceStr; ++it) {
+            if (strcmp(buf, D3D_DD_Modes[it].choiceStr) == 0) {
+                SendDlgItemMessage(hDlg, IDC_D3D_DDRAW_RENDERER, CB_SETCURSEL, it, 0);
+                break ;
+            }
+        }
+        if (D3D_DD_Modes[it].choiceStr == NULL) {
+            WINE_ERR("Invalid DirectDraw Renderer read from registry (%s)\n", buf);
+        }
+        HeapFree(GetProcessHeap(), 0, buf);
+
+        return TRUE;
+
+    case WM_COMMAND:
+        switch(HIWORD(wParam)) {
+            case BN_CLICKED: {
+                if (updating_ui) break;
+                    SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
+        	    switch (LOWORD(wParam)) {
+                        case IDOK:
+                            d3d_advanced_settings_save(hDlg);
+                            EndDialog(hDlg, wParam);
+			    return TRUE;
+			case IDCANCEL:
+			    EndDialog(hDlg, wParam);
+			    return TRUE;
+                        case IDC_D3D_ADVANCED_RESET:
+                            d3d_advanced_settings_reset(hDlg);
+                            return TRUE;
+		    }
+		    break;
+		}
+		    
+		default:
+		    break;
+	    }
+	    break;
+    }
+    return FALSE;
+}
+
+static void on_d3d_advanced(HWND hDlg)
+{
+    INT_PTR ret;
+
+    ret = DialogBoxParam(0, MAKEINTRESOURCE(IDD_ADVANCEDGRAPH), hDlg, d3d_advanced_dlgproc, 0);
+}
+
 INT_PTR CALLBACK
 GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
@@ -422,13 +616,16 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARA
                         case IDC_ENABLE_DECORATED: on_enable_decorated_clicked(hDlg); break;
 			case IDC_DX_MOUSE_GRAB:  on_dx_mouse_grab_clicked(hDlg); break;
 		        case IDC_D3D_PSHADER_MODE: on_d3d_pshader_mode_clicked(hDlg); break;
+		        case IDC_D3D_MULTISAMPLING: on_d3d_multisampling_clicked(hDlg); break;
+		        case IDC_D3D_GLSL: on_d3d_glsl_clicked(hDlg); break;
+                        case IDC_D3D_ADVANCED: on_d3d_advanced(hDlg); break;
 		    }
 		    break;
 		}
 		case CBN_SELCHANGE: {
 		    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_VSHADER_MODE: on_d3d_vshader_mode_changed(hDlg); break;
 		    }
 		    break;
 		}
@@ -438,7 +635,6 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARA
 	    }
 	    break;
 	
-	
 	case WM_NOTIFY:
 	    switch (((LPNMHDR)lParam)->code) {
 		case PSN_KILLACTIVE: {
