DXGL r757 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r756‎ | r757 | r758 >
Date:20:28, 5 November 2017
Author:admin
Status:new
Tags:
Comment:
Adjust arrangement of controls in DXGL Config dialog.
Add single buffer mode to the configuration GUI.
Modified paths:
  • /dxgl-example.ini (modified) (history)
  • /dxglcfg2/dxglcfg2.c (modified) (history)
  • /dxglcfg2/dxglcfg2.rc (modified) (history)
  • /dxglcfg2/resource.h (modified) (history)

Diff [purge]

Index: dxgl-example.ini
@@ -323,6 +323,31 @@
324324 ; Default is 0
325325 D3DAspect = 0
326326
 327+; LowColorRendering - Integer
 328+; Selects whether to increase the color depth when rendering to a
 329+; low color Direct3D surface.
 330+; The following values are valid:
 331+; 0 - Uses the same color depth as requested by the application.
 332+; 1 - Uses a 32-bit texture format. Increases the quality of the game but
 333+; will be downsampled if the surface is accessed directly after rendering.
 334+; Default is 0
 335+LowColorRendering = 0
 336+
 337+; EnableDithering - Integer
 338+; Determines when dithering is enabled for Direct3D rendering.
 339+; Note that since modern graphics cards do not natively support dithering it
 340+; is implemented via a pixel shader, and may potentially result in reduced
 341+; performance.
 342+; The following values are valid:
 343+; 0 - Enables dithering when requested by the application except when in a
 344+; true-color mode.
 345+; 1 - Disables dithering at all times.
 346+; 2 - Always enables dithering for low color modes.
 347+; 3 - Enables dithering per application, for all modes.
 348+; 4 - Always enables dithering, for all modes.
 349+; Default is 0
 350+EnableDithering = 0
 351+
327352 [advanced]
328353 ; VSync - Integer
329354 ; Determines vertical retrace behavior.
Index: dxglcfg2/dxglcfg2.c
@@ -1088,6 +1088,11 @@
10891089 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
10901090 *dirty = TRUE;
10911091 break;
 1092+ case IDC_SINGLEBUFFER:
 1093+ cfg->SingleBufferDevice = GetCheck(hWnd, IDC_SINGLEBUFFER, &cfgmask->SingleBufferDevice);
 1094+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 1095+ *dirty = TRUE;
 1096+ break;
10921097 }
10931098 }
10941099 default:
@@ -1403,6 +1408,9 @@
14041409 // colormode
14051410 if (cfg->colormode) SendDlgItemMessage(hTabs[0], IDC_COLOR, BM_SETCHECK, BST_CHECKED, 0);
14061411 else SendDlgItemMessage(hTabs[0], IDC_COLOR, BM_SETCHECK, BST_UNCHECKED, 0);
 1412+ // single buffer
 1413+ if(cfg->SingleBufferDevice) SendDlgItemMessage(hTabs[0], IDC_SINGLEBUFFER, BM_SETCHECK, BST_CHECKED, 0);
 1414+ else SendDlgItemMessage(hTabs[0], IDC_SINGLEBUFFER, BM_SETCHECK, BST_UNCHECKED, 0);
14071415 // first scaling filter
14081416 _tcscpy(buffer, _T("Nearest"));
14091417 SendDlgItemMessage(hTabs[1], IDC_POSTSCALE, CB_ADDSTRING, 0, (LPARAM)buffer);
@@ -1923,6 +1931,7 @@
19241932 SendDlgItemMessage(hTabs[0], IDC_VSYNC, CB_ADDSTRING, 0, (LPARAM)strdefault);
19251933 SendDlgItemMessage(hTabs[0], IDC_FULLMODE, CB_ADDSTRING, 0, (LPARAM)strdefault);
19261934 SendDlgItemMessage(hTabs[0], IDC_COLOR, BM_SETSTYLE, BS_AUTO3STATE, (LPARAM)TRUE);
 1935+ SendDlgItemMessage(hTabs[0], IDC_SINGLEBUFFER, BM_SETSTYLE, BS_AUTO3STATE, (LPARAM)TRUE);
19271936 SendDlgItemMessage(hTabs[1], IDC_POSTSCALE, CB_ADDSTRING, 0, (LPARAM)strdefault);
19281937 SendDlgItemMessage(hTabs[1], IDC_POSTSCALESIZE, CB_ADDSTRING, 0, (LPARAM)strdefault);
19291938 SendDlgItemMessage(hTabs[1], IDC_PRIMARYSCALE, CB_ADDSTRING, 0, (LPARAM)strdefault);
@@ -1958,6 +1967,7 @@
19591968 SendDlgItemMessage(hTabs[0], IDC_FULLMODE, CB_DELETESTRING,
19601969 SendDlgItemMessage(hTabs[0], IDC_FULLMODE, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
19611970 SendDlgItemMessage(hTabs[0], IDC_COLOR, BM_SETSTYLE, BS_AUTOCHECKBOX, (LPARAM)TRUE);
 1971+ SendDlgItemMessage(hTabs[0], IDC_SINGLEBUFFER, BM_SETSTYLE, BS_AUTOCHECKBOX, (LPARAM)TRUE);
19621972 SendDlgItemMessage(hTabs[1], IDC_POSTSCALE, CB_DELETESTRING,
19631973 SendDlgItemMessage(hTabs[1], IDC_POSTSCALE, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
19641974 SendDlgItemMessage(hTabs[1], IDC_POSTSCALESIZE, CB_DELETESTRING,
@@ -1991,6 +2001,7 @@
19922002 SetCombo(hTabs[0], IDC_VSYNC, cfg->vsync, cfgmask->vsync, tristate);
19932003 SetCombo(hTabs[0], IDC_FULLMODE, cfg->fullmode, cfgmask->fullmode, tristate);
19942004 SetCheck(hTabs[0], IDC_COLOR, cfg->colormode, cfgmask->colormode, tristate);
 2005+ SetCheck(hTabs[0], IDC_SINGLEBUFFER, cfg->SingleBufferDevice, cfgmask->SingleBufferDevice, tristate);
19952006 SetCombo(hTabs[1], IDC_POSTSCALE, cfg->postfilter, cfgmask->postfilter, tristate);
19962007 SetPostScaleCombo(hTabs[1], IDC_POSTSCALESIZE, cfg->postsizex, cfg->postsizey,
19972008 cfgmask->postsizex , cfgmask->postsizey, tristate);
Index: dxglcfg2/dxglcfg2.rc
@@ -35,14 +35,14 @@
3636 CAPTION "DXGL Config (Experimental)"
3737 FONT 8, "Ms Shell Dlg 2"
3838 {
39 - LTEXT "Application profile", IDC_STATIC, 7, 7, 58, 8, SS_LEFT, WS_EX_LEFT
40 - COMBOBOX IDC_APPS, 7, 17, 287, 195, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | 0x00000400, WS_EX_LEFT
41 - CONTROL "", IDC_TABS, WC_TABCONTROL, 0, 7, 35, 344, 185, WS_EX_LEFT
42 - PUSHBUTTON "A&dd...", IDC_ADD, 7, 223, 50, 14, 0, WS_EX_LEFT
43 - PUSHBUTTON "&Remove", IDC_REMOVE, 59, 223, 50, 14, WS_DISABLED, WS_EX_LEFT
44 - DEFPUSHBUTTON "OK", IDOK, 195, 223, 50, 14, 0, WS_EX_LEFT
45 - PUSHBUTTON "Cancel", IDCANCEL, 247, 223, 50, 14, 0, WS_EX_LEFT
46 - PUSHBUTTON "&Apply", IDC_APPLY, 299, 223, 50, 14, WS_DISABLED, WS_EX_LEFT
 39+ LTEXT "Application profile", IDC_STATIC, 7, 7, 58, 8, SS_LEFT, WS_EX_LEFT
 40+ COMBOBOX IDC_APPS, 7, 17, 287, 195, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | 0x00000400, WS_EX_LEFT
 41+ CONTROL "", IDC_TABS, WC_TABCONTROL, 0, 7, 35, 344, 185, WS_EX_LEFT
 42+ PUSHBUTTON "A&dd...", IDC_ADD, 7, 223, 50, 14, 0, WS_EX_LEFT
 43+ PUSHBUTTON "&Remove", IDC_REMOVE, 59, 223, 50, 14, WS_DISABLED, WS_EX_LEFT
 44+ DEFPUSHBUTTON "OK", IDOK, 195, 223, 50, 14, 0, WS_EX_LEFT
 45+ PUSHBUTTON "Cancel", IDCANCEL, 247, 223, 50, 14, 0, WS_EX_LEFT
 46+ PUSHBUTTON "&Apply", IDC_APPLY, 299, 223, 50, 14, WS_DISABLED, WS_EX_LEFT
4747 }
4848
4949
@@ -60,23 +60,24 @@
6161 COMBOBOX IDC_SCALE, 7, 43, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
6262 LTEXT "Additional display modes", IDC_STATIC, 114, 32, 78, 8, SS_LEFT, WS_EX_LEFT
6363 COMBOBOX IDC_EXTRAMODES, 114, 43, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED, WS_EX_LEFT
64 - LTEXT "Screen aspect ratio", IDC_STATIC, 7, 61, 63, 8, SS_LEFT, WS_EX_LEFT
65 - COMBOBOX IDC_ASPECT, 7, 71, 102, 30, CBS_DROPDOWN | CBS_HASSTRINGS, WS_EX_LEFT
66 - LTEXT "Sort video modes", IDC_STATIC, 114, 61, 56, 8, SS_LEFT, WS_EX_LEFT
67 - COMBOBOX IDC_SORTMODES, 114, 71, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
68 - LTEXT "DPI scaling mode", IDC_STATIC, 7, 86, 55, 8, SS_LEFT, WS_EX_LEFT
69 - COMBOBOX IDC_DPISCALE, 7, 96, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
70 - LTEXT "Vertical sync", IDC_STATIC, 114, 86, 41, 8, SS_LEFT, WS_EX_LEFT
71 - COMBOBOX IDC_VSYNC, 114, 96, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
72 - LTEXT "Fullscreen window mode", IDC_STATIC, 7, 111, 78, 9, SS_LEFT, WS_EX_LEFT
73 - COMBOBOX IDC_FULLMODE, 8, 122, 101, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
74 - LTEXT "Fixed scaling", IDC_FIXEDSCALELABEL, 113, 112, 47, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
75 - LTEXT "X", IDC_FIXEDSCALELABELX, 113, 125, 8, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
76 - EDITTEXT IDC_FIXEDSCALEX, 121, 122, 24, 14, ES_AUTOHSCROLL, WS_EX_LEFT
77 - LTEXT "Y", IDC_FIXEDSCALELABELY, 150, 125, 8, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
78 - EDITTEXT IDC_FIXEDSCALEY, 158, 122, 24, 14, ES_AUTOHSCROLL, WS_EX_LEFT
79 - AUTOCHECKBOX "Square", IDC_FIXEDSCALESQUARE, 187, 122, 29, 14, BS_PUSHLIKE, WS_EX_LEFT
80 - AUTOCHECKBOX "Change display color depth", IDC_COLOR, 9, 137, 100, 10, 0, WS_EX_LEFT
 64+ LTEXT "Screen aspect ratio", IDC_STATIC, 7, 58, 63, 8, SS_LEFT, WS_EX_LEFT
 65+ COMBOBOX IDC_ASPECT, 7, 68, 102, 30, CBS_DROPDOWN | CBS_HASSTRINGS, WS_EX_LEFT
 66+ LTEXT "Sort video modes", IDC_STATIC, 114, 58, 56, 8, SS_LEFT, WS_EX_LEFT
 67+ COMBOBOX IDC_SORTMODES, 114, 68, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 68+ LTEXT "DPI scaling mode", IDC_STATIC, 7, 83, 55, 8, SS_LEFT, WS_EX_LEFT
 69+ COMBOBOX IDC_DPISCALE, 7, 93, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 70+ LTEXT "Vertical sync", IDC_STATIC, 114, 83, 41, 8, SS_LEFT, WS_EX_LEFT
 71+ COMBOBOX IDC_VSYNC, 114, 93, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 72+ LTEXT "Fullscreen window mode", IDC_STATIC, 7, 108, 78, 9, SS_LEFT, WS_EX_LEFT
 73+ COMBOBOX IDC_FULLMODE, 7, 119, 101, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 74+ LTEXT "Fixed scaling", IDC_FIXEDSCALELABEL, 114, 108, 47, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
 75+ LTEXT "X", IDC_FIXEDSCALELABELX, 114, 122, 8, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
 76+ EDITTEXT IDC_FIXEDSCALEX, 122, 119, 24, 14, ES_AUTOHSCROLL, WS_EX_LEFT
 77+ LTEXT "Y", IDC_FIXEDSCALELABELY, 151, 122, 8, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
 78+ EDITTEXT IDC_FIXEDSCALEY, 159, 119, 24, 14, ES_AUTOHSCROLL, WS_EX_LEFT
 79+ AUTOCHECKBOX "Square", IDC_FIXEDSCALESQUARE, 188, 118, 29, 14, BS_PUSHLIKE, WS_EX_LEFT
 80+ AUTOCHECKBOX "Change display color depth", IDC_COLOR, 7, 134, 100, 10, 0, WS_EX_LEFT
 81+ AUTOCHECKBOX "Single buffered display", IDC_SINGLEBUFFER, 114, 135, 87, 8, 0, WS_EX_LEFT
8182 }
8283
8384
@@ -91,9 +92,13 @@
9293 LTEXT "Anisotropic filtering", IDC_STATIC, 114, 7, 62, 8, SS_LEFT, WS_EX_LEFT
9394 COMBOBOX IDC_ANISO, 114, 17, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
9495 LTEXT "Antialiasing (MSAA)", IDC_STATIC, 7, 32, 63, 8, SS_LEFT, WS_EX_LEFT
95 - COMBOBOX IDC_MSAA, 7, 42, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 96+ COMBOBOX IDC_MSAA, 7, 43, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
9697 LTEXT "Renderer aspect ratio", IDC_STATIC, 114, 32, 71, 8, SS_LEFT, WS_EX_LEFT
97 - COMBOBOX IDC_ASPECT3D, 114, 42, 102, 14, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 98+ COMBOBOX IDC_ASPECT3D, 114, 43, 102, 14, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 99+ LTEXT "Low color rendering", 0, 7, 58, 63, 9, SS_LEFT, WS_EX_LEFT
 100+ COMBOBOX IDC_LOWCOLORRENDER, 7, 68, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 101+ LTEXT "Enable dithering", 0, 114, 58, 52, 9, SS_LEFT, WS_EX_LEFT
 102+ COMBOBOX IDC_DITHERING, 114, 68, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
98103 }
99104
100105
@@ -109,10 +114,8 @@
110115 COMBOBOX IDC_TEXUPLOAD, 114, 17, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
111116 LTEXT "Display name", 0, 7, 35, 43, 9, SS_LEFT, WS_EX_LEFT
112117 EDITTEXT IDC_DISPLAYNAME, 7, 46, 209, 14, ES_AUTOHSCROLL, WS_EX_LEFT
113 - LTEXT "Low color rendering", 0, 7, 65, 63, 9, SS_LEFT, WS_EX_LEFT
114 - COMBOBOX IDC_LOWCOLORRENDER, 7, 76, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
115118 LTEXT "Installation path", IDC_PATHLABEL, 7, 94, 50, 9, SS_LEFT, WS_EX_LEFT
116 - EDITTEXT IDC_PROFILEPATH, 7, 105, 209, 14, NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY, WS_EX_LEFT
 119+ EDITTEXT IDC_PROFILEPATH, 7, 105, 209, 14, NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY, WS_EX_LEFT
117120 PUSHBUTTON "Write INI file...", IDC_WRITEINI, 203, 151, 73, 14, 0, WS_EX_LEFT
118121 }
119122
Index: dxglcfg2/resource.h
@@ -62,6 +62,7 @@
6363 #define IDC_FIXEDSCALEY 2014
6464 #define IDC_FIXEDSCALESQUARE 2015
6565 #define IDC_COLOR 2016
 66+#define IDC_SINGLEBUFFER 2017
6667
6768 // Controls - Effects Tab
6869 #define IDC_POSTSCALE 2101
@@ -81,6 +82,7 @@
8283 #define IDC_ANISO 2202
8384 #define IDC_MSAA 2203
8485 #define IDC_ASPECT3D 2204
 86+#define IDC_DITHERING 2205
8587
8688 // Controls - Advanced Tab
8789 #define IDC_TEXTUREFORMAT 2301
@@ -93,3 +95,4 @@
9496
9597 // Controls - Debug Tab
9698 #define IDC_DEBUGLIST 2401
 99+