mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
add get_depth_bitwidth
This commit is contained in:
parent
c4cb56acff
commit
e0bc027a90
@ -626,6 +626,12 @@ verify_window_sizes(unsigned int numsizes,unsigned int *dimen) {
|
|||||||
return numsizes;
|
return numsizes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GraphicsWindow::
|
||||||
|
get_depth_bitwidth(void) {
|
||||||
|
display_cat.warning() << "get_depth_bitwidth() unimplemented by " << get_type() << endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void GraphicsWindow::deactivate_window(void) { return; }
|
void GraphicsWindow::deactivate_window(void) { return; }
|
||||||
void GraphicsWindow::reactivate_window(void) { return; }
|
void GraphicsWindow::reactivate_window(void) { return; }
|
||||||
|
|
||||||
|
@ -112,6 +112,8 @@ PUBLISHED:
|
|||||||
INLINE int get_xorg() const;
|
INLINE int get_xorg() const;
|
||||||
INLINE int get_yorg() const;
|
INLINE int get_yorg() const;
|
||||||
|
|
||||||
|
virtual int get_depth_bitwidth(void); // # of z bits/pixel
|
||||||
|
|
||||||
INLINE GraphicsStateGuardian *get_gsg() const;
|
INLINE GraphicsStateGuardian *get_gsg() const;
|
||||||
INLINE GraphicsPipe *get_pipe() const;
|
INLINE GraphicsPipe *get_pipe() const;
|
||||||
|
|
||||||
|
@ -1794,23 +1794,24 @@ CreateScreenBuffersAndDevice(DWORD dwRenderWidth, DWORD dwRenderHeight,LPDIRECTD
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SET_ZBUF_DEPTH(DEPTH) { assert(pz##DEPTH != NULL); _depth_buffer_bpp=DEPTH; ddsd.ddpfPixelFormat = *pz##DEPTH;}
|
||||||
|
|
||||||
if(IS_NVIDIA(_DXDeviceID)) {
|
if(IS_NVIDIA(_DXDeviceID)) {
|
||||||
DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd_pri)
|
DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd_pri)
|
||||||
pPrimaryDDSurf->GetSurfaceDesc(&ddsd_pri);
|
pPrimaryDDSurf->GetSurfaceDesc(&ddsd_pri);
|
||||||
|
|
||||||
// must pick zbuf depth to match primary surface depth for nvidia
|
// must pick zbuf depth to match primary surface depth for nvidia
|
||||||
if(ddsd_pri.ddpfPixelFormat.dwRGBBitCount==16) {
|
if(ddsd_pri.ddpfPixelFormat.dwRGBBitCount==16) {
|
||||||
assert(pz16!=NULL);
|
SET_ZBUF_DEPTH(16);
|
||||||
ddsd.ddpfPixelFormat = *pz16;
|
|
||||||
} else {
|
} else {
|
||||||
if(dx_force_16bpp_zbuffer) {
|
if(dx_force_16bpp_zbuffer) {
|
||||||
wdxdisplay_cat.fatal() << "'dx-force-16bpp-zbuffer #t' requires a 16bpp desktop on nvidia cards\n";
|
wdxdisplay_cat.fatal() << "'dx-force-16bpp-zbuffer #t' requires a 16bpp desktop on nvidia cards\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
// take the smaller of 24 or 32. (already assured to match stencil capability)
|
// take the smaller of 24 or 32. (already assured to match stencil capability)
|
||||||
if(pz24!=NULL)
|
if(pz24!=NULL) {
|
||||||
ddsd.ddpfPixelFormat = *pz24;
|
SET_ZBUF_DEPTH(24);
|
||||||
else ddsd.ddpfPixelFormat = *pz32;
|
} else SET_ZBUF_DEPTH(32);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(dx_force_16bpp_zbuffer) {
|
if(dx_force_16bpp_zbuffer) {
|
||||||
@ -1819,7 +1820,9 @@ CreateScreenBuffersAndDevice(DWORD dwRenderWidth, DWORD dwRenderHeight,LPDIRECTD
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(wdxdisplay_cat.is_debug())
|
||||||
wdxdisplay_cat.debug() << "forcing use of 16bpp Z-Buffer\n";
|
wdxdisplay_cat.debug() << "forcing use of 16bpp Z-Buffer\n";
|
||||||
|
SET_ZBUF_DEPTH(16);
|
||||||
ddsd.ddpfPixelFormat = *pz16;
|
ddsd.ddpfPixelFormat = *pz16;
|
||||||
} else {
|
} else {
|
||||||
// pick the highest res zbuffer format avail. Note: this is choosing to waste vid-memory
|
// pick the highest res zbuffer format avail. Note: this is choosing to waste vid-memory
|
||||||
@ -1829,15 +1832,14 @@ CreateScreenBuffersAndDevice(DWORD dwRenderWidth, DWORD dwRenderHeight,LPDIRECTD
|
|||||||
|
|
||||||
if(bWantStencil && (pz32!=NULL)) {
|
if(bWantStencil && (pz32!=NULL)) {
|
||||||
// dont want to select 16/8 z/stencil over 24/8 z/stenc
|
// dont want to select 16/8 z/stencil over 24/8 z/stenc
|
||||||
ddsd.ddpfPixelFormat = *pz32;
|
SET_ZBUF_DEPTH(32);
|
||||||
} else {
|
} else {
|
||||||
if(pz24!=NULL) {
|
if(pz24!=NULL) {
|
||||||
ddsd.ddpfPixelFormat = *pz24;
|
SET_ZBUF_DEPTH(24);
|
||||||
} else if(pz32!=NULL) {
|
} else if(pz32!=NULL) {
|
||||||
ddsd.ddpfPixelFormat = *pz32;
|
SET_ZBUF_DEPTH(32);
|
||||||
} else {
|
} else {
|
||||||
assert(pz16!=NULL);
|
SET_ZBUF_DEPTH(16);
|
||||||
ddsd.ddpfPixelFormat = *pz16;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2292,6 +2294,19 @@ lookup_key(WPARAM wparam) const {
|
|||||||
return ButtonHandle::none();
|
return ButtonHandle::none();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wdxGraphicsWindow::
|
||||||
|
get_depth_bitwidth(void) {
|
||||||
|
if((_dxgsg==NULL) || (_dxgsg->_zbuf==NULL))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return _depth_buffer_bpp;
|
||||||
|
|
||||||
|
// this is not reliable, on GF2, GetSurfDesc returns 32bpp when you created a 24bpp zbuf
|
||||||
|
// DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd);
|
||||||
|
// _dxgsg->_zbuf->GetSurfaceDesc(&ddsd);
|
||||||
|
// return ddsd.ddpfPixelFormat.dwRGBBitCount;
|
||||||
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
|
@ -83,6 +83,7 @@ public:
|
|||||||
|
|
||||||
virtual void resize(unsigned int xsize,unsigned int ysize);
|
virtual void resize(unsigned int xsize,unsigned int ysize);
|
||||||
virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen);
|
virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen);
|
||||||
|
virtual int get_depth_bitwidth(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void CreateScreenBuffersAndDevice(LPDIRECTDRAW7 pDD,LPDIRECT3D7 pD3DI);
|
void CreateScreenBuffersAndDevice(LPDIRECTDRAW7 pDD,LPDIRECT3D7 pD3DI);
|
||||||
@ -119,6 +120,7 @@ private:
|
|||||||
bool _window_inactive;
|
bool _window_inactive;
|
||||||
bool _active_minimized_fullscreen;
|
bool _active_minimized_fullscreen;
|
||||||
bool _return_control_to_app;
|
bool _return_control_to_app;
|
||||||
|
int _depth_buffer_bpp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static TypeHandle get_class_type(void);
|
static TypeHandle get_class_type(void);
|
||||||
|
@ -336,6 +336,7 @@ void wglGraphicsWindow::config(void) {
|
|||||||
_pCurrent_display_settings = NULL;
|
_pCurrent_display_settings = NULL;
|
||||||
_mwindow = NULL;
|
_mwindow = NULL;
|
||||||
_gsg = NULL;
|
_gsg = NULL;
|
||||||
|
ZeroMemory(&_pixelformat,sizeof(_pixelformat));
|
||||||
_hOldForegroundWindow=GetForegroundWindow();
|
_hOldForegroundWindow=GetForegroundWindow();
|
||||||
|
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
@ -1338,6 +1339,10 @@ void wglGraphicsWindow::unmake_current(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wglGraphicsWindow::get_depth_bitwidth(void) {
|
||||||
|
return _pixelformat.cDepthBits;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: wglGraphicsWindow::get_gsg_type
|
// Function: wglGraphicsWindow::get_gsg_type
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -68,6 +68,7 @@ public:
|
|||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
virtual void end_frame( void );
|
virtual void end_frame( void );
|
||||||
virtual void swap( void );
|
virtual void swap( void );
|
||||||
|
virtual int get_depth_bitwidth(void);
|
||||||
|
|
||||||
virtual TypeHandle get_gsg_type() const;
|
virtual TypeHandle get_gsg_type() const;
|
||||||
static GraphicsWindow* make_wglGraphicsWindow(const FactoryParams ¶ms);
|
static GraphicsWindow* make_wglGraphicsWindow(const FactoryParams ¶ms);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user