DXGL r923 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r922‎ | r923 | r924 >
Date:12:50, 11 May 2019
Author:admin
Status:new
Tags:
Comment:
Fix DXGL test for YUV surface types.
Update readme.
Modified paths:
  • /ReadMe.md (modified) (history)
  • /dxglcfg/surfacegen.cpp (modified) (history)

Diff [purge]

Index: ReadMe.md
@@ -1,5 +1,5 @@
22 # DXGL 0.5.16
3 -https://www.dxgl.org
 3+https://dxgl.org
44
55 ## Introduction
66 DXGL is a free replacement for the Windows ddraw.dll library, running on OpenGL. It is designed to overcome driver bugs, particularly in Windows Vista and newer operating systems. It also adds various enhancements to the graphics output such as display scaling and filtering options. DXGL supports the DirectX 7.0 graphics APIs, however it is currently under development and many programs are not yet compatible with DXGL.
@@ -10,7 +10,7 @@
1111 If you wish to migrate any old profiles generated after installing DXGL 0.5.9 or later, you will need to use Regedit to delete the "Configuration Version" registry value from the HKEY_CURRENT_USER\SOFTWARE\DXGL registry key to force the upgrade to be run again.
1212
1313 ## GitHub Notice
14 -If you downloaded the DXGL source code from GitHub, please note that when compiling DXGL, the version number will not indicate the revision number. This issue is also present when compiling from a zipped source code distribution from the www.dxgl.org, www.dxgl.info, or www.williamfeely.info website.
 14+If you downloaded the DXGL source code from GitHub, please note that when compiling DXGL, the version number will not indicate the revision number. This issue is also present when compiling from a zipped source code distribution from the dxgl.org, www.dxgl.info, or www.williamfeely.info website.
1515
1616 ## System Requirements
1717
@@ -23,12 +23,12 @@
2424 * Requires support for hardware accelerated non-power-of-two textures
2525 * OpenGL 3.2 or higher recommended.
2626 * The standard build requires a SSE2-capable processor; older processors require the legacy build.
27 -* For the standard build, Visual C++ 2017 x86 runtime, available at https://aka.ms/vs/15/release/vc_redist.x86.exe (note this link may track visitors) (will be installed if not present)
 27+* For the standard build, Visual C++ 2019 x86 runtime, available at https://aka.ms/vs/16/release/vc_redist.x86.exe (note this link may track visitors) (will be installed if not present)
2828 * For the legacy build, Visual C++ 2010 x86 runtime, available at https://www.microsoft.com/en-us/download/details.aspx?id=8328 (will be installed if not present)
2929
3030 ## Build Requirements
31 -* For the legacy build, Visual Studio 2010 or Visual C++ 2010 Express Edition.
32 -* For the standard build, Visual Studio 2017, Community or higher, Update 8.
 31+* For the legacy build, Visual Studio 2010 or Visual C++ 2010 Express Edition with Service Pack 1.
 32+* For the standard build, Visual Studio 2019, Community or higher.
3333 * The following components are optional. The build process will ask for these if they do not exist:
3434 * TortoiseSVN (to fill in revision on SVN builds)
3535 * HTML Help Workshop (to build help)
@@ -36,10 +36,10 @@
3737
3838 ## Build Instructions
3939 These instructions assume that you do not have any of the required software installed. If you already have any or all of this software installed and set up, skip those steps.
40 -* Install Visual Studio 2017 Community at https://visualstudio.microsoft.com/
 40+* Install Visual Studio 2019 Community at https://visualstudio.microsoft.com/
4141 * Install TortoiseSVN from https://tortoisesvn.net/
4242 * Install HTML Help Workshop from https://www.microsoft.com/en-us/download/details.aspx?id=21138
43 -* Install NSIS from http://nsis.sourceforge.net/Main_Page
 43+* Install NSIS from https://nsis.sourceforge.io/Main_Page
4444 * Open the dxgl.sln file, select your build configuration (Debug or Release) in the toolbar, and press F7 to build.
4545
4646 ## Progress
@@ -50,9 +50,11 @@
5151 * Fullscreen and windowed modes.
5252 * Basic Blt() functionality
5353 * 8-bit color emulated with GLSL shader
 54+* Packed-pixel YUV surfaces (currently only supported by Blt() to an RGB surface)
5455
5556 What partially works:
5657 * 3D graphics are only partially supported.
 58+* Overlay support is currently in development and not yet enabled.
5759
5860 What doesn't work:
5961 * Many functions are stubbed out and return an error
@@ -65,15 +67,17 @@
6668 ## SVN
6769
6870 SVN readonly access is available at:
69 -https://www.dxgl.org/svn/dxgl/
 71+https://dxgl.org/svn/dxgl/
 72+Alternate URL at:
 73+https://dxgl.org:8443/svn/dxgl/
7074
7175 There is a Mediawiki-based SVN log at:
72 -https://www.dxgl.info/wiki/Special:Code/DXGL
 76+https://dxgl.org/wiki/Special:Code/DXGL
7377
7478 ## AppDB
7579
7680 An AppDB system (similar to that on winehq.org) is now available at:
77 -https://www.dxgl.info/appdb/
 81+https://dxgl.org/appdb/
7882
7983 This requires a user account separate from the other services.
8084
Index: dxglcfg/surfacegen.cpp
@@ -272,6 +272,94 @@
273273 unsigned long *buffer32 = (unsigned long*) buffer;
274274 switch(ddsd.ddpfPixelFormat.dwRGBBitCount)
275275 {
 276+ case 0:
 277+ if (ddsd.ddpfPixelFormat.dwFlags & DDPF_FOURCC)
 278+ {
 279+ switch (ddsd.ddpfPixelFormat.dwFourCC)
 280+ {
 281+ case MAKEFOURCC('Y', '8', ' ', ' '):
 282+ case MAKEFOURCC('Y', '8', '0', '0'):
 283+ case MAKEFOURCC('G', 'R', 'E', 'Y'):
 284+ for (y = 0; y < ddsd.dwHeight; y++)
 285+ {
 286+ for (x = 0; x < ddsd.dwWidth; x++)
 287+ {
 288+ buffer[x + (ddsd.lPitch * y)] = (unsigned char)((x / (ddsd.dwWidth / 16.)) + 16 * floor((y / (ddsd.dwHeight / 16.))));
 289+ }
 290+ }
 291+ break;
 292+ case MAKEFOURCC('Y', '1', '6', ' '):
 293+ for (y = 0; y < ddsd.dwHeight; y++)
 294+ {
 295+ for (x = 0; x < ddsd.dwWidth; x++)
 296+ {
 297+ buffer16[x + ((ddsd.lPitch / 2) * y)] = (unsigned short)((x / (ddsd.dwWidth / 256.)) + 256 * floor((y / (ddsd.dwHeight / 256.))));
 298+ }
 299+ }
 300+ break;
 301+ case MAKEFOURCC('U', 'Y', 'V', 'Y'):
 302+ case MAKEFOURCC('U', 'Y', 'N', 'V'):
 303+ case MAKEFOURCC('Y', '4', '2', '2'):
 304+ for (y = 0; y < ddsd.dwHeight; y++)
 305+ {
 306+ for (x = 0; x < ddsd.dwWidth; x++)
 307+ {
 308+ buffer16[x + ((ddsd.lPitch / 2) * y)] = EncodeUYVY((unsigned long)((x / (ddsd.dwWidth / 4096.)) + 4096 * floor((y / (ddsd.dwHeight / 4096.)))), x);
 309+ }
 310+ }
 311+ break;
 312+ case MAKEFOURCC('Y', 'U', 'Y', '2'):
 313+ case MAKEFOURCC('Y', 'U', 'Y', 'V'):
 314+ case MAKEFOURCC('Y', 'U', 'N', 'V'):
 315+ for (y = 0; y < ddsd.dwHeight; y++)
 316+ {
 317+ for (x = 0; x < ddsd.dwWidth; x++)
 318+ {
 319+ buffer16[x + ((ddsd.lPitch / 2) * y)] = EncodeYUYV((unsigned long)((x / (ddsd.dwWidth / 4096.)) + 4096 * floor((y / (ddsd.dwHeight / 4096.)))), x);
 320+ }
 321+ }
 322+ break;
 323+ case MAKEFOURCC('Y', 'V', 'Y', 'U'):
 324+ for (y = 0; y < ddsd.dwHeight; y++)
 325+ {
 326+ for (x = 0; x < ddsd.dwWidth; x++)
 327+ {
 328+ buffer16[x + ((ddsd.lPitch / 2) * y)] = EncodeYVYU((unsigned long)((x / (ddsd.dwWidth / 4096.)) + 4096 * floor((y / (ddsd.dwHeight / 4096.)))), x);
 329+ }
 330+ }
 331+ break;
 332+ case MAKEFOURCC('R', 'G', 'B', 'G'):
 333+ for (y = 0; y < ddsd.dwHeight; y++)
 334+ {
 335+ for (x = 0; x < ddsd.dwWidth; x++)
 336+ {
 337+ buffer16[x + ((ddsd.lPitch / 2) * y)] = EncodeRGBG((unsigned long)((x / (ddsd.dwWidth / 4096.)) + 4096 * floor((y / (ddsd.dwHeight / 4096.)))), x);
 338+ }
 339+ }
 340+ break;
 341+ case MAKEFOURCC('G', 'R', 'G', 'B'):
 342+ for (y = 0; y < ddsd.dwHeight; y++)
 343+ {
 344+ for (x = 0; x < ddsd.dwWidth; x++)
 345+ {
 346+ buffer16[x + ((ddsd.lPitch / 2) * y)] = EncodeGRGB((unsigned long)((x / (ddsd.dwWidth / 4096.)) + 4096 * floor((y / (ddsd.dwHeight / 4096.)))), x);
 347+ }
 348+ }
 349+ break;
 350+ case MAKEFOURCC('A', 'Y', 'U', 'V'):
 351+ for (y = 0; y < ddsd.dwHeight; y++)
 352+ {
 353+ for (x = 0; x < ddsd.dwWidth; x++)
 354+ {
 355+ buffer32[x + ((ddsd.lPitch / 4) * y)] = EncodeAYUV((unsigned long)((x / (ddsd.dwWidth / 4096.)) + 4096 * floor((y / (ddsd.dwHeight / 4096.)))));
 356+ }
 357+ }
 358+ break;
 359+ default:
 360+ break;
 361+ }
 362+ }
 363+ break;
276364 case 1:
277365 for(y = 0; y < ddsd.dwHeight; y++)
278366 {