From 6133582801001990c8e474765df7c83a803cb140 Mon Sep 17 00:00:00 2001 From: cxgeorge <> Date: Wed, 1 May 2002 23:08:04 +0000 Subject: [PATCH] detect 8.1 rite --- panda/src/dxgsg8/dxgsg8base.h | 4 ++++ panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/panda/src/dxgsg8/dxgsg8base.h b/panda/src/dxgsg8/dxgsg8base.h index adc8c60f22..d0e7718a91 100644 --- a/panda/src/dxgsg8/dxgsg8base.h +++ b/panda/src/dxgsg8/dxgsg8base.h @@ -61,6 +61,8 @@ #endif #endif +typedef DWORD DXShaderHandle; + #define ISPOW2(X) (((X) & ((X)-1))==0) #define IS_VALID_PTR(PTR) (!IsBadWritePtr(PTR,sizeof(void*))) @@ -184,6 +186,8 @@ typedef struct { ushort depth_buffer_bitdepth; //GetSurfaceDesc is not reliable so must store this explicitly bool bIsLowVidMemCard; bool bIsTNLDevice; + bool bCanUseHWVertexShaders; + bool bCanUsePixelShaders; bool bIsDX81; UINT SupportedScreenDepthsMask; UINT SupportedTexFmtsMask; diff --git a/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx b/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx index fb6b2b2ddc..0229256c6c 100644 --- a/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx +++ b/panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx @@ -2156,9 +2156,13 @@ bool wdxGraphicsWindow::search_for_device(LPDIRECT3D8 pD3D8,DXDeviceInfo *pDevIn wdxdisplay_cat.fatal() << "Stencil ability requested, but device #" << pDevInfo->cardID << " (" << _dxgsg->scrn.DXDeviceID.Description<<"), has no stencil capability!\n"; exit(1); } + + // just because TNL is true, it doesnt mean vtx shaders are supported in HW (see GF2) + // for this case, you probably want MIXED processing to use HW for fixed-fn vertex processing + // and SW for vtx shaders _dxgsg->scrn.bIsTNLDevice=((d3dcaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)!=0); - - + _dxgsg->scrn.bCanUseHWVertexShaders = (d3dcaps.VertexShaderVersion < D3DVS_VERSION(1,0)); + _dxgsg->scrn.bCanUsePixelShaders = (d3dcaps.PixelShaderVersion < D3DPS_VERSION(1,0)); bool bNeedZBuffer = ((!(d3dcaps.RasterCaps & D3DPRASTERCAPS_ZBUFFERLESSHSR )) && (_props._mask & W_DEPTH)); @@ -2369,7 +2373,6 @@ CreateScreenBuffersAndDevice(DXScreenData &Display) { } pPresParams->Windowed = !_props._fullscreen; - DWORD dwBehaviorFlags=0x0; if(dx_multisample_antialiasing_level>1) { // need to check both rendertarget and zbuffer fmts @@ -2400,6 +2403,7 @@ CreateScreenBuffersAndDevice(DXScreenData &Display) { pPresParams->hDeviceWindow = Display.hWnd; pPresParams->BackBufferWidth = Display.DisplayMode.Width; pPresParams->BackBufferHeight = Display.DisplayMode.Height; + DWORD dwBehaviorFlags=0x0; if(_dxgsg->scrn.bIsTNLDevice) { dwBehaviorFlags|=D3DCREATE_HARDWARE_VERTEXPROCESSING; @@ -3083,9 +3087,12 @@ void wdxGraphicsWindowGroup::initWindowGroup(void) { #define D3D_SDK_VERSION_8_1 220 // are we using 8.0 or 8.1? - WIN32_FIND_DATA FindFileData; - HANDLE hFind = FindFirstFile("dpnhpast.dll",&FindFileData); // this dll exists on 8.1 but not 8.0 - + WIN32_FIND_DATA TempFindData; + HANDLE hFind; + char tmppath[MAX_PATH]; + GetSystemDirectory(tmppath,MAX_PATH); + strcat(tmppath,"\\dpnhpast.dll"); + hFind = FindFirstFile ( tmppath,&TempFindData ); if(hFind != INVALID_HANDLE_VALUE) { FindClose(hFind); _bIsDX81=true;