diff options
author | Jaroslav Hensl <jara@hensl.cz> | 2024-08-02 22:50:04 +0200 |
---|---|---|
committer | Jaroslav Hensl <jara@hensl.cz> | 2024-08-02 22:50:04 +0200 |
commit | e9f344c71fa790096f499e0d82ad072c8351bee0 (patch) | |
tree | 7642705c1fa6a7298370da11597284cb921ff25a | |
parent | 3edc12d83254c04554461fdbb310dd46d284c27c (diff) | |
download | vmdisp9x-e9f344c71fa790096f499e0d82ad072c8351bee0.tar.gz |
DDHAL: build mode tables dynamically (softgpu/99)
-rw-r--r-- | dddrv.c | 24 | ||||
-rw-r--r-- | makefile | 2 | ||||
-rw-r--r-- | vmdahal.h | 22 |
3 files changed, 34 insertions, 14 deletions
@@ -43,6 +43,7 @@ const static DD32BITDRIVERDATA_t drv_vmhal9x = { 0
};
+/*
static DDHALMODEINFO_t modeInfo[] = {
{ 640, 480, 640, 8, DDMODEINFO_PALETTIZED, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 640, 480, 1280, 16, 0, 0, 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 },
@@ -77,9 +78,9 @@ static DDHALMODEINFO_t modeInfo[] = { { 1920, 1200, 1920, 8, DDMODEINFO_PALETTIZED, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 1920, 1200, 3840, 16, 0, 0, 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 },
{ 1920, 1200, 7680, 32, 0, 0, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 },
-};
+};*/
-#define NUMMODES (sizeof(modeInfo)/sizeof(DDHALMODEINFO_t))
+//#define NUMMODES (sizeof(modeInfo)/sizeof(DDHALMODEINFO_t))
/*
* pre-declare our HAL fns
@@ -231,9 +232,6 @@ static void buildPixelFormat(LPDDHALMODEINFO lpMode, LPDDPIXELFORMAT lpddpf) */
static void buildDDHALInfo(VMDAHAL_t __far *hal, int modeidx)
{
-// static DWORD AlignTbl [ 9 ] = { 64, 64, 64, 64, 64, 64, 64, 64, 64 };
-// static DWORD AlignTbl [ 9 ] = { 8, 8, 8, 8, 16, 8, 24, 8, 32 };
-// static DWORD AlignTbl [ 9 ] = { 128, 128, 128, 128, 128, 128, 128, 128, 128 };
static DWORD AlignTbl [ 9 ] = { 16, 16, 16, 16, 16, 16, 16, 16, 16 }; /* we can now use aligned AVX to manipulate with surfaces */
int ii;
BOOL can_flip;
@@ -284,7 +282,7 @@ static void buildDDHALInfo(VMDAHAL_t __far *hal, int modeidx) hal->ddHALInfo.vmiData.ddpfDisplay.dwSize = sizeof(DDPIXELFORMAT_t);
if(modeidx >= 0)
{
- buildPixelFormat(&modeInfo[modeidx], &hal->ddHALInfo.vmiData.ddpfDisplay);
+ buildPixelFormat(&(VMDAHAL_modes(hal)[modeidx]), &hal->ddHALInfo.vmiData.ddpfDisplay);
}
/*
@@ -456,8 +454,8 @@ static void buildDDHALInfo(VMDAHAL_t __far *hal, int modeidx) /*
* mode information
*/
- hal->ddHALInfo.dwNumModes = NUMMODES;
- hal->ddHALInfo.lpModeInfo = modeInfo;
+ hal->ddHALInfo.dwNumModes = hal->modes_count;
+ hal->ddHALInfo.lpModeInfo = VMDAHAL_modes(hal);
} /* buildDDHALInfo */
@@ -478,17 +476,17 @@ BOOL DDCreateDriverObject(int bReset) return FALSE;
}
- for(modeidx = 0; modeidx < NUMMODES; modeidx++)
+ for(modeidx = 0; modeidx < hal->modes_count; modeidx++)
{
- if((modeInfo[modeidx].dwWidth == hda->width) &&
- (modeInfo[modeidx].dwHeight == hda->height) &&
- (modeInfo[modeidx].dwBPP == hda->bpp) )
+ if((hal->modes[modeidx].dwWidth == hda->width) &&
+ (hal->modes[modeidx].dwHeight == hda->height) &&
+ (hal->modes[modeidx].dwBPP == hda->bpp) )
{
break;
}
}
- if(modeidx == NUMMODES)
+ if(modeidx == hal->modes_count)
{
modeidx = -1;
}
@@ -12,7 +12,7 @@ OBJS += & INCS = -I$(%WATCOM)\h\win -Iddk -Ivmware
-VER_BUILD = 73
+VER_BUILD = 74
FLAGS = -DDRV_VER_BUILD=$(VER_BUILD)
@@ -4,6 +4,20 @@ #pragma pack(push)
#pragma pack(1)
+typedef struct DDHALMODEINFO2
+{
+ DWORD dwWidth; // width (in pixels) of mode
+ DWORD dwHeight; // height (in pixels) of mode
+ LONG lPitch; // pitch (in bytes) of mode
+ DWORD dwBPP; // bits per pixel
+ WORD wFlags; // flags
+ WORD wRefreshRate; // refresh rate
+ DWORD dwRBitMask; // red bit mask
+ DWORD dwGBitMask; // green bit mask
+ DWORD dwBBitMask; // blue bit mask
+ DWORD dwAlphaBitMask; // alpha bit mask
+} DDHALMODEINFO2_t;
+
typedef struct VMDAHALCB32
{
LPDDHAL_CREATESURFACE CreateSurface;
@@ -33,6 +47,7 @@ struct VXD_pair };
#define VXD_PAIRS_CNT 32
+#define DISP_MODES_MAX 512
typedef struct VMDAHAL
{
@@ -59,7 +74,14 @@ typedef struct VMDAHAL DWORD hDC;
struct VXD_pair vxd_table[VXD_PAIRS_CNT];
+
+ DDHALMODEINFO2_t modes[DISP_MODES_MAX];
+ DWORD modes_count;
+ DWORD custom_mode_id;
+
} VMDAHAL_t;
#pragma pack(pop)
+#define VMDAHAL_modes(_hal) ((struct DDHALMODEINFO __far *)(&(_hal->modes[0])))
+
#endif
|