DXGL r898 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r897‎ | r898 | r899 >
Date:23:08, 8 March 2019
Author:admin
Status:new
Tags:
Comment:
Fix uploading of 24-bit depth surfaces.
Modified paths:
  • /common/version.h.in (modified) (history)
  • /ddraw/colorconv.c (modified) (history)
  • /ddraw/colorconv.h (modified) (history)
  • /ddraw/glTexture.cpp (modified) (history)
  • /dxglcfg/dxglcfg.cpp (modified) (history)

Diff [purge]

Index: common/version.h.in
@@ -12,8 +12,8 @@
1313 #define DXGLVERQWORD (((unsigned __int64)DXGLMAJOR<<48)+((unsigned __int64)DXGLMINOR<<32)+((unsigned __int64)DXGLPOINT<<16)+(unsigned __int64)DXGLBUILD)
1414 #define DXGLVERSTRING $VERSTRING
1515
16 -#define COPYYEAR 2018
17 -#define COPYYEARSTRING "2018"
 16+#define COPYYEAR 2019
 17+#define COPYYEARSTRING "2019"
1818
1919 #define SHADER2DVERSION 1
2020 #define SHADER3DVERSION 1
Index: ddraw/colorconv.c
@@ -38,6 +38,8 @@
3939 pal8topal1, // 14
4040 pal8topal2, // 15
4141 pal8topal4, // 16
 42+ bpp24tobpp32, // 17
 43+ bpp32tobpp24, // 18
4244 };
4345
4446 __inline unsigned int _1to8(unsigned int input)
@@ -290,4 +292,26 @@
291293 void rgbx8888touyvy(size_t count, DWORD *dest, DWORD *src)
292294 {
293295
294 -}
\ No newline at end of file
 296+}
 297+
 298+void bpp24tobpp32(size_t count, DWORD *dest, BYTE *src)
 299+{
 300+ size_t i;
 301+ for (i = 0; i < count; i++)
 302+ {
 303+ dest[i] = (src[i * 3] | (src[(i * 3) + 1] << 8) | (src[(i * 3) + 2] << 16));
 304+ }
 305+}
 306+
 307+void bpp32tobpp24(size_t count, BYTE *dest, DWORD *src)
 308+{
 309+ size_t i;
 310+ DWORD in;
 311+ for (i = 0; i < count; i++)
 312+ {
 313+ in = src[i];
 314+ dest[i * 3] = in & 0xFF;
 315+ dest[(i * 3) + 1] = (in >> 8) & 0xFF;
 316+ dest[(i * 3) + 2] = (in >> 16) & 0xFF;
 317+ }
 318+}
Index: ddraw/colorconv.h
@@ -43,6 +43,8 @@
4444 void rgba8888torgba4444(size_t count, WORD *dest, DWORD *src);
4545 void uyvytorgbx8888(size_t count, DWORD *dest, DWORD *src);
4646 void rgbx8888touyvy(size_t count, DWORD *dest, DWORD *src);
 47+void bpp24tobpp32(size_t count, DWORD *dest, BYTE *src);
 48+void bpp32tobpp24(size_t count, BYTE *dest, DWORD *src);
4749
4850 #ifdef __cplusplus
4951 }
Index: ddraw/glTexture.cpp
@@ -1136,9 +1136,13 @@
11371137 This->colorbits[3] = 0;
11381138 break;
11391139 case 19: // 24-bit Z buffer
 1140+ This->useconv = TRUE;
 1141+ This->convfunctionupload = 17;
 1142+ This->convfunctiondownload = 18;
 1143+ This->internalsize = 4;
11401144 This->internalformats[0] = GL_DEPTH_COMPONENT24;
11411145 This->format = GL_DEPTH_COMPONENT;
1142 - This->type = GL_UNSIGNED_SHORT;
 1146+ This->type = GL_UNSIGNED_INT;
11431147 This->colororder = 4;
11441148 This->colorsizes[0] = 16777215;
11451149 This->colorsizes[1] = 16777215;
Index: dxglcfg/dxglcfg.cpp
@@ -1,5 +1,5 @@
22 // DXGL
3 -// Copyright (C) 2011-2018 William Feely
 3+// Copyright (C) 2011-2019 William Feely
44 // Portions copyright (C) 2018 Syahmi Azhar
55
66 // This library is free software; you can redistribute it and/or
@@ -3136,7 +3136,7 @@
31373137 HWND hProgressWnd;
31383138 WNDCLASSEX wndclass;
31393139 HWND hTempWnd;
3140 - DWORD threadid;
 3140+ //DWORD threadid;
31413141 switch (Msg)
31423142 {
31433143 case WM_INITDIALOG: