no mem-based res checks for 640x480

This commit is contained in:
cxgeorge 2002-11-03 03:54:39 +00:00
parent 8e4dd8fa12
commit a4c80d791a
2 changed files with 28 additions and 20 deletions

View File

@ -2064,6 +2064,13 @@ void wdxGraphicsWindow::search_for_valid_displaymode(UINT RequestedXsize,UINT Re
if(bVerboseMode) if(bVerboseMode)
wdxdisplay_cat.info() << "searching for valid display modes at res: (" << RequestedXsize << "," << RequestedYsize << "), TotalModes: " << cNumModes<< endl; wdxdisplay_cat.info() << "searching for valid display modes at res: (" << RequestedXsize << "," << RequestedYsize << "), TotalModes: " << cNumModes<< endl;
// ignore memory based checks for min res 640x480. some cards just dont give accurate memavails.
// (should I do the check anyway for 640x480 32bpp?)
bool bDoMemBasedChecks=((!((RequestedXsize==640)&&(RequestedXsize==480))) &&
(_dxgsg->scrn.MaxAvailVidMem!=UNKNOWN_VIDMEM_SIZE) &&
(!special_check_fullscreen_resolution(RequestedXsize,RequestedYsize)));
for(int i=0;i<cNumModes;i++) { for(int i=0;i<cNumModes;i++) {
D3DDISPLAYMODE dispmode; D3DDISPLAYMODE dispmode;
hr = _dxgsg->scrn.pD3D8->EnumAdapterModes(_dxgsg->scrn.CardIDNum,i,&dispmode); hr = _dxgsg->scrn.pD3D8->EnumAdapterModes(_dxgsg->scrn.CardIDNum,i,&dispmode);
@ -2102,8 +2109,8 @@ void wdxGraphicsWindow::search_for_valid_displaymode(UINT RequestedXsize,UINT Re
float RendTgtMinMemReqmt; float RendTgtMinMemReqmt;
// if we have a valid memavail value, try to determine if we have enough space // if we have a valid memavail value, try to determine if we have enough space
if( (_dxgsg->scrn.MaxAvailVidMem!=UNKNOWN_VIDMEM_SIZE) && if( bDoMemBasedChecks) {
(!(special_check_fullscreen_resolution(RequestedXsize,RequestedYsize)))) {
// assume user is testing fullscreen, not windowed, so use the dwTotal value // assume user is testing fullscreen, not windowed, so use the dwTotal value
// see if 3 scrnbufs (front/back/z)at 16bpp at xsize*ysize will fit with a few // see if 3 scrnbufs (front/back/z)at 16bpp at xsize*ysize will fit with a few
// extra megs for texmem // extra megs for texmem
@ -2139,8 +2146,9 @@ void wdxGraphicsWindow::search_for_valid_displaymode(UINT RequestedXsize,UINT Re
continue; continue;
} }
if((_dxgsg->scrn.MaxAvailVidMem!=UNKNOWN_VIDMEM_SIZE) && float MinMemReqmt = 0.0f;
(!(special_check_fullscreen_resolution(RequestedXsize,RequestedYsize)))) {
if(bDoMemBasedChecks) {
// test memory again, this time including zbuf size // test memory again, this time including zbuf size
float zbytes_per_pixel = (IS_16BPP_ZBUFFER(zformat) ? 2 : 4); float zbytes_per_pixel = (IS_16BPP_ZBUFFER(zformat) ? 2 : 4);
float MinMemReqmt = RendTgtMinMemReqmt + ((float)RequestedXsize)*((float)RequestedYsize)*zbytes_per_pixel; float MinMemReqmt = RendTgtMinMemReqmt + ((float)RequestedXsize)*((float)RequestedYsize)*zbytes_per_pixel;
@ -2155,22 +2163,22 @@ void wdxGraphicsWindow::search_for_valid_displaymode(UINT RequestedXsize,UINT Re
<< " (" << (int)MinMemReqmt << " > " << _dxgsg->scrn.MaxAvailVidMem << ")\n"; << " (" << (int)MinMemReqmt << " > " << _dxgsg->scrn.MaxAvailVidMem << ")\n";
continue; continue;
} }
}
if(MinMemReqmt<_dxgsg->scrn.MaxAvailVidMem) { if((!bDoMemBasedChecks) || (MinMemReqmt<_dxgsg->scrn.MaxAvailVidMem)) {
if(!IS_16BPP_ZBUFFER(zformat)) { if(!IS_16BPP_ZBUFFER(zformat)) {
// see if things fit with a 16bpp zbuffer // see if things fit with a 16bpp zbuffer
if(!FindBestDepthFormat(_dxgsg->scrn,dispmode,&zformat,bWantStencil,true,bVerboseMode)) { if(!FindBestDepthFormat(_dxgsg->scrn,dispmode,&zformat,bWantStencil,true,bVerboseMode)) {
if(bVerboseMode) if(bVerboseMode)
wdxdisplay_cat.info() << "FindBestDepthFmt rejected Mode["<<i<<"] (" <<RequestedXsize<<"x" << RequestedYsize <<","<< D3DFormatStr(dispmode.Format) << endl; wdxdisplay_cat.info() << "FindBestDepthFmt rejected Mode["<<i<<"] (" <<RequestedXsize<<"x" << RequestedYsize <<","<< D3DFormatStr(dispmode.Format) << endl;
*pCouldntFindAnyValidZBuf=true; *pCouldntFindAnyValidZBuf=true;
continue; continue;
}
// right now I'm not going to use these flags, just let the create fail out-of-mem and retry at 16bpp
*pSupportedScreenDepthsMask |= (IS_16BPP_DISPLAY_FORMAT(dispmode.Format) ? DISPLAY_16BPP_REQUIRES_16BPP_ZBUFFER_FLAG : DISPLAY_32BPP_REQUIRES_16BPP_ZBUFFER_FLAG);
} }
}
// right now I'm not going to use these flags, just let the create fail out-of-mem and retry at 16bpp
*pSupportedScreenDepthsMask |= (IS_16BPP_DISPLAY_FORMAT(dispmode.Format) ? DISPLAY_16BPP_REQUIRES_16BPP_ZBUFFER_FLAG : DISPLAY_32BPP_REQUIRES_16BPP_ZBUFFER_FLAG);
}
} }
} }
@ -2331,7 +2339,7 @@ bool wdxGraphicsWindow::search_for_device(LPDIRECT3D8 pD3D8,DXDeviceInfo *pDevIn
{32000000, 800, 600}, // 32MB+ cards will choose this {32000000, 800, 600}, // 32MB+ cards will choose this
#endif #endif
// some monitors have trouble w/1600x1200, so dont pick this by deflt, // some monitors have trouble w/1600x1200, so dont pick this by deflt,
// even though 64MB cards should handle it // even though 64MB cards should handle it
{64000000, 1280,1024} // 64MB+ cards will choose this {64000000, 1280,1024} // 64MB+ cards will choose this
}; };
const NumResLims = (sizeof(MemRes)/sizeof(Memlimres)); const NumResLims = (sizeof(MemRes)/sizeof(Memlimres));
@ -3091,7 +3099,6 @@ get_depth_bitwidth(void) {
// return ddsd.ddpfPixelFormat.dwRGBBitCount; // return ddsd.ddpfPixelFormat.dwRGBBitCount;
} }
/*
void wdxGraphicsWindow:: void wdxGraphicsWindow::
get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_format) { get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_format) {
assert(_dxgsg!=NULL); assert(_dxgsg!=NULL);
@ -3104,7 +3111,7 @@ get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_forma
fb_format = PixelBuffer::F_rgb5; fb_format = PixelBuffer::F_rgb5;
else fb_format = PixelBuffer::F_rgb; else fb_format = PixelBuffer::F_rgb;
} }
*/
// Global system parameters we want to modify during our run // Global system parameters we want to modify during our run
static int iMouseTrails; static int iMouseTrails;
static bool bCursorShadowOn,bMouseVanish; static bool bCursorShadowOn,bMouseVanish;

View File

@ -91,6 +91,7 @@ public:
virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen); virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen);
bool special_check_fullscreen_resolution(UINT xsize,UINT ysize); bool special_check_fullscreen_resolution(UINT xsize,UINT ysize);
virtual int get_depth_bitwidth(void); virtual int get_depth_bitwidth(void);
virtual void get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_format);
protected: protected:
ButtonHandle lookup_key(WPARAM wparam) const; ButtonHandle lookup_key(WPARAM wparam) const;