Page 1 of 4

Support more glide resolutions

Posted: Mon Apr 13, 2015 4:11 pm
by VEG
Resolutions list from glide 3x SDK sources:

Code: Select all

#define GR_RESOLUTION_320x200   0x0
#define GR_RESOLUTION_320x240   0x1
#define GR_RESOLUTION_400x256   0x2
#define GR_RESOLUTION_512x384   0x3
#define GR_RESOLUTION_640x200   0x4
#define GR_RESOLUTION_640x350   0x5
#define GR_RESOLUTION_640x400   0x6
#define GR_RESOLUTION_640x480   0x7
#define GR_RESOLUTION_800x600   0x8
#define GR_RESOLUTION_960x720   0x9
#define GR_RESOLUTION_856x480   0xa
#define GR_RESOLUTION_512x256   0xb
#define GR_RESOLUTION_1024x768  0xC
#define GR_RESOLUTION_1280x1024 0xD
#define GR_RESOLUTION_1600x1200 0xE
#define GR_RESOLUTION_400x300   0xF
#define GR_RESOLUTION_1152x864  0x10
#define GR_RESOLUTION_1280x960  0x11
#define GR_RESOLUTION_1600x1024 0x12
#define GR_RESOLUTION_1792x1344 0x13
#define GR_RESOLUTION_1856x1392 0x14
#define GR_RESOLUTION_1920x1440 0x15
#define GR_RESOLUTION_2048x1536 0x16
#define GR_RESOLUTION_2048x2048 0x17
#define GR_RESOLUTION_NONE      0xff

It seems that nglide supports only resolutions up to 1600×1200 (0xE). Maybe it's better to support other ones?

Re: Support more glide resolutions

Posted: Mon Apr 13, 2015 10:59 pm
by Zeus
These were only supported by VSA-100 (Voodoo4/5). And as you may expect there are no games that support them (3dfx went bankrupt couple months after VSA-100 release). Existing glide3x titles don't recognize them (I tried).

Re: Support more glide resolutions

Posted: Tue Apr 14, 2015 5:23 am
by Gamecollector
Well, a possible exception is 1152x864 and 1280x960 in quake engine games, Half-Life as the example. Through the OGL -> 3dfxvgl -> glide3x.dll chain.
But the first step is - test these games with a real Voodoo4/5. Because the standard reaction to 1280x960 is "this mode not supported".

Re: Support more glide resolutions

Posted: Tue Apr 14, 2015 5:13 pm
by VEG
Zeus wrote:These were only supported by VSA-100 (Voodoo4/5). And as you may expect there are no games that support them (3dfx went bankrupt couple months after VSA-100 release). Existing glide3x titles don't recognize them (I tried).

Yes, but now I'm patching NFSIII and I've added support of these resolutions. But unfortunately nGlide treats these resolutions as 640×480. Also I've added some patches for widescreen resolutions in d3d mode, but in d3d mode this game doesn't uses some effects like fog. It would be nice if nGlide will unofficially extend this list of resolutions for 16:9 and 16:10 ones :)
For non-standard resolutions we can use ids from 0x80 to 0xFF.

Re: Support more glide resolutions

Posted: Tue Apr 14, 2015 11:02 pm
by Zeus
VEG wrote:

Does the game scale vertices properly after modification? Do you see only a quarter of the game screen after forcing resolution to 1280x960? (that's what you should see since as you noticed, current nGlide will run it in 640x480)

P.S. Any URL to this project?

Re: Support more glide resolutions

Posted: Wed Apr 15, 2015 9:21 am
by VEG
Zeus wrote:Does the game scale vertices properly after modification?

No, but now I'm fixing these problems. I've found what I have to patch to make game more responsive for all possible resolutions.

Zeus wrote:Do you see only a quarter of the game screen after forcing resolution to 1280x960? (that's what you should see since as you noticed, current nGlide will run it in 640x480)

Yep. But I've not forced this resolution via NGLIDE_RESOLUTION option. I've just used this constant in the voodoo2a.dll:

Code: Select all

#define GR_RESOLUTION_1280x960 0x11


Zeus wrote:P.S. Any URL to this project?

It's not in public still. But I can send you beta version for testing purposes when I'll finish native widescreen support in the game.

Re: Support more glide resolutions

Posted: Wed Apr 15, 2015 10:07 am
by VEG
I've tried to list all useful resolutions...

Code: Select all

640   480
800   600
1024   768
1152   864
1280   720
1280   960
1280   1024
1366   768
1600   1200
1680   1050
1920   1080
1920   1200
2560   1440
2560   1600
3840   2160
5120   2880
5120   3200

It's too long. I have a better idea.

Code: Select all

GrContext_t grSstWinOpen(   FxU32   hWin,
   GrScreenResolution_t   res,
   GrScreenRefresh_t   ref,
   GrColorFormat_t   cFormat,
   GrOriginLocation_t   org_loc,
   int   num_buffers,
   int   num_aux_buffers
   )

GrScreenRefresh_t ref is just int32 value. Officially it can be from 0x0 to 0x17. We can treat any higher value as a pointer to this kind of structure:

Code: Select all

struct
{
   int   width,
   int   height,
   int   colors // not necessary?
}

Glide3x uses GrScreenResolution_t also in this structure for grQueryResolutions function:

Code: Select all

typedef struct {
  GrScreenResolution_t  resolution;
  GrScreenRefresh_t  refresh;
  int  numColorBuffers;
  int  numAuxBuffers;
} GlideResolution;

We have to treat GrScreenResolution_t resolution also as a pointer if it is higher that 0x17, because program may check if current system supports desired custom resolution.

All pointers in Windows can't be lower than 0xFFFF (you can't allocate memory at 0x0..0xFFFF) and any conflicts aren't possible. Other glide wrappers and official glide driver will report any values higher than 0x17 as unsupported resolution. There is also no any problems.

Also it would be nice to have ability to request list of all possible resolutions via grQueryResolutions. But we can't just use GR_QUERY_ANY ((FxU32)(~0)) because some old programs may be confused by very high value of GrScreenResolution_t. I propose to use a pointer to {-1,-1} (or {0,0}) for request all supported custom resolutions. And for simplicity of reading resolutions list code it would be nice if in this case even standard glide resolutions will be reported in this extended format. For example, instead of GR_RESOLUTION_640x480 0x7 it have to report this resolution as a pointer to {640,480}. Any old programs will not be confused by this because they don't use extended format of query.

I think this extension may be useful for all glide wrappers.

In the glide3x code you may allocate one array for this extended structures of resolutions. When program calls grQueryResolutions with extended format you may use pointers to items from this allocated array. It doesn't require much additional memory, but in this case if grQueryResolutions will be called many times all custom GrScreenResolution_t pointers will be same for one resolution. It may be very useful.

UPD

Oh, I think that I've overcomplicated this thing. We can simply treat this int32 value as a structure with two uint16 values {width, height}! This trick doesn't requires any additional memory and it will be much easier to read this values in the code (just two additional instructions: mov ebx, eax; shr eax, 16). When high part of this value is 0 and low part is lower than 0x18 it means that it is value just GR_RESOLUTION_* constant. 0xFFFFFFFF means GR_QUERY_ANY in the default format. We can use constant 0xFFFEFFFE to query resolutions list in the extended format. int16 can contain value from 0 to 65535. I think that it will be enough. Even 8K resolutions so far from 65K... :)

Re: Support more glide resolutions

Posted: Wed Apr 15, 2015 11:54 am
by Gamecollector
Have tested my Voodoo2 with test30.exe from the glide2x SDK (WinXpSp3, w2k 1.02.00 drivers).
Well:
a) it tries to use up to 400x300 (0x0-0xF).
b) 320x200, 320x240, 400x256, 640x200, 640x350, 400x300 not work ("can't use this resolution/refresh/buffers combination").
c) 960x720, 1024x768, 1280x1024 and 1600x1200 not work because I don't have SLI.
Unfortunately all glide3x SDK tests not work ("grSstWinOpen: need to use a valid window handle"), can't test.

Are resolutions from a) only for Voodoo Graphics/Rush?
I will test in Win98SE later.

Re: Support more glide resolutions

Posted: Wed Apr 15, 2015 3:51 pm
by Zeus
VEG wrote:Yep. But I've not forced this resolution via NGLIDE_RESOLUTION option. I've just used this constant in the voodoo2a.dll:

Code: Select all

#define GR_RESOLUTION_1280x960 0x11

Of course. Nobody talks here about scaled resolutions via nGlide configurator / nGlide env variables. These are supported and don't require any modifications.

VEG wrote:Also it would be nice to have ability to request list of all possible resolutions via grQueryResolutions.

It's too early to talk about this. But yes, we could use some magic numbers for 'output' to list the number of extended resolutions and the extended resolution list itself.

VEG wrote:For non-standard resolutions we can use ids from 0x80 to 0xFF.

I would rather use this approach, but like I said earlier let's not talk about it now, it's too early.

For now, focus on vertices scaling (use 0x10-0x17 for your tests). Because without the proper scaling all these modifications will be meaningless.

Re: Support more glide resolutions

Posted: Wed Apr 15, 2015 4:15 pm
by VEG
I would rather use this approach, but like I said earlier let's not talk about it now, it's too early.
It's not flexible and complicates code that reads resolutions list because we have to use additional tables ID => width x height. And this approach requires addition new constants with the lapse of time. We don't know which resolutions will be popular in 10 years :)

For now, focus on vertices scaling (use 0x10-0x17 for your tests). Because without the proper scaling all these modifications will be meaningless.
Ok, I think it will be ready soon.