mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
@ -2070,78 +2070,6 @@ void plClient::IAddRenderRequest(plRenderRequest* req)
|
||||
}
|
||||
}
|
||||
|
||||
hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
|
||||
{
|
||||
hsStatusMessage("Load DevMode client\n");
|
||||
HWND hWnd = fWindowHndl;
|
||||
|
||||
hsUNIXStream stream;
|
||||
bool gottaCreate = false;
|
||||
|
||||
// If DevModeFind is specified, use the old method
|
||||
// if ((GetGameFlags() & kDevModeFind))
|
||||
// FindAndSaveDevMode(hWnd, devModeFile);
|
||||
// Otherwise, use the new method
|
||||
hsG3DDeviceModeRecord dmr;
|
||||
if (stream.Open(devModeFile, "rb"))
|
||||
{
|
||||
/// It's there, but is the device record valid?
|
||||
hsG3DDeviceRecord selRec;
|
||||
hsG3DDeviceMode selMode;
|
||||
|
||||
selRec.Read(&stream);
|
||||
if( selRec.IsInvalid() )
|
||||
{
|
||||
hsStatusMessage( "WARNING: Old DeviceRecord found on file. Setting defaults..." );
|
||||
gottaCreate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Read the rest in
|
||||
selMode.Read(&stream);
|
||||
|
||||
uint16_t performance = stream.ReadLE16();
|
||||
|
||||
if( performance < 25 )
|
||||
plBitmap::SetGlobalLevelChopCount( 2 );
|
||||
else if( performance < 75 )
|
||||
plBitmap::SetGlobalLevelChopCount( 1 );
|
||||
else
|
||||
plBitmap::SetGlobalLevelChopCount( 0 );
|
||||
}
|
||||
stream.Close();
|
||||
|
||||
dmr = hsG3DDeviceModeRecord(selRec, selMode);
|
||||
}
|
||||
else
|
||||
gottaCreate = true;
|
||||
|
||||
if( gottaCreate )
|
||||
{
|
||||
|
||||
hsG3DDeviceSelector devSel;
|
||||
devSel.Enumerate(hWnd);
|
||||
devSel.RemoveUnusableDevModes(true);
|
||||
|
||||
if (!devSel.GetDefault(&dmr))
|
||||
{
|
||||
//hsAssert(0, "plGame::LoadDevMode - No acceptable hardware found");
|
||||
hsMessageBox("No suitable rendering devices found.","realMYST",hsMessageBoxNormal);
|
||||
return dmr;
|
||||
}
|
||||
|
||||
if (stream.Open(devModeFile, "wb"))
|
||||
{
|
||||
dmr.GetDevice()->Write(&stream);
|
||||
dmr.GetMode()->Write(&stream);
|
||||
stream.WriteLE16((uint16_t)(0*100));
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
}
|
||||
return dmr;
|
||||
}
|
||||
|
||||
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, bool Windowed, int NumAASamples, int MaxAnisotropicSamples, bool VSync)
|
||||
{
|
||||
if(!fPipeline) return;
|
||||
@ -2235,11 +2163,6 @@ void plClient::IDetectAudioVideoSettings()
|
||||
const hsG3DDeviceMode *mode = dmr.GetMode();
|
||||
|
||||
bool pixelshaders = rec->GetCap(hsG3DDeviceSelector::kCapsPixelShader);
|
||||
int psMajor = 0, psMinor = 0;
|
||||
rec->GetPixelShaderVersion(psMajor, psMinor);
|
||||
bool refDevice = false;
|
||||
if(rec->GetG3DHALorHEL() == hsG3DDeviceSelector::kHHD3DRefDev)
|
||||
refDevice = true;
|
||||
|
||||
plPipeline::fDefaultPipeParams.ColorDepth = hsG3DDeviceSelector::kDefaultDepth;
|
||||
#if defined(HS_DEBUGGING) || defined(DEBUG)
|
||||
@ -2260,53 +2183,20 @@ void plClient::IDetectAudioVideoSettings()
|
||||
plPipeline::fDefaultPipeParams.Height = hsG3DDeviceSelector::kDefaultHeight;
|
||||
}
|
||||
|
||||
plPipeline::fDefaultPipeParams.Shadows = 0;
|
||||
// enable shadows if TnL is available, meaning not an intel extreme.
|
||||
if(rec->GetG3DHALorHEL() == hsG3DDeviceSelector::kHHD3DTnLHalDev)
|
||||
plPipeline::fDefaultPipeParams.Shadows = 1;
|
||||
plPipeline::fDefaultPipeParams.Shadows = 1;
|
||||
|
||||
// enable planar reflections if pixelshaders are available
|
||||
if(pixelshaders && !refDevice)
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.PlanarReflections = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.PlanarReflections = 0;
|
||||
}
|
||||
|
||||
// enable 2x antialiasing and anisotropic to 2 samples if pixelshader version is greater that 2.0
|
||||
if(psMajor >= 2 && !refDevice)
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount = rec->GetMaxAnisotropicSamples() ? 2 : 0;
|
||||
plPipeline::fDefaultPipeParams.AnisotropicLevel = mode->GetNumFSAATypes() ? 2 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount = 0;
|
||||
plPipeline::fDefaultPipeParams.AnisotropicLevel = 0;
|
||||
}
|
||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount = rec->GetMaxAnisotropicSamples() ? 2 : 0;
|
||||
plPipeline::fDefaultPipeParams.AnisotropicLevel = mode->GetNumFSAATypes() ? 2 : 0;
|
||||
|
||||
if(refDevice)
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.TextureQuality = 0;
|
||||
plPipeline::fDefaultPipeParams.VideoQuality = 0;
|
||||
plPipeline::fDefaultPipeParams.TextureQuality = pixelshaders ? 2 : 1;
|
||||
plPipeline::fDefaultPipeParams.VideoQuality = pixelshaders ? 2 : 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.TextureQuality = psMajor >= 2 ? 2 : 1;
|
||||
plPipeline::fDefaultPipeParams.VideoQuality = pixelshaders ? 2 : 1;
|
||||
}
|
||||
plPipeline::fDefaultPipeParams.VSync = false;
|
||||
|
||||
// card specific overrides
|
||||
if(rec->GetDriverDesc() && strstr(rec->GetDriverDesc(), "FX 5200"))
|
||||
{
|
||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount = 0;
|
||||
}
|
||||
|
||||
|
||||
int val = 0;
|
||||
hsStream *stream = nil;
|
||||
hsUNIXStream s;
|
||||
|
@ -135,8 +135,6 @@ protected:
|
||||
|
||||
pfGameGUIMgr *fGameGUIMgr;
|
||||
|
||||
virtual hsG3DDeviceModeRecord ILoadDevMode(const char* devModeFile);
|
||||
|
||||
bool IUpdate();
|
||||
bool IDraw();
|
||||
bool IDrawProgress();
|
||||
|
@ -53,16 +53,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
#include <ddraw.h>
|
||||
#include <d3d9.h>
|
||||
# include "hsWindows.h"
|
||||
# include <ddraw.h>
|
||||
# include <d3d9.h>
|
||||
#endif
|
||||
|
||||
#include "hsDXTDirectXCodec.h"
|
||||
#include "hsColorRGBA.h"
|
||||
#include "plMipmap.h"
|
||||
#include "hsCodecManager.h"
|
||||
#include "plPipeline/hsGDDrawDllLoad.h"
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
namespace {
|
||||
@ -144,26 +147,20 @@ bool hsDXTDirectXCodec::IInitialize()
|
||||
{
|
||||
fFlags |= kInitialized;
|
||||
|
||||
// if( hsGDDrawDllLoad::GetDDrawDll() == nil )
|
||||
// return false;
|
||||
|
||||
DIRECTDRAWCREATEEX DirectDrawCreateEx = 0;
|
||||
DIRECTDRAWCREATEEX DirectDrawCreateEx = nullptr;
|
||||
|
||||
// Initialize DirectDraw
|
||||
HRESULT hr;
|
||||
DirectDrawCreateEx = (DIRECTDRAWCREATEEX)GetProcAddress( hsGDDrawDllLoad::GetD3DDll(), "DirectDrawCreateEx" );
|
||||
if( DirectDrawCreateEx == nil )
|
||||
std::unique_ptr<HINSTANCE__, std::function<BOOL(HMODULE)>> ddraw(LoadLibraryA("ddraw.dll"), FreeLibrary);
|
||||
DirectDrawCreateEx = (DIRECTDRAWCREATEEX)GetProcAddress(ddraw.get(), "DirectDrawCreateEx");
|
||||
if (!DirectDrawCreateEx)
|
||||
return false;
|
||||
|
||||
/// Using EMULATIONONLY here usually fails--using NULL forces the
|
||||
/// use of the standard display driver, which DOES work.
|
||||
if (FAILED(hr = DirectDrawCreateEx((GUID FAR *)NULL/*DDCREATE_EMULATIONONLY*/, (VOID**)&fDirectDraw, IID_IDirectDraw7, NULL)))
|
||||
if (FAILED(DirectDrawCreateEx((GUID FAR *)NULL/*DDCREATE_EMULATIONONLY*/, (VOID**)&fDirectDraw, IID_IDirectDraw7, NULL)))
|
||||
return false;
|
||||
|
||||
if (FAILED(hr = fDirectDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return SUCCEEDED(fDirectDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,6 @@ endif(WIN32)
|
||||
set(plPipeline_SOURCES
|
||||
hsG3DDeviceSelector.cpp
|
||||
hsGColorizer.cpp
|
||||
hsGDDrawDllLoad.cpp
|
||||
plCaptureRender.cpp
|
||||
plCubicRenderTargetModifier.cpp
|
||||
plCullTree.cpp
|
||||
@ -33,6 +32,7 @@ set(plPipeline_SOURCES
|
||||
)
|
||||
|
||||
set(plDXPipeline_SOURCES
|
||||
DX/hsGDirect3D.cpp
|
||||
DX/plDXDeviceRefs.cpp
|
||||
DX/plDXEnumerate.cpp
|
||||
DX/plDXPipeline.cpp
|
||||
@ -46,7 +46,6 @@ set(plPipeline_HEADERS
|
||||
hsFogControl.h
|
||||
hsG3DDeviceSelector.h
|
||||
hsGColorizer.h
|
||||
hsGDDrawDllLoad.h
|
||||
hsGDeviceRef.h
|
||||
hsWinRef.h
|
||||
plBinkPlayer.h
|
||||
@ -75,6 +74,7 @@ set(plPipeline_HEADERS
|
||||
)
|
||||
|
||||
set(plDXPipeline_HEADERS
|
||||
DX/hsGDirect3D.h
|
||||
DX/plDXBufferRefs.h
|
||||
DX/plDXDeviceRef.h
|
||||
DX/plDXEnumerate.h
|
||||
@ -91,6 +91,7 @@ set(plDXPipeline_HEADERS
|
||||
|
||||
if(WIN32)
|
||||
add_library(plPipeline STATIC ${plPipeline_SOURCES} ${plDXPipeline_SOURCES} ${plPipeline_HEADERS} ${plDXPipeline_HEADERS})
|
||||
target_link_libraries(plPipeline ${DirectX_LIBRARIES})
|
||||
else()
|
||||
add_library(plPipeline STATIC ${plPipeline_SOURCES} ${plPipeline_HEADERS})
|
||||
endif()
|
||||
|
@ -40,39 +40,43 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
#include "hsGDirect3D.h"
|
||||
#include "plDXEnumerate.h"
|
||||
|
||||
#include "hsWindows.h"
|
||||
#include <d3d9.h>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include <ddraw.h>
|
||||
|
||||
#include "hsGDDrawDllLoad.h"
|
||||
|
||||
static hsGDDrawDllLoad staticDllLoad;
|
||||
|
||||
hsGDDrawDllLoad::hsGDDrawDllLoad()
|
||||
static std::unique_ptr<hsGDirect3DTnLEnumerate> s_tnlEnum;
|
||||
hsGDirect3DTnLEnumerate& hsGDirect3D::EnumerateTnL(bool reenum)
|
||||
{
|
||||
hsAssert(!staticDllLoad.fD3DDll, "Don't make instances of this class, just use GetDDrawDll func");
|
||||
if (reenum || !s_tnlEnum.get())
|
||||
s_tnlEnum.reset(new hsGDirect3DTnLEnumerate());
|
||||
|
||||
fD3DDll = LoadLibrary( "D3D9.DLL" );
|
||||
if (fD3DDll)
|
||||
hsStatusMessage( "--- D3D9.DLL loaded successfully.\n" );
|
||||
else
|
||||
hsStatusMessage( "--- Unable to load D3D9.DLL successfully.\n" );
|
||||
// Be nice to legacy code and return a reference...
|
||||
hsGDirect3DTnLEnumerate* ptr = s_tnlEnum.get();
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
hsGDDrawDllLoad::~hsGDDrawDllLoad()
|
||||
void hsGDirect3D::ReleaseTnLEnum()
|
||||
{
|
||||
if (fD3DDll != nil)
|
||||
{
|
||||
hsStatusMessage( "--- Unloading D3D.DLL.\n" );
|
||||
FreeLibrary(fD3DDll);
|
||||
s_tnlEnum.release();
|
||||
}
|
||||
|
||||
static void IDeleteDirect3D(IDirect3D9* d3d)
|
||||
{
|
||||
while (d3d->Release()) { }
|
||||
}
|
||||
|
||||
static std::unique_ptr<IDirect3D9, std::function<void(IDirect3D9*)>> s_direct3d(nullptr, IDeleteDirect3D);
|
||||
IDirect3D9* hsGDirect3D::GetDirect3D(bool recreate)
|
||||
{
|
||||
if (recreate || !s_direct3d.get()) {
|
||||
IDirect3D9* ptr = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
hsAssert(ptr, "failed to create Direct3D");
|
||||
|
||||
s_direct3d.reset(ptr);
|
||||
}
|
||||
return s_direct3d.get();
|
||||
}
|
||||
|
||||
HMODULE hsGDDrawDllLoad::GetD3DDll()
|
||||
{
|
||||
return staticDllLoad.fD3DDll;
|
||||
}
|
||||
|
||||
#endif //HS_BUILD_FOR_WIN32
|
@ -40,23 +40,21 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef hsGDDrawDllLoad_inc
|
||||
#define hsGDDrawDllLoad_inc
|
||||
#ifndef _hsGDirect3D_inc_
|
||||
#define _hsGDirect3D_inc_
|
||||
|
||||
#include "HeadSpin.h"
|
||||
class hsGDirect3DTnLEnumerate;
|
||||
struct IDirect3D9;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
class hsGDDrawDllLoad
|
||||
namespace hsGDirect3D
|
||||
{
|
||||
private:
|
||||
HMODULE fD3DDll;
|
||||
hsGDirect3DTnLEnumerate& EnumerateTnL(bool reenum=false);
|
||||
void ReleaseTnLEnum();
|
||||
|
||||
public:
|
||||
hsGDDrawDllLoad();
|
||||
~hsGDDrawDllLoad();
|
||||
/** Get a root Direct3D object.
|
||||
* \remarks You should not hold this pointer.
|
||||
*/
|
||||
IDirect3D9* GetDirect3D(bool recreate=false);
|
||||
}
|
||||
|
||||
static HMODULE GetD3DDll();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // hsGDDrawDllLoad_inc
|
||||
#endif // _hsGDirect3D_inc_
|
@ -39,11 +39,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plDXEnumerate.h"
|
||||
#include <ddraw.h>
|
||||
|
||||
#include "plPipeline/hsGDDrawDllLoad.h"
|
||||
#include "plDXEnumerate.h"
|
||||
#include "plPipeline/hsG3DDeviceSelector.h"
|
||||
#include "hsGDirect3D.h"
|
||||
|
||||
|
||||
//// Local Typedefs ///////////////////////////////////////////////////////////
|
||||
@ -102,9 +101,6 @@ HRESULT hsGDirect3DTnLEnumerate::SelectFromDevMode(const hsG3DDeviceRecord* devR
|
||||
if( !colorDepth )
|
||||
enumFlags |= D3DENUM_CANWINDOW;
|
||||
enumFlags |= D3DENUM_TNLHAL;
|
||||
#ifdef HS_ALLOW_D3D_REF_DRIVER
|
||||
enumFlags |= D3DENUM_REFERENCERAST;
|
||||
#endif
|
||||
|
||||
D3DEnum_SelectDefaultDriver(enumFlags);
|
||||
|
||||
@ -219,8 +215,7 @@ HRESULT hsGDirect3DTnLEnumerate::D3DEnum_SelectDefaultDriver( DWORD dwFlags )
|
||||
{
|
||||
if( dwFlags & D3DENUM_CANWINDOW )
|
||||
{
|
||||
if( (pDriver == &fDrivers[0])
|
||||
&&( pDevice->fDDCaps.Caps2 & DDCAPS2_CANRENDERWINDOWED ) )
|
||||
if( (pDriver == &fDrivers[0]) )
|
||||
{
|
||||
if( ( pDevice->fDDCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
|
||||
^ !(dwFlags & D3DENUM_TNLHAL) )
|
||||
@ -286,27 +281,9 @@ hsGDirect3DTnLEnumerate::hsGDirect3DTnLEnumerate()
|
||||
fCurrentDriver = NULL; // The selected DD driver
|
||||
fDrivers.Reset(); // List of DD drivers
|
||||
|
||||
|
||||
/// New DX Enumeration
|
||||
|
||||
// Get a pointer to the creation function
|
||||
if( hsGDDrawDllLoad::GetD3DDll() == nil )
|
||||
{
|
||||
strcpy( fEnumeErrorStr, "Cannot load Direct3D driver!" );
|
||||
return;
|
||||
}
|
||||
|
||||
Direct3DCreateProc procPtr;
|
||||
procPtr = (Direct3DCreateProc)GetProcAddress( hsGDDrawDllLoad::GetD3DDll(), "Direct3DCreate9" );
|
||||
if( procPtr == nil )
|
||||
{
|
||||
strcpy( fEnumeErrorStr, "Cannot load D3D Create Proc!" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a D3D object to use
|
||||
IDirect3D9 *pD3D = procPtr( D3D_SDK_VERSION );
|
||||
if( pD3D == nil )
|
||||
IDirect3D9* pD3D = hsGDirect3D::GetDirect3D();
|
||||
if (!pD3D)
|
||||
{
|
||||
strcpy( fEnumeErrorStr, "Cannot load DirectX!" );
|
||||
return;
|
||||
@ -333,9 +310,6 @@ hsGDirect3DTnLEnumerate::hsGDirect3DTnLEnumerate()
|
||||
/// Do the mode and device enumeration for this adapter
|
||||
IEnumAdapterDevices( pD3D, iAdapter, newDriver );
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
pD3D->Release();
|
||||
}
|
||||
|
||||
//// IEnumAdapterDevices //////////////////////////////////////////////////////
|
||||
@ -391,12 +365,7 @@ void hsGDirect3DTnLEnumerate::IEnumAdapterDevices( IDirect3D9 *pD3D, UINT iAd
|
||||
/// Confirm that HW vertex processing works on this device
|
||||
if (deviceInfo->fDDCaps.DevCaps & D3DDEVCAPS_PUREDEVICE)
|
||||
{
|
||||
#if 0
|
||||
behavior[iFormat] = D3DCREATE_HARDWARE_VERTEXPROCESSING |
|
||||
D3DCREATE_PUREDEVICE;
|
||||
#else
|
||||
behavior[iFormat] = D3DCREATE_HARDWARE_VERTEXPROCESSING;
|
||||
#endif
|
||||
if (SUCCEEDED(IConfirmDevice(&deviceInfo->fDDCaps, behavior[iFormat],
|
||||
currFormat)))
|
||||
{
|
||||
@ -662,16 +631,6 @@ bool hsG3DDeviceSelector::IGetD3DCardInfo( hsG3DDeviceRecord &record,
|
||||
|
||||
adapterInfo = &driverD3DInfo->fAdapterInfo;
|
||||
|
||||
/// Print out to our demo data file
|
||||
plDemoDebugFile::Write( "DeviceSelector detected DX Direct3D device. Info:" );
|
||||
plDemoDebugFile::Write( " Driver Description", (char *)adapterInfo->Description );
|
||||
plDemoDebugFile::Write( " Driver Name", (char *)adapterInfo->Driver );
|
||||
plDemoDebugFile::Write( " Vendor ID", (int32_t)adapterInfo->VendorId );
|
||||
plDemoDebugFile::Write( " Device ID", (int32_t)adapterInfo->DeviceId );
|
||||
plDemoDebugFile::Write( " Version", (char *)record.GetDriverVersion() );
|
||||
plDemoDebugFile::Write( " Memory size (in MB)", record.GetMemoryBytes() / ( 1024 * 1024 ) );
|
||||
plDemoDebugFile::Write( " Memory size (in bytes)", record.GetMemoryBytes() );
|
||||
|
||||
*vendorID = adapterInfo->VendorId;
|
||||
*deviceID = adapterInfo->DeviceId;
|
||||
*driverString = adapterInfo->Driver;
|
||||
@ -680,42 +639,11 @@ bool hsG3DDeviceSelector::IGetD3DCardInfo( hsG3DDeviceRecord &record,
|
||||
return true;
|
||||
}
|
||||
|
||||
//// IInitDirect3D ////////////////////////////////////////////////////////////
|
||||
|
||||
bool hsG3DDeviceSelector::IInitDirect3D( void )
|
||||
{
|
||||
if( hsGDDrawDllLoad::GetD3DDll() == nil )
|
||||
{
|
||||
strcpy( fErrorString, "Cannot load Direct3D driver!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
Direct3DCreateProc procPtr;
|
||||
procPtr = (Direct3DCreateProc)GetProcAddress( hsGDDrawDllLoad::GetD3DDll(), "Direct3DCreate9" );
|
||||
if( procPtr == nil )
|
||||
{
|
||||
strcpy( fErrorString, "Cannot load D3D Create Proc!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create a D3D object to use
|
||||
IDirect3D9 *pD3D = procPtr( D3D_SDK_VERSION );
|
||||
if( pD3D == nil )
|
||||
{
|
||||
strcpy( fErrorString, "Cannot load DirectX!" );
|
||||
return false;
|
||||
}
|
||||
pD3D->Release();
|
||||
|
||||
fErrorString[ 0 ] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
//// ITryDirect3DTnL //////////////////////////////////////////////////////////
|
||||
|
||||
void hsG3DDeviceSelector::ITryDirect3DTnL(hsWinRef winRef)
|
||||
{
|
||||
hsGDirect3DTnLEnumerate d3dEnum;
|
||||
hsGDirect3DTnLEnumerate& d3dEnum = hsGDirect3D::EnumerateTnL();
|
||||
|
||||
int i;
|
||||
for( i = 0; i < d3dEnum.GetNumDrivers(); i++ )
|
||||
@ -732,7 +660,7 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDriver(D3DEnum_DriverInfo* drivInfo)
|
||||
{
|
||||
hsG3DDeviceRecord devRec;
|
||||
devRec.Clear();
|
||||
devRec.SetG3DDeviceType( kDevTypeDirect3DTnL );
|
||||
devRec.SetG3DDeviceType( kDevTypeDirect3D );
|
||||
|
||||
devRec.SetDriverName( drivInfo->fAdapterInfo.Driver );
|
||||
devRec.SetDriverDesc( drivInfo->fAdapterInfo.Description );
|
||||
@ -758,29 +686,6 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDriver(D3DEnum_DriverInfo* drivInfo)
|
||||
|
||||
/// Done first now, so we can alter the D3D type later
|
||||
ITryDirect3DTnLDevice( &drivInfo->fDevices[i], currDevRec );
|
||||
|
||||
/// Check the vendor ID to see if it's 3dfx (#0x121a). If it is, don't add it.
|
||||
/// (we don't support 3dfx D3D devices) -mcn
|
||||
/// 11.25.2000 mcn - Knew this was going to come back and bite me. Now we just
|
||||
/// append (3dfx) to the end of the device description, so that our latter test
|
||||
/// can throw it out or not, depending on whether we're "strong".
|
||||
|
||||
if( drivInfo->fAdapterInfo.VendorId == 0x121a &&
|
||||
( currDevRec.GetG3DHALorHEL() == hsG3DDeviceSelector::kHHD3DHALDev ||
|
||||
currDevRec.GetG3DHALorHEL() == hsG3DDeviceSelector::kHHD3DTnLHalDev ) )
|
||||
{
|
||||
if( drivInfo->fAdapterInfo.DeviceId >= 0x00000009 )
|
||||
{
|
||||
currDevRec.SetG3DHALorHEL( kHHD3D3dfxVoodoo5Dev );
|
||||
plDemoDebugFile::Write( " Tagging device as a 3dfx Voodoo5 or above" );
|
||||
}
|
||||
else
|
||||
{
|
||||
currDevRec.SetG3DHALorHEL( kHHD3D3dfxDev );
|
||||
plDemoDebugFile::Write( " Tagging device as a non-V5 3dfx card" );
|
||||
}
|
||||
}
|
||||
|
||||
IFudgeDirectXDevice( currDevRec, (D3DEnum_DriverInfo *)drivInfo, (D3DEnum_DeviceInfo *)&drivInfo->fDevices[ i ] );
|
||||
|
||||
if( currDevRec.GetModes().GetCount() )
|
||||
@ -822,10 +727,6 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG
|
||||
devRec.SetCap(kCapsPerspective);
|
||||
if( devInfo->fIsHardware )
|
||||
devRec.SetCap( kCapsHardware );
|
||||
if( devInfo->fDDCaps.RasterCaps & D3DPRASTERCAPS_DITHER )
|
||||
devRec.SetCap(kCapsDither);
|
||||
if( devInfo->fDDCaps.RasterCaps & D3DPRASTERCAPS_WBUFFER )
|
||||
devRec.SetCap(kCapsWBuffer);
|
||||
if( devInfo->fDDCaps.RasterCaps & D3DPRASTERCAPS_FOGTABLE )
|
||||
{
|
||||
devRec.SetCap( kCapsFogLinear );
|
||||
|
@ -121,8 +121,6 @@ class hsG3DDeviceMode;
|
||||
class hsGDirect3DTnLEnumerate
|
||||
{
|
||||
protected:
|
||||
HMODULE fDDrawDLL;
|
||||
|
||||
char fEnumeErrorStr[128]; // <20>h<EFBFBD><68><EFBFBD>C<EFBFBD>o<EFBFBD>A<EFBFBD>f<EFBFBD>o<EFBFBD>C<EFBFBD>X<EFBFBD>G<F18B9383><47><EFBFBD>[<5B><><EFBFBD>b<EFBFBD>Z<EFBFBD>[<5B>W<EFBFBD>i<EFBFBD>[<5B>o<EFBFBD>b<EFBFBD>t<EFBFBD>@
|
||||
|
||||
hsTArray<D3DEnum_DriverInfo> fDrivers;
|
||||
|
@ -55,8 +55,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsWindows.h"
|
||||
|
||||
#include <d3d9.h>
|
||||
#include <ddraw.h>
|
||||
#include <d3dx9mesh.h>
|
||||
#include "hsGDirect3D.h"
|
||||
|
||||
#if defined(DX_OLD_SDK) || defined(__MINGW32__)
|
||||
#include <dxerr9.h>
|
||||
@ -78,7 +78,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plPipeline/plDebugText.h"
|
||||
#include "plDXEnumerate.h"
|
||||
#include "plPipeline/hsG3DDeviceSelector.h"
|
||||
#include "plPipeline/hsGDDrawDllLoad.h"
|
||||
#include "hsResMgr.h"
|
||||
#include "plPipeline/plStatusLogDrawer.h"
|
||||
#include "plQuality.h"
|
||||
@ -625,7 +624,7 @@ plDXPipeline::plDXPipeline( hsWinRef hWnd, const hsG3DDeviceModeRecord *devModeR
|
||||
else
|
||||
fSettings.fNumAASamples = devMode->GetFSAAType( devRec->GetAASetting() - 1 );
|
||||
|
||||
hsGDirect3DTnLEnumerate d3dEnum;
|
||||
hsGDirect3DTnLEnumerate& d3dEnum = hsGDirect3D::EnumerateTnL();
|
||||
if( d3dEnum.GetEnumeErrorStr()[ 0 ] )
|
||||
{
|
||||
IShowErrorMessage( (char *)d3dEnum.GetEnumeErrorStr() );
|
||||
@ -638,16 +637,6 @@ plDXPipeline::plDXPipeline( hsWinRef hWnd, const hsG3DDeviceModeRecord *devModeR
|
||||
return;
|
||||
}
|
||||
|
||||
// Gotta create this very first, so that the device/driver init works
|
||||
if( !fD3DObject )
|
||||
{
|
||||
if( ICreateMaster() )
|
||||
{
|
||||
IShowErrorMessage( "Cannot create D3D master object" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Record the requested mode/setup.
|
||||
ISetCurrentDriver( d3dEnum.GetCurrentDriver() );
|
||||
ISetCurrentDevice( d3dEnum.GetCurrentDevice() );
|
||||
@ -695,6 +684,8 @@ plDXPipeline::plDXPipeline( hsWinRef hWnd, const hsG3DDeviceModeRecord *devModeR
|
||||
plStatusLog::AddLineS("pipeline.log", "%d, %d, %d", temp[i].Width, temp[i].Height, 32);
|
||||
}*/
|
||||
|
||||
// We don't need the TnL enumeration for the lifetime of the game, so say goodbye!
|
||||
hsGDirect3D::ReleaseTnLEnum();
|
||||
}
|
||||
|
||||
// Cleanup - Most happens in IReleaseDeviceObject().
|
||||
@ -722,7 +713,7 @@ plDXPipeline::~plDXPipeline()
|
||||
// built from. For example, the fD3DObject pointer is set to nil so that it's safe
|
||||
// to delete or set to a valid pointer. It must be set to a valid pointer
|
||||
// before the pipeline can be used for much.
|
||||
// After the core initialization is done (in ICreateMaster and ICreateDeviceObjects)
|
||||
// After the core initialization is done (in ICreateDeviceObjects)
|
||||
// render state will be initialized in IInitDeviceState.
|
||||
|
||||
void plDXPipeline::IClearMembers()
|
||||
@ -774,7 +765,6 @@ void plDXPipeline::IClearMembers()
|
||||
fBlurVBuffers[i] = nil;
|
||||
fBlurVSHandle = 0;
|
||||
|
||||
fD3DObject = nil;
|
||||
fD3DDevice = nil;
|
||||
fD3DBackBuff = nil;
|
||||
fD3DDepthSurface = nil;
|
||||
@ -892,7 +882,6 @@ void plDXGeneralSettings::Reset()
|
||||
fNoGammaCorrect = false;
|
||||
fMaxUVWSrc = 8;
|
||||
fCantProj = false;
|
||||
fLimitedProj = false;
|
||||
fBadManaged = false;
|
||||
fShareDepth = false;
|
||||
fCurrAnisotropy = false;
|
||||
@ -931,7 +920,7 @@ void plDXPipeline::IInitDeviceState()
|
||||
|
||||
fD3DDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_LESSEQUAL );
|
||||
fD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
|
||||
fD3DDevice->SetRenderState( D3DRS_ZENABLE, ( fSettings.fD3DCaps & kCapsWBuffer ) ? D3DZB_USEW : D3DZB_TRUE );
|
||||
fD3DDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
|
||||
fD3DDevice->SetRenderState( D3DRS_CLIPPING, TRUE );
|
||||
fD3DDevice->SetRenderState( D3DRS_CULLMODE, fCurrCullMode );
|
||||
ISetCullMode();
|
||||
@ -943,7 +932,7 @@ void plDXPipeline::IInitDeviceState()
|
||||
fD3DDevice->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, ( fSettings.fD3DCaps & kCapsFSAntiAlias ) ? TRUE : FALSE );
|
||||
fD3DDevice->SetRenderState( D3DRS_ANTIALIASEDLINEENABLE, FALSE );
|
||||
|
||||
fD3DDevice->SetRenderState( D3DRS_DITHERENABLE, ( fSettings.fD3DCaps & kCapsDither ) ? TRUE : FALSE );
|
||||
fD3DDevice->SetRenderState( D3DRS_DITHERENABLE, FALSE );
|
||||
fD3DDevice->SetRenderState( D3DRS_SPECULARENABLE, FALSE );
|
||||
fD3DDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
|
||||
fCurrD3DLiteState = false;
|
||||
@ -1040,10 +1029,6 @@ void plDXPipeline::ISetCaps()
|
||||
fSettings.fD3DCaps |= kCapsMipmap;
|
||||
if (fCurrentDevice->fDDCaps.TextureCaps & D3DPTEXTURECAPS_MIPCUBEMAP)
|
||||
fSettings.fD3DCaps |= kCapsCubicMipmap;
|
||||
if (fCurrentDevice->fDDCaps.RasterCaps & D3DPRASTERCAPS_WBUFFER)
|
||||
fSettings.fD3DCaps |= kCapsWBuffer;
|
||||
if (fCurrentDevice->fDDCaps.RasterCaps & D3DPRASTERCAPS_DITHER)
|
||||
fSettings.fD3DCaps |= kCapsDither;
|
||||
if (fSettings.fNumAASamples > 0)
|
||||
fSettings.fD3DCaps |= kCapsFSAntiAlias;
|
||||
if (fCurrentDevice->fDDCaps.RasterCaps & D3DPRASTERCAPS_WFOG)
|
||||
@ -1167,16 +1152,8 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
||||
fSettings.fD3DCaps &= ~kCapsMipmap;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsCubicMipmap ) )
|
||||
fSettings.fD3DCaps &= ~kCapsCubicMipmap;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsWBuffer ) )
|
||||
fSettings.fD3DCaps &= ~kCapsWBuffer;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsZBias ) )
|
||||
fSettings.fD3DCaps &= ~kCapsZBias;
|
||||
// if( !devRec.GetCap( hsG3DDeviceSelector::kCapsHWTransform ) )
|
||||
// fSettings.fD3DCaps &= ~kCapsHWTransform;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsDither ) )
|
||||
fSettings.fD3DCaps &= ~kCapsDither;
|
||||
// if( devRec.GetAASetting() == 0 )
|
||||
// fSettings.fD3DCaps &= ~kCapsFSAntiAlias;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsFogExp ) )
|
||||
fSettings.fD3DCaps &= ~kCapsExpFog;
|
||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsCubicTextures ) )
|
||||
@ -1187,8 +1164,6 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
||||
|
||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsCantProj) )
|
||||
fSettings.fCantProj = true;
|
||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsLimitedProj) )
|
||||
fSettings.fLimitedProj = true;
|
||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsBadManaged) )
|
||||
fSettings.fBadManaged = true;
|
||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsShareDepth) )
|
||||
@ -1204,11 +1179,6 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
||||
if( devRec.GetCap( hsG3DDeviceSelector::kCapsBadYonStuff ) )
|
||||
fSettings.fD3DCaps |= kCapsHasBadYonStuff;
|
||||
|
||||
/// 10.31.2000 mcn - Flag for can't-handle-under-8-pixel-dimensions-on-textures
|
||||
/// (see, isn't the name flag actually better in retrospect? :)
|
||||
if( devRec.GetCap( hsG3DDeviceSelector::kCapsNoKindaSmallTexs ) )
|
||||
fSettings.fD3DCaps |= kCapsNoKindaSmallTexs;
|
||||
|
||||
/// Note: the following SHOULD be here, but we later detect for texture
|
||||
/// formats and reset this flag. It should only be set if it is set already,
|
||||
/// but that means ensuring it's set beforehand, which it might not be.
|
||||
@ -1270,15 +1240,8 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
||||
fManagedCutoff = 1;
|
||||
}
|
||||
|
||||
//// Our temp debug flag to force z-buffering...
|
||||
if( !( fDbgSetupInitFlags & 0x00000001 ) )
|
||||
fSettings.fD3DCaps &= ~kCapsWBuffer;
|
||||
|
||||
/// Set up the z-bias scale values, based on z- or w-buffering
|
||||
if( fSettings.fD3DCaps & kCapsWBuffer )
|
||||
fTweaks.fDefaultPerspLayerScale = kPerspLayerScaleW;
|
||||
else
|
||||
fTweaks.fDefaultPerspLayerScale = kPerspLayerScale;
|
||||
/// Set up the z-bias scale values
|
||||
fTweaks.fDefaultPerspLayerScale = kPerspLayerScale;
|
||||
|
||||
|
||||
// Less than 4 layers at once means we have to fallback on uv bumpmapping
|
||||
@ -1417,11 +1380,13 @@ void plDXPipeline::ISetCurrentDriver( D3DEnum_DriverInfo *driv )
|
||||
fCurrentDriver->fCurrentDevice = nil;
|
||||
|
||||
/// Go looking for an adapter to match this one
|
||||
IDirect3D9* d3d = hsGDirect3D::GetDirect3D();
|
||||
UINT iAdapter;
|
||||
for( fCurrentAdapter = 0, iAdapter = 0; iAdapter < fD3DObject->GetAdapterCount(); iAdapter++ )
|
||||
|
||||
for( fCurrentAdapter = 0, iAdapter = 0; iAdapter < d3d->GetAdapterCount(); iAdapter++ )
|
||||
{
|
||||
D3DADAPTER_IDENTIFIER9 adapterInfo;
|
||||
fD3DObject->GetAdapterIdentifier( iAdapter, 0, &adapterInfo );
|
||||
d3d->GetAdapterIdentifier( iAdapter, 0, &adapterInfo );
|
||||
|
||||
if( adapterInfo.DeviceIdentifier == fCurrentDriver->fAdapterInfo.DeviceIdentifier )
|
||||
{
|
||||
@ -1498,9 +1463,9 @@ bool plDXPipeline::IFindCompressedFormats()
|
||||
|
||||
for( i = 0; toCheckFor[ i ] != D3DFMT_UNKNOWN; i++ )
|
||||
{
|
||||
if( FAILED( fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType,
|
||||
fCurrentMode->fDDmode.Format,
|
||||
0, D3DRTYPE_TEXTURE, toCheckFor[ i ] ) ) )
|
||||
if( FAILED( hsGDirect3D::GetDirect3D()->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType,
|
||||
fCurrentMode->fDDmode.Format,
|
||||
0, D3DRTYPE_TEXTURE, toCheckFor[ i ] ) ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1520,9 +1485,9 @@ bool plDXPipeline::IFindLuminanceFormats()
|
||||
|
||||
for( i = 0; toCheckFor[ i ] != D3DFMT_UNKNOWN; i++ )
|
||||
{
|
||||
if( FAILED( fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType,
|
||||
fCurrentMode->fDDmode.Format,
|
||||
0, D3DRTYPE_TEXTURE, toCheckFor[ i ] ) ) )
|
||||
if (FAILED(hsGDirect3D::GetDirect3D()->CheckDeviceFormat(fCurrentAdapter, fCurrentDevice->fDDType,
|
||||
fCurrentMode->fDDmode.Format,
|
||||
0, D3DRTYPE_TEXTURE, toCheckFor[ i ] ) ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1537,9 +1502,9 @@ bool plDXPipeline::IFindLuminanceFormats()
|
||||
|
||||
bool plDXPipeline::ITextureFormatAllowed( D3DFORMAT format )
|
||||
{
|
||||
if( FAILED( fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType,
|
||||
fCurrentMode->fDDmode.Format,
|
||||
0, D3DRTYPE_TEXTURE, format ) ) )
|
||||
if (FAILED( hsGDirect3D::GetDirect3D()->CheckDeviceFormat(fCurrentAdapter, fCurrentDevice->fDDType,
|
||||
fCurrentMode->fDDmode.Format,
|
||||
0, D3DRTYPE_TEXTURE, format ) ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -1584,32 +1549,6 @@ bool plDXPipeline::IsDebugFlagSet( uint32_t flag ) const
|
||||
//// Device Creation //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//// ICreateMaster ////////////////////////////////////////////////////////////
|
||||
// Creates the master Direct3D objects. I guess just in case you want
|
||||
// multiple Direct3D devices.... :~
|
||||
|
||||
bool plDXPipeline::ICreateMaster()
|
||||
{
|
||||
hsAssert( !fD3DObject, "ICreateMaster() should only be called for Master Direct3DDevice" );
|
||||
|
||||
/// The new DirectX Way: Create a Direct3D object, out of which everything else springs
|
||||
if( hsGDDrawDllLoad::GetD3DDll() == nil )
|
||||
return ICreateFail( "Cannot load Direct3D driver!" );
|
||||
|
||||
Direct3DCreateProc procPtr;
|
||||
procPtr = (Direct3DCreateProc)GetProcAddress( hsGDDrawDllLoad::GetD3DDll(), "Direct3DCreate9" );
|
||||
if( procPtr == nil )
|
||||
return ICreateFail( "Cannot load D3D Create Proc!" );
|
||||
|
||||
// Create a D3D object to use
|
||||
fD3DObject = procPtr( D3D_SDK_VERSION );
|
||||
|
||||
if( fD3DObject == nil )
|
||||
return ICreateFail( "Cannot create Direct3D object" );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//// ICreateDevice ////////////////////////////////////////////////////
|
||||
//
|
||||
// Creates the device. Surfaces, buffers, etc. created separately (in case of lost device).
|
||||
@ -1625,7 +1564,11 @@ bool plDXPipeline::ICreateDevice(bool windowed)
|
||||
char msg[ 256 ];
|
||||
#endif // DBG_WRITE_FORMATS
|
||||
|
||||
INIT_ERROR_CHECK( fD3DObject->GetAdapterDisplayMode( fCurrentAdapter, &dispMode ),
|
||||
IDirect3D9* d3d = hsGDirect3D::GetDirect3D();
|
||||
if (!d3d)
|
||||
return ICreateFail("Failed to get Direct3D Object");
|
||||
|
||||
INIT_ERROR_CHECK( d3d->GetAdapterDisplayMode( fCurrentAdapter, &dispMode ),
|
||||
"Cannot get desktop display mode" );
|
||||
|
||||
// save desktop properties
|
||||
@ -1722,10 +1665,10 @@ bool plDXPipeline::ICreateDevice(bool windowed)
|
||||
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
UINT adapter;
|
||||
for (adapter = 0; adapter < fD3DObject->GetAdapterCount(); adapter++)
|
||||
for (adapter = 0; adapter < d3d->GetAdapterCount(); adapter++)
|
||||
{
|
||||
D3DADAPTER_IDENTIFIER9 id;
|
||||
fD3DObject->GetAdapterIdentifier(adapter, 0, &id);
|
||||
d3d->GetAdapterIdentifier(adapter, 0, &id);
|
||||
|
||||
// We should be matching against "NVIDIA NVPerfHUD", but the space
|
||||
// in the description seems to be bogus. This seems to be a fair
|
||||
@ -1743,9 +1686,9 @@ bool plDXPipeline::ICreateDevice(bool windowed)
|
||||
}
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
|
||||
INIT_ERROR_CHECK( fD3DObject->CreateDevice( fCurrentAdapter, fCurrentDevice->fDDType,
|
||||
fSettings.fHWnd, fCurrentMode->fDDBehavior,
|
||||
¶ms, &fD3DDevice ),
|
||||
INIT_ERROR_CHECK( d3d->CreateDevice( fCurrentAdapter, fCurrentDevice->fDDType,
|
||||
fSettings.fHWnd, fCurrentMode->fDDBehavior,
|
||||
¶ms, &fD3DDevice ),
|
||||
"Cannot create primary display surface via CreateDevice()" );
|
||||
|
||||
fSettings.fPresentParams = params;
|
||||
@ -1774,6 +1717,8 @@ bool plDXPipeline::ICreateDevice(bool windowed)
|
||||
// will work.
|
||||
bool plDXPipeline::IFindDepthFormat(D3DPRESENT_PARAMETERS& params)
|
||||
{
|
||||
IDirect3D9* d3d = hsGDirect3D::GetDirect3D();
|
||||
|
||||
// Okay, we're not using the stencil buffer right now, and it's bringing out
|
||||
// some painful driver bugs on the GeForce2. So rather than go out of our way
|
||||
// looking for trouble, we're going to look for a depth buffer with NO STENCIL.
|
||||
@ -1785,11 +1730,11 @@ bool plDXPipeline::IFindDepthFormat(D3DPRESENT_PARAMETERS& params)
|
||||
||(fmt == D3DFMT_D24X8)
|
||||
||(fmt == D3DFMT_D16) )
|
||||
{
|
||||
HRESULT hr = fD3DObject->CheckDeviceMultiSampleType(fCurrentAdapter,
|
||||
fCurrentDevice->fDDType,
|
||||
fmt,
|
||||
fCurrentMode->fWindowed ? TRUE : FALSE,
|
||||
params.MultiSampleType, NULL);
|
||||
HRESULT hr = d3d->CheckDeviceMultiSampleType(fCurrentAdapter,
|
||||
fCurrentDevice->fDDType,
|
||||
fmt,
|
||||
fCurrentMode->fWindowed ? TRUE : FALSE,
|
||||
params.MultiSampleType, NULL);
|
||||
if( !FAILED(hr) )
|
||||
{
|
||||
params.AutoDepthStencilFormat = fmt;
|
||||
@ -1805,11 +1750,11 @@ bool plDXPipeline::IFindDepthFormat(D3DPRESENT_PARAMETERS& params)
|
||||
D3DFORMAT fmt = fCurrentMode->fDepthFormats[ i ];
|
||||
if( fmt == D3DFMT_D15S1 || fmt == D3DFMT_D24X4S4 || fmt == D3DFMT_D24S8 )
|
||||
{
|
||||
HRESULT hr = fD3DObject->CheckDeviceMultiSampleType(fCurrentAdapter,
|
||||
fCurrentDevice->fDDType,
|
||||
fmt,
|
||||
fCurrentMode->fWindowed ? TRUE : FALSE,
|
||||
params.MultiSampleType, NULL);
|
||||
HRESULT hr = d3d->CheckDeviceMultiSampleType(fCurrentAdapter,
|
||||
fCurrentDevice->fDDType,
|
||||
fmt,
|
||||
fCurrentMode->fWindowed ? TRUE : FALSE,
|
||||
params.MultiSampleType, NULL);
|
||||
if( !FAILED(hr) )
|
||||
{
|
||||
params.AutoDepthStencilFormat = fmt;
|
||||
@ -2071,16 +2016,6 @@ void plDXPipeline::IReleaseDeviceObjects()
|
||||
fD3DDevice = nil;
|
||||
}
|
||||
|
||||
if( fD3DObject != nil )
|
||||
{
|
||||
LONG ret;
|
||||
while( ret = fD3DObject->Release() )
|
||||
{
|
||||
hsStatusMessageF("%d - Error releasing Direct3D Object", ret);
|
||||
}
|
||||
fD3DObject = nil;
|
||||
}
|
||||
|
||||
fManagedAlloced = false;
|
||||
fAllocUnManaged = false;
|
||||
}
|
||||
@ -2579,13 +2514,10 @@ void plDXPipeline::Resize( uint32_t width, uint32_t height )
|
||||
}
|
||||
|
||||
// Recreate
|
||||
if( !fD3DObject )
|
||||
if( hsGDirect3D::GetDirect3D(true) )
|
||||
{
|
||||
if( ICreateMaster() )
|
||||
{
|
||||
IShowErrorMessage( "Cannot create D3D master object" );
|
||||
return;
|
||||
}
|
||||
IShowErrorMessage( "Cannot create D3D master object" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Go recreate surfaces and DX-dependent objects
|
||||
@ -3920,9 +3852,7 @@ bool plDXPipeline::BeginRender()
|
||||
}
|
||||
|
||||
// Superfluous setting of Z state.
|
||||
fD3DDevice->SetRenderState( D3DRS_ZENABLE,
|
||||
( fView.IsPerspective() && ( fSettings.fD3DCaps & kCapsWBuffer ) )
|
||||
? D3DZB_USEW : D3DZB_TRUE );
|
||||
fD3DDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
|
||||
|
||||
/// If we have a renderTarget active, use its viewport
|
||||
ISetViewport();
|
||||
@ -4820,6 +4750,7 @@ bool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
||||
uint16_t flags, width, height;
|
||||
int8_t bitDepth, zDepth, stencilDepth, stencilIndex;
|
||||
D3DFORMAT depthFormats[] = { D3DFMT_D24X8, D3DFMT_D24X4S4, D3DFMT_D24S8 };
|
||||
IDirect3D9* d3d = hsGDirect3D::GetDirect3D();
|
||||
|
||||
|
||||
flags = owner->GetFlags();
|
||||
@ -4886,8 +4817,8 @@ bool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
||||
}
|
||||
|
||||
/// Check the device format
|
||||
if( FAILED( fSettings.fDXError = fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||
if( FAILED( fSettings.fDXError = d3d->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||
{
|
||||
if( bitDepth == 16 )
|
||||
{
|
||||
@ -4899,8 +4830,8 @@ bool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
||||
bitDepth = 16;
|
||||
surfFormat = D3DFMT_A4R4G4B4;
|
||||
}
|
||||
if( FAILED( fSettings.fDXError = fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||
if( FAILED( fSettings.fDXError = d3d->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||
{
|
||||
IGetD3DError();
|
||||
return false;
|
||||
@ -4909,8 +4840,8 @@ bool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
||||
|
||||
if( zDepth )
|
||||
{
|
||||
while( FAILED( fSettings.fDXError = fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, depthFormat ) ) )
|
||||
while( FAILED( fSettings.fDXError = d3d->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, depthFormat ) ) )
|
||||
{
|
||||
if( stencilIndex < sizeof( depthFormats ) / sizeof( depthFormats[ 0 ] ) - 1 )
|
||||
{
|
||||
@ -4924,8 +4855,8 @@ bool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
||||
}
|
||||
}
|
||||
|
||||
if( FAILED( fSettings.fDXError = fD3DObject->CheckDepthStencilMatch( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
surfFormat, depthFormat ) ) )
|
||||
if( FAILED( fSettings.fDXError = d3d->CheckDepthStencilMatch( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
surfFormat, depthFormat ) ) )
|
||||
{
|
||||
IGetD3DError();
|
||||
return false;
|
||||
@ -4952,6 +4883,7 @@ bool plDXPipeline::IFindRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
||||
height = owner->GetHeight();
|
||||
bitDepth = owner->GetPixelSize();
|
||||
|
||||
IDirect3D9* d3d = hsGDirect3D::GetDirect3D();
|
||||
if( flags != 0 )
|
||||
{
|
||||
if( flags & plRenderTarget::kIsTexture )
|
||||
@ -4972,8 +4904,8 @@ bool plDXPipeline::IFindRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
||||
}
|
||||
|
||||
/// Check the device format
|
||||
if( FAILED( fSettings.fDXError = fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||
if( FAILED( fSettings.fDXError = d3d->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||
{
|
||||
if( bitDepth == 16 )
|
||||
{
|
||||
@ -4985,8 +4917,8 @@ bool plDXPipeline::IFindRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
||||
bitDepth = 16;
|
||||
surfFormat = D3DFMT_A4R4G4B4;
|
||||
}
|
||||
if( FAILED( fSettings.fDXError = fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||
if( FAILED( fSettings.fDXError = d3d->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||
{
|
||||
IGetD3DError();
|
||||
return false;
|
||||
@ -8702,11 +8634,6 @@ bool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, uint32_t &numLevels,
|
||||
{
|
||||
uint32_t sizeMask = 0x03;
|
||||
|
||||
/// 10.31.2000 - If we have this flag set, we really have to cut out
|
||||
/// sizes under 8x8. So far only true on the KYRO...
|
||||
if( fSettings.fD3DCaps & kCapsNoKindaSmallTexs )
|
||||
sizeMask = 0x07;
|
||||
|
||||
int maxLevel = mipmap->GetNumLevels() - 1;
|
||||
|
||||
/// 9.7.2000 - Also do this test if the card doesn't support
|
||||
@ -9722,34 +9649,15 @@ hsMatrix44 plDXPipeline::IGetCameraToNDC()
|
||||
// is [x/w, y/w, z/w + t/s, 1/sw]
|
||||
|
||||
|
||||
if( fSettings.fD3DCaps & kCapsWBuffer )
|
||||
{
|
||||
// W-buffering is only true w-buffering on 3dfx cards. On everything else,
|
||||
// they REALLY base it off the Z value. So we want to scale (but NOT translate)
|
||||
// the Z...
|
||||
// Note: the base value for perspLayerScale should be 0.001 for w-buffering,
|
||||
// not the normal 0.00001
|
||||
float scale = 1.f - float(fCurrRenderLayer) * fTweaks.fPerspLayerScale;
|
||||
float scale = 1.f - float(fCurrRenderLayer) * fTweaks.fPerspLayerScale;
|
||||
float zTrans = -scale * float(fCurrRenderLayer) * fTweaks.fPerspLayerTrans;
|
||||
|
||||
cam2ndc.fMap[0][0] *= scale;
|
||||
cam2ndc.fMap[1][1] *= scale;
|
||||
cam2ndc.fMap[2][2] *= scale;
|
||||
cam2ndc.fMap[3][2] *= scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Z-buffering, so do it the traditional way
|
||||
float scale = 1.f - float(fCurrRenderLayer) * fTweaks.fPerspLayerScale;
|
||||
// scale = -1.f;
|
||||
float zTrans = -scale * float(fCurrRenderLayer) * fTweaks.fPerspLayerTrans;
|
||||
cam2ndc.fMap[0][0] *= scale;
|
||||
cam2ndc.fMap[1][1] *= scale;
|
||||
|
||||
cam2ndc.fMap[0][0] *= scale;
|
||||
cam2ndc.fMap[1][1] *= scale;
|
||||
|
||||
cam2ndc.fMap[2][2] *= scale;
|
||||
cam2ndc.fMap[2][2] += zTrans * cam2ndc.fMap[3][2];
|
||||
cam2ndc.fMap[3][2] *= scale;
|
||||
}
|
||||
cam2ndc.fMap[2][2] *= scale;
|
||||
cam2ndc.fMap[2][2] += zTrans * cam2ndc.fMap[3][2];
|
||||
cam2ndc.fMap[3][2] *= scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -11417,9 +11325,6 @@ void plDXPipeline::IRenderProjectionEach(const plRenderPrimFunc& render, hsGMate
|
||||
|
||||
int iNextPass = iPass + fCurrNumLayers;
|
||||
|
||||
if( fSettings.fLimitedProj && (material->GetLayer(iPass)->GetUVWSrc() & ~plLayerInterface::kUVWIdxMask) )
|
||||
return;
|
||||
|
||||
// For each projector:
|
||||
int k;
|
||||
for( k = 0; k < fLights.fProjEach.GetCount(); k++ )
|
||||
@ -12248,12 +12153,6 @@ void plDXPipeline::SubmitShadowSlave(plShadowSlave* slave)
|
||||
if( !(slave && slave->fCaster && slave->fCaster->GetKey()) )
|
||||
return;
|
||||
|
||||
// A board with limited projection capability (i.e. GeForce1) can't
|
||||
// do perspective shadows (from point source lights) because it
|
||||
// requires a count3 uvw on 2 texture units (0,1) simultaneously. Just skip.
|
||||
if( (fSettings.fLimitedProj || fSettings.fCantProj) && slave->fView.GetPerspective() )
|
||||
return;
|
||||
|
||||
// Ref the shadow caster so we're sure it will still be around when we go to
|
||||
// render it.
|
||||
slave->fCaster->GetKey()->RefObject();
|
||||
|
@ -187,21 +187,17 @@ protected:
|
||||
kCapsExpFog = 0x00000040,
|
||||
kCapsExp2Fog = 0x00000080,
|
||||
kCapsRangeFog = 0x00000100,
|
||||
kCapsWBuffer = 0x00000200,
|
||||
kCapsTexBoundToStage = 0x00000400,
|
||||
kCapsDither = 0x00000800,
|
||||
kCapsLODWatch = 0x00001000,
|
||||
kCapsFSAntiAlias = 0x00002000,
|
||||
kCapsLuminanceTextures = 0x00004000,
|
||||
kCapsDoesSmallTextures = 0x00008000,
|
||||
kCapsDoesWFog = 0x00010000,
|
||||
kCapsPixelFog = 0x00020000,
|
||||
kCapsHasBadYonStuff = 0x00040000,
|
||||
kCapsNoKindaSmallTexs = 0x00080000,
|
||||
kCapsNpotTextures = 0x00100000,
|
||||
|
||||
kCapsCubicTextures = 0x00200000,
|
||||
kCapsCubicMipmap = 0x00400000
|
||||
kCapsTexBoundToStage = 0x00000200,
|
||||
kCapsLODWatch = 0x00000400,
|
||||
kCapsFSAntiAlias = 0x00000800,
|
||||
kCapsLuminanceTextures = 0x00001000,
|
||||
kCapsDoesSmallTextures = 0x00002000,
|
||||
kCapsDoesWFog = 0x00004000,
|
||||
kCapsPixelFog = 0x00008000,
|
||||
kCapsHasBadYonStuff = 0x00010000,
|
||||
kCapsNpotTextures = 0x00020000,
|
||||
kCapsCubicTextures = 0x00040000,
|
||||
kCapsCubicMipmap = 0x00080000
|
||||
};
|
||||
enum {
|
||||
kKNone = 0x0,
|
||||
@ -212,7 +208,6 @@ protected:
|
||||
plDXPlateManager* fPlateMgr;
|
||||
|
||||
// The main D3D interfaces
|
||||
LPDIRECT3D9 fD3DObject; // The main D3D object
|
||||
LPDIRECT3DDEVICE9 fD3DDevice; // The D3D rendering device
|
||||
IDirect3DSurface9* fD3DMainSurface;
|
||||
IDirect3DSurface9* fD3DDepthSurface;
|
||||
@ -506,7 +501,6 @@ protected:
|
||||
void ISetCurrentDevice( D3DEnum_DeviceInfo *dev );
|
||||
void ISetCurrentMode( D3DEnum_ModeInfo *mode );
|
||||
|
||||
bool ICreateMaster();
|
||||
bool ICreateDevice(bool windowed);
|
||||
bool ICreateNormalSurfaces();
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -69,9 +69,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define DYNAHEADER 1
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
|
||||
/// #define the following to allow selection of the D3D reference driver
|
||||
#define HS_ALLOW_D3D_REF_DRIVER 1
|
||||
|
||||
|
||||
class hsStream;
|
||||
struct D3DEnum_DeviceInfo;
|
||||
@ -127,9 +124,6 @@ public:
|
||||
void AddFSAAType( uint8_t type ) { fFSAATypes.Append( type ); }
|
||||
|
||||
void SetCanRenderToCubics( bool can ) { fCanRenderToCubics = can; }
|
||||
|
||||
void Read(hsStream* s);
|
||||
void Write(hsStream* s) const;
|
||||
};
|
||||
|
||||
class hsG3DDeviceRecord
|
||||
@ -149,24 +143,6 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
uint32_t fRecordVersion; /// Version starts at 2 (see .cpp for explanation)
|
||||
enum {
|
||||
kCurrRecordVersion = 0x0b
|
||||
/// Version history:
|
||||
/// 1 - Initial version (had no version #)
|
||||
/// 2 - Added Z and LOD bias
|
||||
/// 3 - Changed Z and LOD bias to floats, added fog tweaks
|
||||
/// 4 - Changed values for fog tweaks; force reload through version #
|
||||
/// 5 - Same as #4, updated fog end bias to be based solely on fog quantization/bit depth
|
||||
/// 6 - Updated values for the ATI boards, Matrox, and i810
|
||||
/// 7 - Added fog knee tweaks
|
||||
/// 8 - Added support for multiple depth/stencil formats per mode
|
||||
/// 9 - Added multisample types to the mode record
|
||||
/// A - Added anisotropic sample field
|
||||
/// B - Added flag for cubic textures support
|
||||
};
|
||||
|
||||
/// Version < 2 Data
|
||||
uint32_t fFlags;
|
||||
|
||||
uint32_t fG3DDeviceType;
|
||||
@ -184,7 +160,6 @@ protected:
|
||||
|
||||
hsTArray<hsG3DDeviceMode> fModes;
|
||||
|
||||
/// New to Version 3
|
||||
float fZBiasRating;
|
||||
float fLODBiasRating;
|
||||
float fFogExpApproxStart;
|
||||
@ -193,17 +168,12 @@ protected:
|
||||
// (i.e. for Z fog, it's a percentage of 1 to add on,
|
||||
// for W fog, it's a percentage of the yon)
|
||||
|
||||
/// Version 7 - Fog Knee values
|
||||
float fFogKnees[ kNumFogTypes ];
|
||||
float fFogKneeVals[ kNumFogTypes ];
|
||||
|
||||
/// Version 9 - The actual AA setting we use
|
||||
uint8_t fAASetting;
|
||||
|
||||
/// Version A - the anisotropic level we use
|
||||
uint8_t fMaxAnisotropicSamples; // 1 to disable, up to max allowed in hardware
|
||||
int fPixelShaderMajorVer;
|
||||
int fPixelShaderMinorVer;
|
||||
|
||||
public:
|
||||
hsG3DDeviceRecord();
|
||||
@ -274,17 +244,6 @@ public:
|
||||
void ClearModes();
|
||||
void Clear();
|
||||
void RemoveDiscarded();
|
||||
|
||||
// PlaceHolder - Whether a mode can window is restricted by the current setup
|
||||
// of the PC. E.g. if the user changes from 16 bit to TrueColor, the Modes that
|
||||
// can window are pretty much flipped. So we'll have to pass in enough info (like
|
||||
// the hWnd?) to find out what the current setup is to make sure it's compatible.
|
||||
bool ModeCanWindow(void* ctx, hsG3DDeviceMode* mode) { return false; }
|
||||
void SetPixelShaderVersion(int major, int minor) { fPixelShaderMajorVer = major; fPixelShaderMinorVer = minor; }
|
||||
void GetPixelShaderVersion(int &major, int &minor) { major = fPixelShaderMajorVer; minor = fPixelShaderMinorVer; }
|
||||
|
||||
void Read(hsStream* s);
|
||||
void Write(hsStream* s) const;
|
||||
};
|
||||
|
||||
class hsG3DDeviceModeRecord
|
||||
@ -309,47 +268,34 @@ class hsG3DDeviceSelector : public hsRefCnt
|
||||
public:
|
||||
enum {
|
||||
kDevTypeUnknown = 0,
|
||||
kDevTypeGlide,
|
||||
kDevTypeDirect3D,
|
||||
kDevTypeOpenGL,
|
||||
kDevTypeDirect3DTnL,
|
||||
|
||||
kNumDevTypes
|
||||
};
|
||||
enum {
|
||||
kHHTypeUnknown = 0,
|
||||
kHHD3DNullDev,
|
||||
kHHD3DRampDev,
|
||||
kHHD3DRGBDev,
|
||||
kHHD3DHALDev,
|
||||
kHHD3DMMXDev,
|
||||
kHHD3DTnLHalDev,
|
||||
kHHD3DRefDev,
|
||||
kHHD3D3dfxDev,
|
||||
kHHD3D3dfxVoodoo5Dev,
|
||||
|
||||
kNumHHTypes
|
||||
};
|
||||
enum {
|
||||
kCapsNone = 0,
|
||||
kCapsNoWindow,
|
||||
kCapsMipmap,
|
||||
kCapsPerspective,
|
||||
kCapsHardware,
|
||||
kCapsWBuffer,
|
||||
kCapsCompressTextures,
|
||||
kCapsHWTransform,
|
||||
kCapsDither,
|
||||
kCapsFogLinear,
|
||||
kCapsFogExp,
|
||||
kCapsFogExp2,
|
||||
kCapsFogRange,
|
||||
kCapsLODWatch,
|
||||
kCapsUNUSED,
|
||||
kCapsDoesSmallTextures,
|
||||
kCapsPixelFog,
|
||||
kCapsBadYonStuff,
|
||||
kCapsNoKindaSmallTexs,
|
||||
kCapsCubicTextures,
|
||||
kCapsCubicMipmap,
|
||||
kCapsZBias,
|
||||
@ -360,7 +306,6 @@ public:
|
||||
kCapsCantShadow,
|
||||
kCapsMaxUVWSrc2,
|
||||
kCapsCantProj,
|
||||
kCapsLimitedProj,
|
||||
kCapsShareDepth,
|
||||
kCapsBadManaged,
|
||||
kCapsNoAniso,
|
||||
@ -381,37 +326,19 @@ protected:
|
||||
|
||||
char fErrorString[ 128 ];
|
||||
|
||||
void IClear();
|
||||
void IRemoveDiscarded();
|
||||
|
||||
void ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG3DDeviceRecord& srcDevRec);
|
||||
void ITryDirect3DTnLDriver(D3DEnum_DriverInfo* drivInfo);
|
||||
void ITryDirect3DTnL(hsWinRef winRef);
|
||||
bool IInitDirect3D( void );
|
||||
|
||||
#ifdef HS_SELECT_DX7
|
||||
void ITryDirect3DDevice(D3DEnum_DeviceInfo* devInfo, hsG3DDeviceRecord& srcDevRec);
|
||||
void ITryDirect3DDriver(D3DEnum_DriverInfo* drivInfo);
|
||||
void ITryDirect3D(hsWinRef winRef);
|
||||
#endif // HS_SELECT_DX7
|
||||
void IFudgeDirectXDevice( hsG3DDeviceRecord &record,
|
||||
D3DEnum_DriverInfo *driverInfo, D3DEnum_DeviceInfo *deviceInfo );
|
||||
uint32_t IAdjustDirectXMemory( uint32_t cardMem );
|
||||
|
||||
bool IGetD3DCardInfo( hsG3DDeviceRecord &record, void *driverInfo, void *deviceInfo,
|
||||
uint32_t *vendorID, uint32_t *deviceID, char **driverString, char **descString );
|
||||
#ifdef HS_SELECT_DX7
|
||||
bool IGetD3D7CardInfo( hsG3DDeviceRecord &record, void *driverInfo, void *deviceInfo,
|
||||
uint32_t *vendorID, uint32_t *deviceID, char **driverString, char **descString );
|
||||
#endif // HS_SELECT_DX7
|
||||
|
||||
void ITryOpenGL( hsWinRef winRef );
|
||||
void IGetExtOpenGLInfo( hsG3DDeviceRecord &devRec );
|
||||
void IGetOpenGLModes( hsG3DDeviceRecord &devRec, char *driverName );
|
||||
bool ITestOpenGLRes( int width, int height, int bitDepth,
|
||||
hsG3DDeviceRecord &devRec, char *driverName );
|
||||
#ifdef HS_OPEN_GL
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
uint32_t ICreateTempOpenGLContext( HDC hDC, bool makeItFull );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void ISetFudgeFactors( uint8_t chipsetID, hsG3DDeviceRecord &record );
|
||||
|
||||
@ -419,65 +346,10 @@ public:
|
||||
hsG3DDeviceSelector();
|
||||
virtual ~hsG3DDeviceSelector();
|
||||
|
||||
void Clear();
|
||||
void RemoveDiscarded();
|
||||
void RemoveUnusableDevModes(bool bTough); // Removes modes and devices not allowed supported in release
|
||||
|
||||
bool Init( void ); // Returns false if couldn't init
|
||||
const char *GetErrorString( void ) { return fErrorString; }
|
||||
|
||||
void Enumerate(hsWinRef winRef);
|
||||
hsTArray<hsG3DDeviceRecord>& GetDeviceRecords() { return fRecords; }
|
||||
|
||||
bool GetDefault(hsG3DDeviceModeRecord *dmr);
|
||||
|
||||
hsG3DDeviceRecord* GetRecord(int i) { return &fRecords[i]; }
|
||||
|
||||
void Read(hsStream* s);
|
||||
void Write(hsStream* s);
|
||||
};
|
||||
|
||||
|
||||
#define M3DDEMOINFO 1 /// Always compiled now, but only enabled if
|
||||
/// WIN_INIT has DemoInfoOutput in it
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Demo Debug File header file stuff
|
||||
// Created 10.10.2000 by Mathew Burrack @ Cyan, Inc.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "HeadSpin.h"
|
||||
|
||||
class plDemoDebugFile
|
||||
{
|
||||
public:
|
||||
plDemoDebugFile() { fDemoDebugFP = nil; fIsOpen = false; fEnabled = false; }
|
||||
~plDemoDebugFile() { IDDFClose(); }
|
||||
|
||||
// Static function to write a string to the DDF
|
||||
static void Write( const char *string );
|
||||
|
||||
// Static function to write two strings to the DDF
|
||||
static void Write( const char *string1, const char *string2 );
|
||||
|
||||
// Static function to write a string and a signed integer value to the DDF
|
||||
static void Write( const char *string1, int32_t value );
|
||||
|
||||
// Enables or disables the DDF class
|
||||
static void Enable( bool yes ) { fEnabled = yes; }
|
||||
|
||||
protected:
|
||||
static bool fIsOpen;
|
||||
static FILE *fDemoDebugFP;
|
||||
static bool fEnabled;
|
||||
|
||||
// Opens the DDF for writing
|
||||
static bool IDDFOpen( void );
|
||||
|
||||
// Closes the DDF
|
||||
static void IDDFClose( void );
|
||||
};
|
||||
|
||||
|
||||
#endif // hsG3DDeviceSelector_inc
|
||||
|
Reference in New Issue
Block a user