mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
fix nvidia 16bpp depth prob
This commit is contained in:
parent
396daaa3cb
commit
0067eb1d46
@ -2,25 +2,13 @@
|
|||||||
// Created by: mike (09Jan00)
|
// Created by: mike (09Jan00)
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Copyright (C) 1999-2000
|
|
||||||
// Walt Disney Imagineering, Inc.
|
|
||||||
//
|
|
||||||
// These coded instructions, statements, data structures and
|
|
||||||
// computer programs contain unpublished proprietary information of
|
|
||||||
// Walt Disney Imagineering and are protected by Federal copyright
|
|
||||||
// law. They may not be disclosed to third parties or copied or
|
|
||||||
// duplicated in any form, in whole or in part, without the prior
|
|
||||||
// written consent of Walt Disney Imagineering Inc.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Includes
|
// Includes
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
#ifndef STRICT
|
#ifndef STRICT
|
||||||
#define STRICT
|
#define STRICT
|
||||||
#endif
|
#endif
|
||||||
#define D3D_OVERLOADS
|
#define D3D_OVERLOADS
|
||||||
#define INITGUID
|
//#define INITGUID dont need this if linking w/dxguid.lib
|
||||||
#include <d3d.h>
|
#include <d3d.h>
|
||||||
#include "wdxGraphicsWindow.h"
|
#include "wdxGraphicsWindow.h"
|
||||||
#include "wdxGraphicsPipe.h"
|
#include "wdxGraphicsPipe.h"
|
||||||
@ -1077,13 +1065,12 @@ void wdxGraphicsWindow::config(void) {
|
|||||||
RECT win_rect;
|
RECT win_rect;
|
||||||
SetRect(&win_rect, _props._xorg, _props._yorg, _props._xorg + _props._xsize,
|
SetRect(&win_rect, _props._xorg, _props._yorg, _props._xorg + _props._xsize,
|
||||||
_props._yorg + _props._ysize);
|
_props._yorg + _props._ysize);
|
||||||
HWND desktop = GetDesktopWindow();
|
|
||||||
|
|
||||||
// rect now contains the coords for the entire window, not the client
|
// rect now contains the coords for the entire window, not the client
|
||||||
if (dx_full_screen) {
|
if (dx_full_screen) {
|
||||||
_mwindow = CreateWindow("wdxDisplay", _props._title.c_str(),
|
_mwindow = CreateWindow("wdxDisplay", _props._title.c_str(),
|
||||||
WS_POPUP, 0, 0, _props._xsize,_props._ysize,
|
WS_POPUP, 0, 0, _props._xsize,_props._ysize,
|
||||||
desktop, NULL, hinstance, 0);
|
NULL, NULL, hinstance, 0);
|
||||||
} else {
|
} else {
|
||||||
if (_props._border)
|
if (_props._border)
|
||||||
style = WS_OVERLAPPEDWINDOW;
|
style = WS_OVERLAPPEDWINDOW;
|
||||||
@ -1099,7 +1086,7 @@ void wdxGraphicsWindow::config(void) {
|
|||||||
_mwindow = CreateWindow("wdxDisplay", _props._title.c_str(),
|
_mwindow = CreateWindow("wdxDisplay", _props._title.c_str(),
|
||||||
style, win_rect.left, win_rect.top, win_rect.right-win_rect.left,
|
style, win_rect.left, win_rect.top, win_rect.right-win_rect.left,
|
||||||
win_rect.bottom-win_rect.top,
|
win_rect.bottom-win_rect.top,
|
||||||
desktop, NULL, hinstance, 0);
|
NULL, NULL, hinstance, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_mwindow) {
|
if (!_mwindow) {
|
||||||
@ -1133,7 +1120,7 @@ void wdxGraphicsWindow::config(void) {
|
|||||||
_input_devices.push_back(device);
|
_input_devices.push_back(device);
|
||||||
|
|
||||||
ShowWindow(_mwindow, SW_SHOWNORMAL);
|
ShowWindow(_mwindow, SW_SHOWNORMAL);
|
||||||
ShowWindow(_mwindow, SW_SHOWNORMAL);
|
ShowWindow(_mwindow, SW_SHOWNORMAL); // call twice to override STARTUPINFO value, which may be set to hidden initially by emacs
|
||||||
// UpdateWindow( _mwindow );
|
// UpdateWindow( _mwindow );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1204,13 +1191,18 @@ dx_setup()
|
|||||||
|
|
||||||
FreeLibrary(DDHinst); //undo LoadLib above, decrement ddrawl.dll refcnt (after DDrawCreate, since dont want to unload/reload)
|
FreeLibrary(DDHinst); //undo LoadLib above, decrement ddrawl.dll refcnt (after DDrawCreate, since dont want to unload/reload)
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
DDDEVICEIDENTIFIER2 dddi;
|
DDDEVICEIDENTIFIER2 dddi;
|
||||||
pDD->GetDeviceIdentifier(&dddi,0x0);
|
pDD->GetDeviceIdentifier(&dddi,0x0);
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
wdxdisplay_cat.debug()
|
wdxdisplay_cat.debug()
|
||||||
<< " GfxCard: " << dddi.szDescription << "; DriverVer: " << HIWORD(dddi.liDriverVersion.HighPart) << "." << LOWORD(dddi.liDriverVersion.HighPart) << "." << HIWORD(dddi.liDriverVersion.LowPart) << "." << LOWORD(dddi.liDriverVersion.LowPart) << endl;
|
<< " GfxCard: " << dddi.szDescription << "; VendorID: " <<dddi.dwVendorId <<"; DriverVer: " << HIWORD(dddi.liDriverVersion.HighPart) << "." << LOWORD(dddi.liDriverVersion.HighPart) << "." << HIWORD(dddi.liDriverVersion.LowPart) << "." << LOWORD(dddi.liDriverVersion.LowPart) << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// imperfect method to ID NVid, could also scan desc str, but that isnt fullproof either
|
||||||
|
BOOL bIsNvidia = (dddi.dwVendorId==4318) || (dddi.dwVendorId==4818);
|
||||||
|
|
||||||
// Query DirectDraw for access to Direct3D
|
// Query DirectDraw for access to Direct3D
|
||||||
|
|
||||||
hr = pDD->QueryInterface( IID_IDirect3D7, (VOID**)&pD3DI );
|
hr = pDD->QueryInterface( IID_IDirect3D7, (VOID**)&pD3DI );
|
||||||
@ -1357,9 +1349,7 @@ dx_setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Setup to create the primary surface w/backbuffer
|
// Setup to create the primary surface w/backbuffer
|
||||||
DDSURFACEDESC2 ddsd;
|
DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd)
|
||||||
ZeroMemory( &ddsd, sizeof(ddsd) );
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS|DDSD_BACKBUFFERCOUNT;
|
ddsd.dwFlags = DDSD_CAPS|DDSD_BACKBUFFERCOUNT;
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE |
|
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE |
|
||||||
DDSCAPS_FLIP | DDSCAPS_COMPLEX;
|
DDSCAPS_FLIP | DDSCAPS_COMPLEX;
|
||||||
@ -1503,12 +1493,6 @@ dx_setup()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
|
||||||
// pick the largest non-stencil zbuffer format avail (wont support stenciling
|
|
||||||
// until we definitely need it). Note: this is choosing to waste memory
|
|
||||||
// and possibly perf for more accuracy at long distance (std 16bpp would be smaller/
|
|
||||||
// maybe faster)
|
|
||||||
|
|
||||||
LPDDPIXELFORMAT pCurPixFmt,pz16=NULL,pz24=NULL,pz32=NULL;
|
LPDDPIXELFORMAT pCurPixFmt,pz16=NULL,pz24=NULL,pz32=NULL;
|
||||||
for(i=0,pCurPixFmt=ZBufPixFmts;i<cNumZBufFmts;i++,pCurPixFmt++) {
|
for(i=0,pCurPixFmt=ZBufPixFmts;i<cNumZBufFmts;i++,pCurPixFmt++) {
|
||||||
switch(pCurPixFmt->dwRGBBitCount) {
|
switch(pCurPixFmt->dwRGBBitCount) {
|
||||||
@ -1527,6 +1511,25 @@ dx_setup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(bIsNvidia) {
|
||||||
|
DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd_pri)
|
||||||
|
pPrimaryDDSurf->GetSurfaceDesc(&ddsd_pri);
|
||||||
|
|
||||||
|
// must pick zbuf depth to match primary surface depth for nvidia
|
||||||
|
if(ddsd_pri.ddpfPixelFormat.dwRGBBitCount==16) {
|
||||||
|
assert(pz16!=NULL);
|
||||||
|
ddsd.ddpfPixelFormat = *pz16;
|
||||||
|
} else {
|
||||||
|
assert(pz24!=NULL);
|
||||||
|
ddsd.ddpfPixelFormat = *pz24; //take the no-stencil version of the 32-bit Zbuf
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// pick the largest non-stencil zbuffer format avail (wont support stenciling
|
||||||
|
// until we definitely need it). Note: this is choosing to waste memory
|
||||||
|
// and possibly perf for more accuracy at long distance (std 16bpp would be smaller/
|
||||||
|
// maybe faster)
|
||||||
|
|
||||||
|
|
||||||
if(pz32!=NULL) {
|
if(pz32!=NULL) {
|
||||||
ddsd.ddpfPixelFormat = *pz32;
|
ddsd.ddpfPixelFormat = *pz32;
|
||||||
} else if(pz24!=NULL) {
|
} else if(pz24!=NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user