diff --git a/panda/src/display/graphicsWindow.cxx b/panda/src/display/graphicsWindow.cxx index eb5c7c1b55..c53164f88b 100644 --- a/panda/src/display/graphicsWindow.cxx +++ b/panda/src/display/graphicsWindow.cxx @@ -931,11 +931,3 @@ do_determine_display_regions() { } } } - -void GraphicsWindow:: -get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_format) { - display_cat.warning() << "get_framebuffer_format() unimplemented by " << get_type() << endl; - - fb_type = PixelBuffer::T_unsigned_byte; - fb_format = PixelBuffer::F_rgb; -} diff --git a/panda/src/display/graphicsWindow.h b/panda/src/display/graphicsWindow.h index 90b750b9b0..80dbaef80e 100644 --- a/panda/src/display/graphicsWindow.h +++ b/panda/src/display/graphicsWindow.h @@ -104,12 +104,12 @@ public: bool has_button_event(int device) const; ButtonEvent get_button_event(int device); - virtual void get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_format); - -public: virtual int verify_window_sizes(int numsizes, int *dimen); + PT(DisplayRegion) make_scratch_display_region(int x_size, int y_size) const; +public: + // These are not intended to be called directly by the user. INLINE void win_display_regions_changed(); public: diff --git a/panda/src/dxgsg8/wdxGraphicsWindow8.cxx b/panda/src/dxgsg8/wdxGraphicsWindow8.cxx index 1801ee1d58..1c3feaf526 100644 --- a/panda/src/dxgsg8/wdxGraphicsWindow8.cxx +++ b/panda/src/dxgsg8/wdxGraphicsWindow8.cxx @@ -199,8 +199,76 @@ release_gsg() { if (_gsg != (GraphicsStateGuardian *)NULL) { GraphicsWindow::release_gsg(); } +} + +//////////////////////////////////////////////////////////////////// +// Function: wdxGraphicsWindow8::verify_window_sizes +// Access: Public, Virtual +// Description: Determines which of the indicated window sizes are +// supported by available hardware (e.g. in fullscreen +// mode). +// +// On entry, dimen is an array containing contiguous x,y +// pairs specifying possible display sizes; it is +// numsizes*2 words long. The function will zero out +// any invalid x,y size pairs. The return value is the +// number of valid sizes that were found. +//////////////////////////////////////////////////////////////////// +int wdxGraphicsWindow8:: +verify_window_sizes(int numsizes, int *dimen) { + // unfortunately this only works AFTER you make the window + // initially, so its really mostly useful for resizes only + assert(IS_VALID_PTR(_dxgsg)); + + int num_valid_modes = 0; + + // not requesting same refresh rate since changing res might not + // support same refresh rate at new size + + int *pCurDim = dimen; + + for (int i=0; i < numsizes; i++, pCurDim += 2) { + int x_size = pCurDim[0]; + int y_size = pCurDim[1]; + + bool bIsGoodMode = false; + bool CouldntFindAnyValidZBuf; + D3DFORMAT newPixFmt = D3DFMT_UNKNOWN; + + if (special_check_fullscreen_resolution(x_size, y_size)) { + // bypass the test below for certain cards we know have valid modes + bIsGoodMode=true; + + } else { + if (_dxgsg->scrn.bIsLowVidMemCard) { + bIsGoodMode = ((x_size == 640) && (y_size == 480)); + } else { + search_for_valid_displaymode(x_size, y_size, _dxgsg->scrn.PresParams.EnableAutoDepthStencil != false, + IS_STENCIL_FORMAT(_dxgsg->scrn.PresParams.AutoDepthStencilFormat), + &_dxgsg->scrn.SupportedScreenDepthsMask, + &CouldntFindAnyValidZBuf, &newPixFmt); + bIsGoodMode = (newPixFmt != D3DFMT_UNKNOWN); + } + } + + if (bIsGoodMode) { + num_valid_modes++; + } else { + // tell caller the mode is invalid + pCurDim[0] = 0; + pCurDim[1] = 0; + } + + if (wdxdisplay8_cat.is_spam()) { + wdxdisplay8_cat.spam() + << "Fullscrn Mode (" << x_size << "," << y_size << ")\t" + << (bIsGoodMode ? "V" : "Inv") <<"alid\n"; + } + } + + return num_valid_modes; } - + //////////////////////////////////////////////////////////////////// // Function: wdxGraphicsWindow8::begin_frame // Access: Public, Virtual diff --git a/panda/src/dxgsg8/wdxGraphicsWindow8.h b/panda/src/dxgsg8/wdxGraphicsWindow8.h index 02248e9c86..815bdbb717 100644 --- a/panda/src/dxgsg8/wdxGraphicsWindow8.h +++ b/panda/src/dxgsg8/wdxGraphicsWindow8.h @@ -45,6 +45,8 @@ public: virtual void make_gsg(); virtual void release_gsg(); + virtual int verify_window_sizes(int numsizes, int *dimen); + virtual bool begin_frame(); virtual void end_flip();