diff --git a/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx b/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx index 30a464c676..785b82b20b 100644 --- a/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx +++ b/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx @@ -1573,19 +1573,26 @@ bool wdxGraphicsWindow::resize(unsigned int xsize,unsigned int ysize) { bool bNeedZBuffer = (_dxgsg->scrn.PresParams.EnableAutoDepthStencil!=false); bool bNeedStencilBuffer = IS_STENCIL_FORMAT(_dxgsg->scrn.PresParams.AutoDepthStencilFormat); - // wdxdisplay_cat.error() << "1111111 lowvidmemcard="<< _dxgsg->scrn.bIsLowVidMemCard << endl; + bool bIsGoodMode=false; - if((_dxgsg->scrn.bIsLowVidMemCard) && ((xsize!=640)||(ysize!=480))) { - wdxdisplay_cat.error() << "resize() failed: cant resize low vidmem device #" << _dxgsg->scrn.CardIDNum << " to non 640x480!\n"; - goto Error_Return; + if(!special_check_fullscreen_resolution(xsize,ysize)) { + // bypass the lowvidmem test below for certain "lowmem" cards we know have valid modes + + // wdxdisplay_cat.info() << "1111111 lowvidmemcard="<< _dxgsg->scrn.bIsLowVidMemCard << endl; + if(_dxgsg->scrn.bIsLowVidMemCard && (!((xsize==640) && (ysize==480)))) { + wdxdisplay_cat.error() << "resize() failed: will not try to resize low vidmem device #" << _dxgsg->scrn.CardIDNum << " to non-640x480!\n"; + goto Error_Return; + } } + // must ALWAYS use search_for_valid_displaymode even if we know a-priori that res is valid so we can + // get a valid pixfmt search_for_valid_displaymode(xsize,ysize,bNeedZBuffer,bNeedStencilBuffer, - &_dxgsg->scrn.SupportedScreenDepthsMask, - &bCouldntFindValidZBuf, - &pixFmt); + &_dxgsg->scrn.SupportedScreenDepthsMask,&bCouldntFindValidZBuf, + &pixFmt); + bIsGoodMode=(pixFmt!=D3DFMT_UNKNOWN); - if(pixFmt==D3DFMT_UNKNOWN) { + if(!bIsGoodMode) { wdxdisplay_cat.error() << "resize() failed: " << (bCouldntFindValidZBuf ? "Couldnt find valid zbuffer format to go with FullScreen mode" : "No supported FullScreen modes") << " at " << xsize << "x" << ysize << " for device #" << _dxgsg->scrn.CardIDNum <GetAvailableVidMem(&ddsGAVMCaps,&dwVidMemTotal,&dwVidMemFree))) { + wdxdisplay_cat.error() << "GetAvailableVidMem failed for device #"<< i << D3DERRORSTRING(hr); + // goto skip_device; + exit(1); // probably want to exit, since it may be my fault + } + } + wdxdisplay_cat.info() << "GetAvailableVidMem (including AGP) returns Total: "<GetAvailableVidMem(&ddsGAVMCaps,&dwVidMemTotal,&dwVidMemFree))) { - wdxdisplay_cat.error() << "GetAvailableVidMem failed for device #"<< pDX7DeviceID->szDescription<< D3DERRORSTRING(hr); + wdxdisplay_cat.error() << "GetAvailableVidMem failed for device #"<< i<< D3DERRORSTRING(hr); // goto skip_device; exit(1); // probably want to exit, since it may be my fault } + wdxdisplay_cat.info() << "GetAvailableVidMem (no AGP) returns Total: "<Release(); // release DD obj, since this is all we needed it for - - wdxdisplay_cat.info() << "GetAvailableVidMem returns Total: "<szDescription<< endl; - if(!dx_do_vidmemsize_check) { // still calling the DD stuff to get deviceID, etc. is this necessary? (*g_pCardIDVec)[i].MaxAvailVidMem = UNKNOWN_VIDMEM_SIZE; @@ -1841,12 +1860,14 @@ find_all_card_memavails(void) { if(dwVidMemTotal==0) { // unreliable driver dwVidMemTotal=UNKNOWN_VIDMEM_SIZE; } else { - // assume they wont return a proper max value, so - // round up to next pow of 2 - UINT count=0; - while((dwVidMemTotal >> count)!=0) - count++; - dwVidMemTotal = (1 << count); + if(!ISPOW2(dwVidMemTotal)) { + // assume they wont return a proper max value, so + // round up to next pow of 2 + UINT count=0; + while((dwVidMemTotal >> count)!=0x0) + count++; + dwVidMemTotal = (1 << count); + } } // after SetDisplayMode, GetAvailVidMem totalmem seems to go down by 1.2 meg (contradicting above