DXGL r879 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r878‎ | r879 | r880 >
Date:00:23, 20 November 2018
Author:admin
Status:new
Tags:
Comment:
Slight work towards color depth conversion support.
Modified paths:
  • /ddraw/colorconv.c (modified) (history)
  • /ddraw/colorconv.h (modified) (history)
  • /ddraw/glTexture.cpp (modified) (history)
  • /ddraw/struct.h (modified) (history)

Diff [purge]

Index: ddraw/colorconv.c
@@ -18,6 +18,21 @@
1919 #include "common.h"
2020 #include "colorconv.h"
2121
 22+typedef void(*COLORCONVPROC) (size_t count, void *dest, void *src);
 23+COLORCONVPROC colorconvproc[] =
 24+{
 25+ rgba8332torgba8888,
 26+ rgba8888torgba8332,
 27+ rgb565torgba8888,
 28+ rgb565torgbx8888,
 29+ rgbx8888torgb565,
 30+ rgba1555torgba8888,
 31+ rgba8888torgba1555,
 32+ rgba4444torgba8888,
 33+ rgba8888torgba4444,
 34+ uyvytorgbx8888
 35+};
 36+
2237 __inline unsigned int _1to8(unsigned int input)
2338 {
2439 return input * 255;
Index: ddraw/colorconv.h
@@ -23,9 +23,19 @@
2424 extern "C" {
2525 #endif
2626
 27+typedef void(*COLORCONVPROC) (size_t count, void *dest, void *src);
 28+extern COLORCONVPROC colorconvproc[];
 29+
2730 void rgba8332torgba8888(size_t count, DWORD *dest, WORD *src);
2831 void rgba8888torgba8332(size_t count, WORD *dest, DWORD *src);
2932 void rgb565torgba8888(size_t count, DWORD *dest, WORD *src);
 33+void rgb565torgbx8888(size_t count, DWORD *dest, WORD *src);
 34+void rgbx8888torgb565(size_t count, WORD *dest, DWORD *src);
 35+void rgba1555torgba8888(size_t count, DWORD *dest, WORD *src);
 36+void rgba8888torgba1555(size_t count, WORD *dest, DWORD *src);
 37+void rgba4444torgba8888(size_t count, DWORD *dest, WORD *src);
 38+void rgba8888torgba4444(size_t count, WORD *dest, DWORD *src);
 39+void uyvytorgbx8888(size_t count, DWORD *dest, DWORD *src);
3040
3141 #ifdef __cplusplus
3242 }
Index: ddraw/glTexture.cpp
@@ -25,6 +25,7 @@
2626 #include "util.h"
2727 #include <math.h>
2828 #include "scalers.h"
 29+#include "colorconv.h"
2930
3031 extern "C" {
3132
@@ -816,9 +817,11 @@
817818 This->colorbits[3] = 0;
818819 break;
819820 case 7: // 16-bit RGBA8332
820 - //This->useconv = TRUE;
821 - //This->convfunction = 0;
822 - FIXME("Unusual texture format RGBA8332 not supported");
 821+ This->useconv = TRUE;
 822+ This->convfunctionupload = 0;
 823+ This->convfunctiondownload = 1;
 824+ This->internalformats[0] = GL_RGBA8;
 825+ This->type = GL_UNSIGNED_BYTE;
823826 This->colororder = 1;
824827 This->colorsizes[0] = 7;
825828 This->colorsizes[1] = 7;
@@ -930,7 +933,7 @@
931934 case 15: // 24-bit Z buffer
932935 This->internalformats[0] = GL_DEPTH_COMPONENT24;
933936 This->format = GL_DEPTH_COMPONENT;
934 - This->type = GL_UNSIGNED_INT;
 937+ This->type = GL_UNSIGNED_SHORT;
935938 This->colororder = 4;
936939 This->colorsizes[0] = 16777215;
937940 This->colorsizes[1] = 16777215;
Index: ddraw/struct.h
@@ -312,7 +312,8 @@
313313 GLenum type;
314314 BOOL zhasstencil;
315315 BOOL useconv;
316 - int convfunction;
 316+ int convfunctionupload;
 317+ int convfunctiondownload;
317318 struct glTexture *palette;
318319 struct glTexture *stencil;
319320 struct glTexture *dummycolor;