mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 19:29:09 +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)
|
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, bool Windowed, int NumAASamples, int MaxAnisotropicSamples, bool VSync)
|
||||||
{
|
{
|
||||||
if(!fPipeline) return;
|
if(!fPipeline) return;
|
||||||
@ -2235,11 +2163,6 @@ void plClient::IDetectAudioVideoSettings()
|
|||||||
const hsG3DDeviceMode *mode = dmr.GetMode();
|
const hsG3DDeviceMode *mode = dmr.GetMode();
|
||||||
|
|
||||||
bool pixelshaders = rec->GetCap(hsG3DDeviceSelector::kCapsPixelShader);
|
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;
|
plPipeline::fDefaultPipeParams.ColorDepth = hsG3DDeviceSelector::kDefaultDepth;
|
||||||
#if defined(HS_DEBUGGING) || defined(DEBUG)
|
#if defined(HS_DEBUGGING) || defined(DEBUG)
|
||||||
@ -2260,53 +2183,20 @@ void plClient::IDetectAudioVideoSettings()
|
|||||||
plPipeline::fDefaultPipeParams.Height = hsG3DDeviceSelector::kDefaultHeight;
|
plPipeline::fDefaultPipeParams.Height = hsG3DDeviceSelector::kDefaultHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
plPipeline::fDefaultPipeParams.Shadows = 0;
|
plPipeline::fDefaultPipeParams.Shadows = 1;
|
||||||
// enable shadows if TnL is available, meaning not an intel extreme.
|
|
||||||
if(rec->GetG3DHALorHEL() == hsG3DDeviceSelector::kHHD3DTnLHalDev)
|
|
||||||
plPipeline::fDefaultPipeParams.Shadows = 1;
|
|
||||||
|
|
||||||
// enable planar reflections if pixelshaders are available
|
// enable planar reflections if pixelshaders are available
|
||||||
if(pixelshaders && !refDevice)
|
|
||||||
{
|
|
||||||
plPipeline::fDefaultPipeParams.PlanarReflections = 1;
|
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
|
// 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;
|
||||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount = rec->GetMaxAnisotropicSamples() ? 2 : 0;
|
|
||||||
plPipeline::fDefaultPipeParams.AnisotropicLevel = mode->GetNumFSAATypes() ? 2 : 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount = 0;
|
|
||||||
plPipeline::fDefaultPipeParams.AnisotropicLevel = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(refDevice)
|
plPipeline::fDefaultPipeParams.TextureQuality = pixelshaders ? 2 : 1;
|
||||||
{
|
plPipeline::fDefaultPipeParams.VideoQuality = pixelshaders ? 2 : 1;
|
||||||
plPipeline::fDefaultPipeParams.TextureQuality = 0;
|
|
||||||
plPipeline::fDefaultPipeParams.VideoQuality = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plPipeline::fDefaultPipeParams.TextureQuality = psMajor >= 2 ? 2 : 1;
|
|
||||||
plPipeline::fDefaultPipeParams.VideoQuality = pixelshaders ? 2 : 1;
|
|
||||||
}
|
|
||||||
plPipeline::fDefaultPipeParams.VSync = false;
|
plPipeline::fDefaultPipeParams.VSync = false;
|
||||||
|
|
||||||
// card specific overrides
|
|
||||||
if(rec->GetDriverDesc() && strstr(rec->GetDriverDesc(), "FX 5200"))
|
|
||||||
{
|
|
||||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int val = 0;
|
int val = 0;
|
||||||
hsStream *stream = nil;
|
hsStream *stream = nil;
|
||||||
hsUNIXStream s;
|
hsUNIXStream s;
|
||||||
|
@ -135,8 +135,6 @@ protected:
|
|||||||
|
|
||||||
pfGameGUIMgr *fGameGUIMgr;
|
pfGameGUIMgr *fGameGUIMgr;
|
||||||
|
|
||||||
virtual hsG3DDeviceModeRecord ILoadDevMode(const char* devModeFile);
|
|
||||||
|
|
||||||
bool IUpdate();
|
bool IUpdate();
|
||||||
bool IDraw();
|
bool IDraw();
|
||||||
bool IDrawProgress();
|
bool IDrawProgress();
|
||||||
|
@ -53,16 +53,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
#include "HeadSpin.h"
|
#include "HeadSpin.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#if HS_BUILD_FOR_WIN32
|
#if HS_BUILD_FOR_WIN32
|
||||||
#include <ddraw.h>
|
# include "hsWindows.h"
|
||||||
#include <d3d9.h>
|
# include <ddraw.h>
|
||||||
|
# include <d3d9.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "hsDXTDirectXCodec.h"
|
#include "hsDXTDirectXCodec.h"
|
||||||
#include "hsColorRGBA.h"
|
#include "hsColorRGBA.h"
|
||||||
#include "plMipmap.h"
|
#include "plMipmap.h"
|
||||||
#include "hsCodecManager.h"
|
#include "hsCodecManager.h"
|
||||||
#include "plPipeline/hsGDDrawDllLoad.h"
|
|
||||||
|
|
||||||
#if HS_BUILD_FOR_WIN32
|
#if HS_BUILD_FOR_WIN32
|
||||||
namespace {
|
namespace {
|
||||||
@ -144,26 +147,20 @@ bool hsDXTDirectXCodec::IInitialize()
|
|||||||
{
|
{
|
||||||
fFlags |= kInitialized;
|
fFlags |= kInitialized;
|
||||||
|
|
||||||
// if( hsGDDrawDllLoad::GetDDrawDll() == nil )
|
DIRECTDRAWCREATEEX DirectDrawCreateEx = nullptr;
|
||||||
// return false;
|
|
||||||
|
|
||||||
DIRECTDRAWCREATEEX DirectDrawCreateEx = 0;
|
|
||||||
|
|
||||||
// Initialize DirectDraw
|
// Initialize DirectDraw
|
||||||
HRESULT hr;
|
std::unique_ptr<HINSTANCE__, std::function<BOOL(HMODULE)>> ddraw(LoadLibraryA("ddraw.dll"), FreeLibrary);
|
||||||
DirectDrawCreateEx = (DIRECTDRAWCREATEEX)GetProcAddress( hsGDDrawDllLoad::GetD3DDll(), "DirectDrawCreateEx" );
|
DirectDrawCreateEx = (DIRECTDRAWCREATEEX)GetProcAddress(ddraw.get(), "DirectDrawCreateEx");
|
||||||
if( DirectDrawCreateEx == nil )
|
if (!DirectDrawCreateEx)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/// Using EMULATIONONLY here usually fails--using NULL forces the
|
/// Using EMULATIONONLY here usually fails--using NULL forces the
|
||||||
/// use of the standard display driver, which DOES work.
|
/// 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;
|
return false;
|
||||||
|
|
||||||
if (FAILED(hr = fDirectDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL)))
|
return SUCCEEDED(fDirectDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL));
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ endif(WIN32)
|
|||||||
set(plPipeline_SOURCES
|
set(plPipeline_SOURCES
|
||||||
hsG3DDeviceSelector.cpp
|
hsG3DDeviceSelector.cpp
|
||||||
hsGColorizer.cpp
|
hsGColorizer.cpp
|
||||||
hsGDDrawDllLoad.cpp
|
|
||||||
plCaptureRender.cpp
|
plCaptureRender.cpp
|
||||||
plCubicRenderTargetModifier.cpp
|
plCubicRenderTargetModifier.cpp
|
||||||
plCullTree.cpp
|
plCullTree.cpp
|
||||||
@ -33,6 +32,7 @@ set(plPipeline_SOURCES
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(plDXPipeline_SOURCES
|
set(plDXPipeline_SOURCES
|
||||||
|
DX/hsGDirect3D.cpp
|
||||||
DX/plDXDeviceRefs.cpp
|
DX/plDXDeviceRefs.cpp
|
||||||
DX/plDXEnumerate.cpp
|
DX/plDXEnumerate.cpp
|
||||||
DX/plDXPipeline.cpp
|
DX/plDXPipeline.cpp
|
||||||
@ -46,7 +46,6 @@ set(plPipeline_HEADERS
|
|||||||
hsFogControl.h
|
hsFogControl.h
|
||||||
hsG3DDeviceSelector.h
|
hsG3DDeviceSelector.h
|
||||||
hsGColorizer.h
|
hsGColorizer.h
|
||||||
hsGDDrawDllLoad.h
|
|
||||||
hsGDeviceRef.h
|
hsGDeviceRef.h
|
||||||
hsWinRef.h
|
hsWinRef.h
|
||||||
plBinkPlayer.h
|
plBinkPlayer.h
|
||||||
@ -75,6 +74,7 @@ set(plPipeline_HEADERS
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(plDXPipeline_HEADERS
|
set(plDXPipeline_HEADERS
|
||||||
|
DX/hsGDirect3D.h
|
||||||
DX/plDXBufferRefs.h
|
DX/plDXBufferRefs.h
|
||||||
DX/plDXDeviceRef.h
|
DX/plDXDeviceRef.h
|
||||||
DX/plDXEnumerate.h
|
DX/plDXEnumerate.h
|
||||||
@ -91,6 +91,7 @@ set(plDXPipeline_HEADERS
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_library(plPipeline STATIC ${plPipeline_SOURCES} ${plDXPipeline_SOURCES} ${plPipeline_HEADERS} ${plDXPipeline_HEADERS})
|
add_library(plPipeline STATIC ${plPipeline_SOURCES} ${plDXPipeline_SOURCES} ${plPipeline_HEADERS} ${plDXPipeline_HEADERS})
|
||||||
|
target_link_libraries(plPipeline ${DirectX_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
add_library(plPipeline STATIC ${plPipeline_SOURCES} ${plPipeline_HEADERS})
|
add_library(plPipeline STATIC ${plPipeline_SOURCES} ${plPipeline_HEADERS})
|
||||||
endif()
|
endif()
|
||||||
|
@ -40,39 +40,43 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
*==LICENSE==*/
|
*==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>
|
static std::unique_ptr<hsGDirect3DTnLEnumerate> s_tnlEnum;
|
||||||
|
hsGDirect3DTnLEnumerate& hsGDirect3D::EnumerateTnL(bool reenum)
|
||||||
#include "hsGDDrawDllLoad.h"
|
|
||||||
|
|
||||||
static hsGDDrawDllLoad staticDllLoad;
|
|
||||||
|
|
||||||
hsGDDrawDllLoad::hsGDDrawDllLoad()
|
|
||||||
{
|
{
|
||||||
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" );
|
// Be nice to legacy code and return a reference...
|
||||||
if (fD3DDll)
|
hsGDirect3DTnLEnumerate* ptr = s_tnlEnum.get();
|
||||||
hsStatusMessage( "--- D3D9.DLL loaded successfully.\n" );
|
return *ptr;
|
||||||
else
|
|
||||||
hsStatusMessage( "--- Unable to load D3D9.DLL successfully.\n" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hsGDDrawDllLoad::~hsGDDrawDllLoad()
|
void hsGDirect3D::ReleaseTnLEnum()
|
||||||
{
|
{
|
||||||
if (fD3DDll != nil)
|
s_tnlEnum.release();
|
||||||
{
|
}
|
||||||
hsStatusMessage( "--- Unloading D3D.DLL.\n" );
|
|
||||||
FreeLibrary(fD3DDll);
|
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==*/
|
*==LICENSE==*/
|
||||||
|
|
||||||
#ifndef hsGDDrawDllLoad_inc
|
#ifndef _hsGDirect3D_inc_
|
||||||
#define hsGDDrawDllLoad_inc
|
#define _hsGDirect3D_inc_
|
||||||
|
|
||||||
#include "HeadSpin.h"
|
class hsGDirect3DTnLEnumerate;
|
||||||
|
struct IDirect3D9;
|
||||||
|
|
||||||
#if HS_BUILD_FOR_WIN32
|
namespace hsGDirect3D
|
||||||
class hsGDDrawDllLoad
|
|
||||||
{
|
{
|
||||||
private:
|
hsGDirect3DTnLEnumerate& EnumerateTnL(bool reenum=false);
|
||||||
HMODULE fD3DDll;
|
void ReleaseTnLEnum();
|
||||||
|
|
||||||
public:
|
/** Get a root Direct3D object.
|
||||||
hsGDDrawDllLoad();
|
* \remarks You should not hold this pointer.
|
||||||
~hsGDDrawDllLoad();
|
*/
|
||||||
|
IDirect3D9* GetDirect3D(bool recreate=false);
|
||||||
|
}
|
||||||
|
|
||||||
static HMODULE GetD3DDll();
|
#endif // _hsGDirect3D_inc_
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // hsGDDrawDllLoad_inc
|
|
@ -39,11 +39,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
Mead, WA 99021
|
Mead, WA 99021
|
||||||
|
|
||||||
*==LICENSE==*/
|
*==LICENSE==*/
|
||||||
#include "plDXEnumerate.h"
|
|
||||||
#include <ddraw.h>
|
|
||||||
|
|
||||||
#include "plPipeline/hsGDDrawDllLoad.h"
|
#include "plDXEnumerate.h"
|
||||||
#include "plPipeline/hsG3DDeviceSelector.h"
|
#include "plPipeline/hsG3DDeviceSelector.h"
|
||||||
|
#include "hsGDirect3D.h"
|
||||||
|
|
||||||
|
|
||||||
//// Local Typedefs ///////////////////////////////////////////////////////////
|
//// Local Typedefs ///////////////////////////////////////////////////////////
|
||||||
@ -102,9 +101,6 @@ HRESULT hsGDirect3DTnLEnumerate::SelectFromDevMode(const hsG3DDeviceRecord* devR
|
|||||||
if( !colorDepth )
|
if( !colorDepth )
|
||||||
enumFlags |= D3DENUM_CANWINDOW;
|
enumFlags |= D3DENUM_CANWINDOW;
|
||||||
enumFlags |= D3DENUM_TNLHAL;
|
enumFlags |= D3DENUM_TNLHAL;
|
||||||
#ifdef HS_ALLOW_D3D_REF_DRIVER
|
|
||||||
enumFlags |= D3DENUM_REFERENCERAST;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
D3DEnum_SelectDefaultDriver(enumFlags);
|
D3DEnum_SelectDefaultDriver(enumFlags);
|
||||||
|
|
||||||
@ -219,8 +215,7 @@ HRESULT hsGDirect3DTnLEnumerate::D3DEnum_SelectDefaultDriver( DWORD dwFlags )
|
|||||||
{
|
{
|
||||||
if( dwFlags & D3DENUM_CANWINDOW )
|
if( dwFlags & D3DENUM_CANWINDOW )
|
||||||
{
|
{
|
||||||
if( (pDriver == &fDrivers[0])
|
if( (pDriver == &fDrivers[0]) )
|
||||||
&&( pDevice->fDDCaps.Caps2 & DDCAPS2_CANRENDERWINDOWED ) )
|
|
||||||
{
|
{
|
||||||
if( ( pDevice->fDDCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
|
if( ( pDevice->fDDCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
|
||||||
^ !(dwFlags & D3DENUM_TNLHAL) )
|
^ !(dwFlags & D3DENUM_TNLHAL) )
|
||||||
@ -286,27 +281,9 @@ hsGDirect3DTnLEnumerate::hsGDirect3DTnLEnumerate()
|
|||||||
fCurrentDriver = NULL; // The selected DD driver
|
fCurrentDriver = NULL; // The selected DD driver
|
||||||
fDrivers.Reset(); // List of DD drivers
|
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
|
// Create a D3D object to use
|
||||||
IDirect3D9 *pD3D = procPtr( D3D_SDK_VERSION );
|
IDirect3D9* pD3D = hsGDirect3D::GetDirect3D();
|
||||||
if( pD3D == nil )
|
if (!pD3D)
|
||||||
{
|
{
|
||||||
strcpy( fEnumeErrorStr, "Cannot load DirectX!" );
|
strcpy( fEnumeErrorStr, "Cannot load DirectX!" );
|
||||||
return;
|
return;
|
||||||
@ -333,9 +310,6 @@ hsGDirect3DTnLEnumerate::hsGDirect3DTnLEnumerate()
|
|||||||
/// Do the mode and device enumeration for this adapter
|
/// Do the mode and device enumeration for this adapter
|
||||||
IEnumAdapterDevices( pD3D, iAdapter, newDriver );
|
IEnumAdapterDevices( pD3D, iAdapter, newDriver );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
pD3D->Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//// IEnumAdapterDevices //////////////////////////////////////////////////////
|
//// IEnumAdapterDevices //////////////////////////////////////////////////////
|
||||||
@ -391,12 +365,7 @@ void hsGDirect3DTnLEnumerate::IEnumAdapterDevices( IDirect3D9 *pD3D, UINT iAd
|
|||||||
/// Confirm that HW vertex processing works on this device
|
/// Confirm that HW vertex processing works on this device
|
||||||
if (deviceInfo->fDDCaps.DevCaps & D3DDEVCAPS_PUREDEVICE)
|
if (deviceInfo->fDDCaps.DevCaps & D3DDEVCAPS_PUREDEVICE)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
behavior[iFormat] = D3DCREATE_HARDWARE_VERTEXPROCESSING |
|
|
||||||
D3DCREATE_PUREDEVICE;
|
|
||||||
#else
|
|
||||||
behavior[iFormat] = D3DCREATE_HARDWARE_VERTEXPROCESSING;
|
behavior[iFormat] = D3DCREATE_HARDWARE_VERTEXPROCESSING;
|
||||||
#endif
|
|
||||||
if (SUCCEEDED(IConfirmDevice(&deviceInfo->fDDCaps, behavior[iFormat],
|
if (SUCCEEDED(IConfirmDevice(&deviceInfo->fDDCaps, behavior[iFormat],
|
||||||
currFormat)))
|
currFormat)))
|
||||||
{
|
{
|
||||||
@ -662,16 +631,6 @@ bool hsG3DDeviceSelector::IGetD3DCardInfo( hsG3DDeviceRecord &record,
|
|||||||
|
|
||||||
adapterInfo = &driverD3DInfo->fAdapterInfo;
|
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;
|
*vendorID = adapterInfo->VendorId;
|
||||||
*deviceID = adapterInfo->DeviceId;
|
*deviceID = adapterInfo->DeviceId;
|
||||||
*driverString = adapterInfo->Driver;
|
*driverString = adapterInfo->Driver;
|
||||||
@ -680,42 +639,11 @@ bool hsG3DDeviceSelector::IGetD3DCardInfo( hsG3DDeviceRecord &record,
|
|||||||
return true;
|
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 //////////////////////////////////////////////////////////
|
//// ITryDirect3DTnL //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void hsG3DDeviceSelector::ITryDirect3DTnL(hsWinRef winRef)
|
void hsG3DDeviceSelector::ITryDirect3DTnL(hsWinRef winRef)
|
||||||
{
|
{
|
||||||
hsGDirect3DTnLEnumerate d3dEnum;
|
hsGDirect3DTnLEnumerate& d3dEnum = hsGDirect3D::EnumerateTnL();
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for( i = 0; i < d3dEnum.GetNumDrivers(); i++ )
|
for( i = 0; i < d3dEnum.GetNumDrivers(); i++ )
|
||||||
@ -732,7 +660,7 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDriver(D3DEnum_DriverInfo* drivInfo)
|
|||||||
{
|
{
|
||||||
hsG3DDeviceRecord devRec;
|
hsG3DDeviceRecord devRec;
|
||||||
devRec.Clear();
|
devRec.Clear();
|
||||||
devRec.SetG3DDeviceType( kDevTypeDirect3DTnL );
|
devRec.SetG3DDeviceType( kDevTypeDirect3D );
|
||||||
|
|
||||||
devRec.SetDriverName( drivInfo->fAdapterInfo.Driver );
|
devRec.SetDriverName( drivInfo->fAdapterInfo.Driver );
|
||||||
devRec.SetDriverDesc( drivInfo->fAdapterInfo.Description );
|
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
|
/// Done first now, so we can alter the D3D type later
|
||||||
ITryDirect3DTnLDevice( &drivInfo->fDevices[i], currDevRec );
|
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 ] );
|
IFudgeDirectXDevice( currDevRec, (D3DEnum_DriverInfo *)drivInfo, (D3DEnum_DeviceInfo *)&drivInfo->fDevices[ i ] );
|
||||||
|
|
||||||
if( currDevRec.GetModes().GetCount() )
|
if( currDevRec.GetModes().GetCount() )
|
||||||
@ -822,10 +727,6 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG
|
|||||||
devRec.SetCap(kCapsPerspective);
|
devRec.SetCap(kCapsPerspective);
|
||||||
if( devInfo->fIsHardware )
|
if( devInfo->fIsHardware )
|
||||||
devRec.SetCap( kCapsHardware );
|
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 )
|
if( devInfo->fDDCaps.RasterCaps & D3DPRASTERCAPS_FOGTABLE )
|
||||||
{
|
{
|
||||||
devRec.SetCap( kCapsFogLinear );
|
devRec.SetCap( kCapsFogLinear );
|
||||||
|
@ -121,8 +121,6 @@ class hsG3DDeviceMode;
|
|||||||
class hsGDirect3DTnLEnumerate
|
class hsGDirect3DTnLEnumerate
|
||||||
{
|
{
|
||||||
protected:
|
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>@
|
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;
|
hsTArray<D3DEnum_DriverInfo> fDrivers;
|
||||||
|
@ -55,8 +55,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#include "hsWindows.h"
|
#include "hsWindows.h"
|
||||||
|
|
||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
#include <ddraw.h>
|
|
||||||
#include <d3dx9mesh.h>
|
#include <d3dx9mesh.h>
|
||||||
|
#include "hsGDirect3D.h"
|
||||||
|
|
||||||
#if defined(DX_OLD_SDK) || defined(__MINGW32__)
|
#if defined(DX_OLD_SDK) || defined(__MINGW32__)
|
||||||
#include <dxerr9.h>
|
#include <dxerr9.h>
|
||||||
@ -78,7 +78,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#include "plPipeline/plDebugText.h"
|
#include "plPipeline/plDebugText.h"
|
||||||
#include "plDXEnumerate.h"
|
#include "plDXEnumerate.h"
|
||||||
#include "plPipeline/hsG3DDeviceSelector.h"
|
#include "plPipeline/hsG3DDeviceSelector.h"
|
||||||
#include "plPipeline/hsGDDrawDllLoad.h"
|
|
||||||
#include "hsResMgr.h"
|
#include "hsResMgr.h"
|
||||||
#include "plPipeline/plStatusLogDrawer.h"
|
#include "plPipeline/plStatusLogDrawer.h"
|
||||||
#include "plQuality.h"
|
#include "plQuality.h"
|
||||||
@ -625,7 +624,7 @@ plDXPipeline::plDXPipeline( hsWinRef hWnd, const hsG3DDeviceModeRecord *devModeR
|
|||||||
else
|
else
|
||||||
fSettings.fNumAASamples = devMode->GetFSAAType( devRec->GetAASetting() - 1 );
|
fSettings.fNumAASamples = devMode->GetFSAAType( devRec->GetAASetting() - 1 );
|
||||||
|
|
||||||
hsGDirect3DTnLEnumerate d3dEnum;
|
hsGDirect3DTnLEnumerate& d3dEnum = hsGDirect3D::EnumerateTnL();
|
||||||
if( d3dEnum.GetEnumeErrorStr()[ 0 ] )
|
if( d3dEnum.GetEnumeErrorStr()[ 0 ] )
|
||||||
{
|
{
|
||||||
IShowErrorMessage( (char *)d3dEnum.GetEnumeErrorStr() );
|
IShowErrorMessage( (char *)d3dEnum.GetEnumeErrorStr() );
|
||||||
@ -638,16 +637,6 @@ plDXPipeline::plDXPipeline( hsWinRef hWnd, const hsG3DDeviceModeRecord *devModeR
|
|||||||
return;
|
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.
|
// Record the requested mode/setup.
|
||||||
ISetCurrentDriver( d3dEnum.GetCurrentDriver() );
|
ISetCurrentDriver( d3dEnum.GetCurrentDriver() );
|
||||||
ISetCurrentDevice( d3dEnum.GetCurrentDevice() );
|
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);
|
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().
|
// 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
|
// 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
|
// to delete or set to a valid pointer. It must be set to a valid pointer
|
||||||
// before the pipeline can be used for much.
|
// 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.
|
// render state will be initialized in IInitDeviceState.
|
||||||
|
|
||||||
void plDXPipeline::IClearMembers()
|
void plDXPipeline::IClearMembers()
|
||||||
@ -774,7 +765,6 @@ void plDXPipeline::IClearMembers()
|
|||||||
fBlurVBuffers[i] = nil;
|
fBlurVBuffers[i] = nil;
|
||||||
fBlurVSHandle = 0;
|
fBlurVSHandle = 0;
|
||||||
|
|
||||||
fD3DObject = nil;
|
|
||||||
fD3DDevice = nil;
|
fD3DDevice = nil;
|
||||||
fD3DBackBuff = nil;
|
fD3DBackBuff = nil;
|
||||||
fD3DDepthSurface = nil;
|
fD3DDepthSurface = nil;
|
||||||
@ -892,7 +882,6 @@ void plDXGeneralSettings::Reset()
|
|||||||
fNoGammaCorrect = false;
|
fNoGammaCorrect = false;
|
||||||
fMaxUVWSrc = 8;
|
fMaxUVWSrc = 8;
|
||||||
fCantProj = false;
|
fCantProj = false;
|
||||||
fLimitedProj = false;
|
|
||||||
fBadManaged = false;
|
fBadManaged = false;
|
||||||
fShareDepth = false;
|
fShareDepth = false;
|
||||||
fCurrAnisotropy = false;
|
fCurrAnisotropy = false;
|
||||||
@ -931,7 +920,7 @@ void plDXPipeline::IInitDeviceState()
|
|||||||
|
|
||||||
fD3DDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_LESSEQUAL );
|
fD3DDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_LESSEQUAL );
|
||||||
fD3DDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
|
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_CLIPPING, TRUE );
|
||||||
fD3DDevice->SetRenderState( D3DRS_CULLMODE, fCurrCullMode );
|
fD3DDevice->SetRenderState( D3DRS_CULLMODE, fCurrCullMode );
|
||||||
ISetCullMode();
|
ISetCullMode();
|
||||||
@ -943,7 +932,7 @@ void plDXPipeline::IInitDeviceState()
|
|||||||
fD3DDevice->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, ( fSettings.fD3DCaps & kCapsFSAntiAlias ) ? TRUE : FALSE );
|
fD3DDevice->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, ( fSettings.fD3DCaps & kCapsFSAntiAlias ) ? TRUE : FALSE );
|
||||||
fD3DDevice->SetRenderState( D3DRS_ANTIALIASEDLINEENABLE, 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_SPECULARENABLE, FALSE );
|
||||||
fD3DDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
|
fD3DDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
|
||||||
fCurrD3DLiteState = false;
|
fCurrD3DLiteState = false;
|
||||||
@ -1040,10 +1029,6 @@ void plDXPipeline::ISetCaps()
|
|||||||
fSettings.fD3DCaps |= kCapsMipmap;
|
fSettings.fD3DCaps |= kCapsMipmap;
|
||||||
if (fCurrentDevice->fDDCaps.TextureCaps & D3DPTEXTURECAPS_MIPCUBEMAP)
|
if (fCurrentDevice->fDDCaps.TextureCaps & D3DPTEXTURECAPS_MIPCUBEMAP)
|
||||||
fSettings.fD3DCaps |= kCapsCubicMipmap;
|
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)
|
if (fSettings.fNumAASamples > 0)
|
||||||
fSettings.fD3DCaps |= kCapsFSAntiAlias;
|
fSettings.fD3DCaps |= kCapsFSAntiAlias;
|
||||||
if (fCurrentDevice->fDDCaps.RasterCaps & D3DPRASTERCAPS_WFOG)
|
if (fCurrentDevice->fDDCaps.RasterCaps & D3DPRASTERCAPS_WFOG)
|
||||||
@ -1167,16 +1152,8 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
|||||||
fSettings.fD3DCaps &= ~kCapsMipmap;
|
fSettings.fD3DCaps &= ~kCapsMipmap;
|
||||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsCubicMipmap ) )
|
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsCubicMipmap ) )
|
||||||
fSettings.fD3DCaps &= ~kCapsCubicMipmap;
|
fSettings.fD3DCaps &= ~kCapsCubicMipmap;
|
||||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsWBuffer ) )
|
|
||||||
fSettings.fD3DCaps &= ~kCapsWBuffer;
|
|
||||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsZBias ) )
|
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsZBias ) )
|
||||||
fSettings.fD3DCaps &= ~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 ) )
|
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsFogExp ) )
|
||||||
fSettings.fD3DCaps &= ~kCapsExpFog;
|
fSettings.fD3DCaps &= ~kCapsExpFog;
|
||||||
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsCubicTextures ) )
|
if( !devRec.GetCap( hsG3DDeviceSelector::kCapsCubicTextures ) )
|
||||||
@ -1187,8 +1164,6 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
|||||||
|
|
||||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsCantProj) )
|
if( devRec.GetCap(hsG3DDeviceSelector::kCapsCantProj) )
|
||||||
fSettings.fCantProj = true;
|
fSettings.fCantProj = true;
|
||||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsLimitedProj) )
|
|
||||||
fSettings.fLimitedProj = true;
|
|
||||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsBadManaged) )
|
if( devRec.GetCap(hsG3DDeviceSelector::kCapsBadManaged) )
|
||||||
fSettings.fBadManaged = true;
|
fSettings.fBadManaged = true;
|
||||||
if( devRec.GetCap(hsG3DDeviceSelector::kCapsShareDepth) )
|
if( devRec.GetCap(hsG3DDeviceSelector::kCapsShareDepth) )
|
||||||
@ -1204,11 +1179,6 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
|||||||
if( devRec.GetCap( hsG3DDeviceSelector::kCapsBadYonStuff ) )
|
if( devRec.GetCap( hsG3DDeviceSelector::kCapsBadYonStuff ) )
|
||||||
fSettings.fD3DCaps |= kCapsHasBadYonStuff;
|
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
|
/// 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,
|
/// 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.
|
/// 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;
|
fManagedCutoff = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Our temp debug flag to force z-buffering...
|
/// Set up the z-bias scale values
|
||||||
if( !( fDbgSetupInitFlags & 0x00000001 ) )
|
fTweaks.fDefaultPerspLayerScale = kPerspLayerScale;
|
||||||
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;
|
|
||||||
|
|
||||||
|
|
||||||
// Less than 4 layers at once means we have to fallback on uv bumpmapping
|
// 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;
|
fCurrentDriver->fCurrentDevice = nil;
|
||||||
|
|
||||||
/// Go looking for an adapter to match this one
|
/// Go looking for an adapter to match this one
|
||||||
|
IDirect3D9* d3d = hsGDirect3D::GetDirect3D();
|
||||||
UINT iAdapter;
|
UINT iAdapter;
|
||||||
for( fCurrentAdapter = 0, iAdapter = 0; iAdapter < fD3DObject->GetAdapterCount(); iAdapter++ )
|
|
||||||
|
for( fCurrentAdapter = 0, iAdapter = 0; iAdapter < d3d->GetAdapterCount(); iAdapter++ )
|
||||||
{
|
{
|
||||||
D3DADAPTER_IDENTIFIER9 adapterInfo;
|
D3DADAPTER_IDENTIFIER9 adapterInfo;
|
||||||
fD3DObject->GetAdapterIdentifier( iAdapter, 0, &adapterInfo );
|
d3d->GetAdapterIdentifier( iAdapter, 0, &adapterInfo );
|
||||||
|
|
||||||
if( adapterInfo.DeviceIdentifier == fCurrentDriver->fAdapterInfo.DeviceIdentifier )
|
if( adapterInfo.DeviceIdentifier == fCurrentDriver->fAdapterInfo.DeviceIdentifier )
|
||||||
{
|
{
|
||||||
@ -1498,9 +1463,9 @@ bool plDXPipeline::IFindCompressedFormats()
|
|||||||
|
|
||||||
for( i = 0; toCheckFor[ i ] != D3DFMT_UNKNOWN; i++ )
|
for( i = 0; toCheckFor[ i ] != D3DFMT_UNKNOWN; i++ )
|
||||||
{
|
{
|
||||||
if( FAILED( fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType,
|
if( FAILED( hsGDirect3D::GetDirect3D()->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType,
|
||||||
fCurrentMode->fDDmode.Format,
|
fCurrentMode->fDDmode.Format,
|
||||||
0, D3DRTYPE_TEXTURE, toCheckFor[ i ] ) ) )
|
0, D3DRTYPE_TEXTURE, toCheckFor[ i ] ) ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1520,9 +1485,9 @@ bool plDXPipeline::IFindLuminanceFormats()
|
|||||||
|
|
||||||
for( i = 0; toCheckFor[ i ] != D3DFMT_UNKNOWN; i++ )
|
for( i = 0; toCheckFor[ i ] != D3DFMT_UNKNOWN; i++ )
|
||||||
{
|
{
|
||||||
if( FAILED( fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType,
|
if (FAILED(hsGDirect3D::GetDirect3D()->CheckDeviceFormat(fCurrentAdapter, fCurrentDevice->fDDType,
|
||||||
fCurrentMode->fDDmode.Format,
|
fCurrentMode->fDDmode.Format,
|
||||||
0, D3DRTYPE_TEXTURE, toCheckFor[ i ] ) ) )
|
0, D3DRTYPE_TEXTURE, toCheckFor[ i ] ) ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1537,9 +1502,9 @@ bool plDXPipeline::IFindLuminanceFormats()
|
|||||||
|
|
||||||
bool plDXPipeline::ITextureFormatAllowed( D3DFORMAT format )
|
bool plDXPipeline::ITextureFormatAllowed( D3DFORMAT format )
|
||||||
{
|
{
|
||||||
if( FAILED( fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType,
|
if (FAILED( hsGDirect3D::GetDirect3D()->CheckDeviceFormat(fCurrentAdapter, fCurrentDevice->fDDType,
|
||||||
fCurrentMode->fDDmode.Format,
|
fCurrentMode->fDDmode.Format,
|
||||||
0, D3DRTYPE_TEXTURE, format ) ) )
|
0, D3DRTYPE_TEXTURE, format ) ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1584,32 +1549,6 @@ bool plDXPipeline::IsDebugFlagSet( uint32_t flag ) const
|
|||||||
//// Device Creation //////////////////////////////////////////////////////////
|
//// 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 ////////////////////////////////////////////////////
|
//// ICreateDevice ////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Creates the device. Surfaces, buffers, etc. created separately (in case of lost device).
|
// 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 ];
|
char msg[ 256 ];
|
||||||
#endif // DBG_WRITE_FORMATS
|
#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" );
|
"Cannot get desktop display mode" );
|
||||||
|
|
||||||
// save desktop properties
|
// save desktop properties
|
||||||
@ -1722,10 +1665,10 @@ bool plDXPipeline::ICreateDevice(bool windowed)
|
|||||||
|
|
||||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||||
UINT adapter;
|
UINT adapter;
|
||||||
for (adapter = 0; adapter < fD3DObject->GetAdapterCount(); adapter++)
|
for (adapter = 0; adapter < d3d->GetAdapterCount(); adapter++)
|
||||||
{
|
{
|
||||||
D3DADAPTER_IDENTIFIER9 id;
|
D3DADAPTER_IDENTIFIER9 id;
|
||||||
fD3DObject->GetAdapterIdentifier(adapter, 0, &id);
|
d3d->GetAdapterIdentifier(adapter, 0, &id);
|
||||||
|
|
||||||
// We should be matching against "NVIDIA NVPerfHUD", but the space
|
// We should be matching against "NVIDIA NVPerfHUD", but the space
|
||||||
// in the description seems to be bogus. This seems to be a fair
|
// 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
|
#endif // PLASMA_EXTERNAL_RELEASE
|
||||||
|
|
||||||
INIT_ERROR_CHECK( fD3DObject->CreateDevice( fCurrentAdapter, fCurrentDevice->fDDType,
|
INIT_ERROR_CHECK( d3d->CreateDevice( fCurrentAdapter, fCurrentDevice->fDDType,
|
||||||
fSettings.fHWnd, fCurrentMode->fDDBehavior,
|
fSettings.fHWnd, fCurrentMode->fDDBehavior,
|
||||||
¶ms, &fD3DDevice ),
|
¶ms, &fD3DDevice ),
|
||||||
"Cannot create primary display surface via CreateDevice()" );
|
"Cannot create primary display surface via CreateDevice()" );
|
||||||
|
|
||||||
fSettings.fPresentParams = params;
|
fSettings.fPresentParams = params;
|
||||||
@ -1774,6 +1717,8 @@ bool plDXPipeline::ICreateDevice(bool windowed)
|
|||||||
// will work.
|
// will work.
|
||||||
bool plDXPipeline::IFindDepthFormat(D3DPRESENT_PARAMETERS& params)
|
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
|
// 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
|
// 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.
|
// 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_D24X8)
|
||||||
||(fmt == D3DFMT_D16) )
|
||(fmt == D3DFMT_D16) )
|
||||||
{
|
{
|
||||||
HRESULT hr = fD3DObject->CheckDeviceMultiSampleType(fCurrentAdapter,
|
HRESULT hr = d3d->CheckDeviceMultiSampleType(fCurrentAdapter,
|
||||||
fCurrentDevice->fDDType,
|
fCurrentDevice->fDDType,
|
||||||
fmt,
|
fmt,
|
||||||
fCurrentMode->fWindowed ? TRUE : FALSE,
|
fCurrentMode->fWindowed ? TRUE : FALSE,
|
||||||
params.MultiSampleType, NULL);
|
params.MultiSampleType, NULL);
|
||||||
if( !FAILED(hr) )
|
if( !FAILED(hr) )
|
||||||
{
|
{
|
||||||
params.AutoDepthStencilFormat = fmt;
|
params.AutoDepthStencilFormat = fmt;
|
||||||
@ -1805,11 +1750,11 @@ bool plDXPipeline::IFindDepthFormat(D3DPRESENT_PARAMETERS& params)
|
|||||||
D3DFORMAT fmt = fCurrentMode->fDepthFormats[ i ];
|
D3DFORMAT fmt = fCurrentMode->fDepthFormats[ i ];
|
||||||
if( fmt == D3DFMT_D15S1 || fmt == D3DFMT_D24X4S4 || fmt == D3DFMT_D24S8 )
|
if( fmt == D3DFMT_D15S1 || fmt == D3DFMT_D24X4S4 || fmt == D3DFMT_D24S8 )
|
||||||
{
|
{
|
||||||
HRESULT hr = fD3DObject->CheckDeviceMultiSampleType(fCurrentAdapter,
|
HRESULT hr = d3d->CheckDeviceMultiSampleType(fCurrentAdapter,
|
||||||
fCurrentDevice->fDDType,
|
fCurrentDevice->fDDType,
|
||||||
fmt,
|
fmt,
|
||||||
fCurrentMode->fWindowed ? TRUE : FALSE,
|
fCurrentMode->fWindowed ? TRUE : FALSE,
|
||||||
params.MultiSampleType, NULL);
|
params.MultiSampleType, NULL);
|
||||||
if( !FAILED(hr) )
|
if( !FAILED(hr) )
|
||||||
{
|
{
|
||||||
params.AutoDepthStencilFormat = fmt;
|
params.AutoDepthStencilFormat = fmt;
|
||||||
@ -2071,16 +2016,6 @@ void plDXPipeline::IReleaseDeviceObjects()
|
|||||||
fD3DDevice = nil;
|
fD3DDevice = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fD3DObject != nil )
|
|
||||||
{
|
|
||||||
LONG ret;
|
|
||||||
while( ret = fD3DObject->Release() )
|
|
||||||
{
|
|
||||||
hsStatusMessageF("%d - Error releasing Direct3D Object", ret);
|
|
||||||
}
|
|
||||||
fD3DObject = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
fManagedAlloced = false;
|
fManagedAlloced = false;
|
||||||
fAllocUnManaged = false;
|
fAllocUnManaged = false;
|
||||||
}
|
}
|
||||||
@ -2579,13 +2514,10 @@ void plDXPipeline::Resize( uint32_t width, uint32_t height )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Recreate
|
// 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
|
// Go recreate surfaces and DX-dependent objects
|
||||||
@ -3920,9 +3852,7 @@ bool plDXPipeline::BeginRender()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Superfluous setting of Z state.
|
// Superfluous setting of Z state.
|
||||||
fD3DDevice->SetRenderState( D3DRS_ZENABLE,
|
fD3DDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
|
||||||
( fView.IsPerspective() && ( fSettings.fD3DCaps & kCapsWBuffer ) )
|
|
||||||
? D3DZB_USEW : D3DZB_TRUE );
|
|
||||||
|
|
||||||
/// If we have a renderTarget active, use its viewport
|
/// If we have a renderTarget active, use its viewport
|
||||||
ISetViewport();
|
ISetViewport();
|
||||||
@ -4820,6 +4750,7 @@ bool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
|||||||
uint16_t flags, width, height;
|
uint16_t flags, width, height;
|
||||||
int8_t bitDepth, zDepth, stencilDepth, stencilIndex;
|
int8_t bitDepth, zDepth, stencilDepth, stencilIndex;
|
||||||
D3DFORMAT depthFormats[] = { D3DFMT_D24X8, D3DFMT_D24X4S4, D3DFMT_D24S8 };
|
D3DFORMAT depthFormats[] = { D3DFMT_D24X8, D3DFMT_D24X4S4, D3DFMT_D24S8 };
|
||||||
|
IDirect3D9* d3d = hsGDirect3D::GetDirect3D();
|
||||||
|
|
||||||
|
|
||||||
flags = owner->GetFlags();
|
flags = owner->GetFlags();
|
||||||
@ -4886,8 +4817,8 @@ bool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check the device format
|
/// Check the device format
|
||||||
if( FAILED( fSettings.fDXError = fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
if( FAILED( fSettings.fDXError = d3d->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||||
{
|
{
|
||||||
if( bitDepth == 16 )
|
if( bitDepth == 16 )
|
||||||
{
|
{
|
||||||
@ -4899,8 +4830,8 @@ bool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
|||||||
bitDepth = 16;
|
bitDepth = 16;
|
||||||
surfFormat = D3DFMT_A4R4G4B4;
|
surfFormat = D3DFMT_A4R4G4B4;
|
||||||
}
|
}
|
||||||
if( FAILED( fSettings.fDXError = fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
if( FAILED( fSettings.fDXError = d3d->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||||
{
|
{
|
||||||
IGetD3DError();
|
IGetD3DError();
|
||||||
return false;
|
return false;
|
||||||
@ -4909,8 +4840,8 @@ bool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
|||||||
|
|
||||||
if( zDepth )
|
if( zDepth )
|
||||||
{
|
{
|
||||||
while( FAILED( fSettings.fDXError = fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
while( FAILED( fSettings.fDXError = d3d->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||||
D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, depthFormat ) ) )
|
D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, depthFormat ) ) )
|
||||||
{
|
{
|
||||||
if( stencilIndex < sizeof( depthFormats ) / sizeof( depthFormats[ 0 ] ) - 1 )
|
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,
|
if( FAILED( fSettings.fDXError = d3d->CheckDepthStencilMatch( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||||
surfFormat, depthFormat ) ) )
|
surfFormat, depthFormat ) ) )
|
||||||
{
|
{
|
||||||
IGetD3DError();
|
IGetD3DError();
|
||||||
return false;
|
return false;
|
||||||
@ -4952,6 +4883,7 @@ bool plDXPipeline::IFindRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
|||||||
height = owner->GetHeight();
|
height = owner->GetHeight();
|
||||||
bitDepth = owner->GetPixelSize();
|
bitDepth = owner->GetPixelSize();
|
||||||
|
|
||||||
|
IDirect3D9* d3d = hsGDirect3D::GetDirect3D();
|
||||||
if( flags != 0 )
|
if( flags != 0 )
|
||||||
{
|
{
|
||||||
if( flags & plRenderTarget::kIsTexture )
|
if( flags & plRenderTarget::kIsTexture )
|
||||||
@ -4972,8 +4904,8 @@ bool plDXPipeline::IFindRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check the device format
|
/// Check the device format
|
||||||
if( FAILED( fSettings.fDXError = fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
if( FAILED( fSettings.fDXError = d3d->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||||
{
|
{
|
||||||
if( bitDepth == 16 )
|
if( bitDepth == 16 )
|
||||||
{
|
{
|
||||||
@ -4985,8 +4917,8 @@ bool plDXPipeline::IFindRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &sur
|
|||||||
bitDepth = 16;
|
bitDepth = 16;
|
||||||
surfFormat = D3DFMT_A4R4G4B4;
|
surfFormat = D3DFMT_A4R4G4B4;
|
||||||
}
|
}
|
||||||
if( FAILED( fSettings.fDXError = fD3DObject->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
if( FAILED( fSettings.fDXError = d3d->CheckDeviceFormat( fCurrentAdapter, fCurrentDevice->fDDType, fCurrentMode->fDDmode.Format,
|
||||||
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
D3DUSAGE_RENDERTARGET, resType, surfFormat ) ) )
|
||||||
{
|
{
|
||||||
IGetD3DError();
|
IGetD3DError();
|
||||||
return false;
|
return false;
|
||||||
@ -8702,11 +8634,6 @@ bool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, uint32_t &numLevels,
|
|||||||
{
|
{
|
||||||
uint32_t sizeMask = 0x03;
|
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;
|
int maxLevel = mipmap->GetNumLevels() - 1;
|
||||||
|
|
||||||
/// 9.7.2000 - Also do this test if the card doesn't support
|
/// 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]
|
// is [x/w, y/w, z/w + t/s, 1/sw]
|
||||||
|
|
||||||
|
|
||||||
if( fSettings.fD3DCaps & kCapsWBuffer )
|
float scale = 1.f - float(fCurrRenderLayer) * fTweaks.fPerspLayerScale;
|
||||||
{
|
float zTrans = -scale * float(fCurrRenderLayer) * fTweaks.fPerspLayerTrans;
|
||||||
// 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;
|
|
||||||
|
|
||||||
cam2ndc.fMap[0][0] *= scale;
|
cam2ndc.fMap[0][0] *= scale;
|
||||||
cam2ndc.fMap[1][1] *= 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[2][2] *= scale;
|
||||||
cam2ndc.fMap[1][1] *= 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
|
else
|
||||||
{
|
{
|
||||||
@ -11417,9 +11325,6 @@ void plDXPipeline::IRenderProjectionEach(const plRenderPrimFunc& render, hsGMate
|
|||||||
|
|
||||||
int iNextPass = iPass + fCurrNumLayers;
|
int iNextPass = iPass + fCurrNumLayers;
|
||||||
|
|
||||||
if( fSettings.fLimitedProj && (material->GetLayer(iPass)->GetUVWSrc() & ~plLayerInterface::kUVWIdxMask) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// For each projector:
|
// For each projector:
|
||||||
int k;
|
int k;
|
||||||
for( k = 0; k < fLights.fProjEach.GetCount(); 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()) )
|
if( !(slave && slave->fCaster && slave->fCaster->GetKey()) )
|
||||||
return;
|
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
|
// Ref the shadow caster so we're sure it will still be around when we go to
|
||||||
// render it.
|
// render it.
|
||||||
slave->fCaster->GetKey()->RefObject();
|
slave->fCaster->GetKey()->RefObject();
|
||||||
|
@ -187,21 +187,17 @@ protected:
|
|||||||
kCapsExpFog = 0x00000040,
|
kCapsExpFog = 0x00000040,
|
||||||
kCapsExp2Fog = 0x00000080,
|
kCapsExp2Fog = 0x00000080,
|
||||||
kCapsRangeFog = 0x00000100,
|
kCapsRangeFog = 0x00000100,
|
||||||
kCapsWBuffer = 0x00000200,
|
kCapsTexBoundToStage = 0x00000200,
|
||||||
kCapsTexBoundToStage = 0x00000400,
|
kCapsLODWatch = 0x00000400,
|
||||||
kCapsDither = 0x00000800,
|
kCapsFSAntiAlias = 0x00000800,
|
||||||
kCapsLODWatch = 0x00001000,
|
kCapsLuminanceTextures = 0x00001000,
|
||||||
kCapsFSAntiAlias = 0x00002000,
|
kCapsDoesSmallTextures = 0x00002000,
|
||||||
kCapsLuminanceTextures = 0x00004000,
|
kCapsDoesWFog = 0x00004000,
|
||||||
kCapsDoesSmallTextures = 0x00008000,
|
kCapsPixelFog = 0x00008000,
|
||||||
kCapsDoesWFog = 0x00010000,
|
kCapsHasBadYonStuff = 0x00010000,
|
||||||
kCapsPixelFog = 0x00020000,
|
kCapsNpotTextures = 0x00020000,
|
||||||
kCapsHasBadYonStuff = 0x00040000,
|
kCapsCubicTextures = 0x00040000,
|
||||||
kCapsNoKindaSmallTexs = 0x00080000,
|
kCapsCubicMipmap = 0x00080000
|
||||||
kCapsNpotTextures = 0x00100000,
|
|
||||||
|
|
||||||
kCapsCubicTextures = 0x00200000,
|
|
||||||
kCapsCubicMipmap = 0x00400000
|
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
kKNone = 0x0,
|
kKNone = 0x0,
|
||||||
@ -212,7 +208,6 @@ protected:
|
|||||||
plDXPlateManager* fPlateMgr;
|
plDXPlateManager* fPlateMgr;
|
||||||
|
|
||||||
// The main D3D interfaces
|
// The main D3D interfaces
|
||||||
LPDIRECT3D9 fD3DObject; // The main D3D object
|
|
||||||
LPDIRECT3DDEVICE9 fD3DDevice; // The D3D rendering device
|
LPDIRECT3DDEVICE9 fD3DDevice; // The D3D rendering device
|
||||||
IDirect3DSurface9* fD3DMainSurface;
|
IDirect3DSurface9* fD3DMainSurface;
|
||||||
IDirect3DSurface9* fD3DDepthSurface;
|
IDirect3DSurface9* fD3DDepthSurface;
|
||||||
@ -506,7 +501,6 @@ protected:
|
|||||||
void ISetCurrentDevice( D3DEnum_DeviceInfo *dev );
|
void ISetCurrentDevice( D3DEnum_DeviceInfo *dev );
|
||||||
void ISetCurrentMode( D3DEnum_ModeInfo *mode );
|
void ISetCurrentMode( D3DEnum_ModeInfo *mode );
|
||||||
|
|
||||||
bool ICreateMaster();
|
|
||||||
bool ICreateDevice(bool windowed);
|
bool ICreateDevice(bool windowed);
|
||||||
bool ICreateNormalSurfaces();
|
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
|
#define DYNAHEADER 1
|
||||||
#endif // HS_BUILD_FOR_WIN32
|
#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;
|
class hsStream;
|
||||||
struct D3DEnum_DeviceInfo;
|
struct D3DEnum_DeviceInfo;
|
||||||
@ -127,9 +124,6 @@ public:
|
|||||||
void AddFSAAType( uint8_t type ) { fFSAATypes.Append( type ); }
|
void AddFSAAType( uint8_t type ) { fFSAATypes.Append( type ); }
|
||||||
|
|
||||||
void SetCanRenderToCubics( bool can ) { fCanRenderToCubics = can; }
|
void SetCanRenderToCubics( bool can ) { fCanRenderToCubics = can; }
|
||||||
|
|
||||||
void Read(hsStream* s);
|
|
||||||
void Write(hsStream* s) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class hsG3DDeviceRecord
|
class hsG3DDeviceRecord
|
||||||
@ -149,24 +143,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
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 fFlags;
|
||||||
|
|
||||||
uint32_t fG3DDeviceType;
|
uint32_t fG3DDeviceType;
|
||||||
@ -184,7 +160,6 @@ protected:
|
|||||||
|
|
||||||
hsTArray<hsG3DDeviceMode> fModes;
|
hsTArray<hsG3DDeviceMode> fModes;
|
||||||
|
|
||||||
/// New to Version 3
|
|
||||||
float fZBiasRating;
|
float fZBiasRating;
|
||||||
float fLODBiasRating;
|
float fLODBiasRating;
|
||||||
float fFogExpApproxStart;
|
float fFogExpApproxStart;
|
||||||
@ -193,17 +168,12 @@ protected:
|
|||||||
// (i.e. for Z fog, it's a percentage of 1 to add on,
|
// (i.e. for Z fog, it's a percentage of 1 to add on,
|
||||||
// for W fog, it's a percentage of the yon)
|
// for W fog, it's a percentage of the yon)
|
||||||
|
|
||||||
/// Version 7 - Fog Knee values
|
|
||||||
float fFogKnees[ kNumFogTypes ];
|
float fFogKnees[ kNumFogTypes ];
|
||||||
float fFogKneeVals[ kNumFogTypes ];
|
float fFogKneeVals[ kNumFogTypes ];
|
||||||
|
|
||||||
/// Version 9 - The actual AA setting we use
|
|
||||||
uint8_t fAASetting;
|
uint8_t fAASetting;
|
||||||
|
|
||||||
/// Version A - the anisotropic level we use
|
|
||||||
uint8_t fMaxAnisotropicSamples; // 1 to disable, up to max allowed in hardware
|
uint8_t fMaxAnisotropicSamples; // 1 to disable, up to max allowed in hardware
|
||||||
int fPixelShaderMajorVer;
|
|
||||||
int fPixelShaderMinorVer;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
hsG3DDeviceRecord();
|
hsG3DDeviceRecord();
|
||||||
@ -274,17 +244,6 @@ public:
|
|||||||
void ClearModes();
|
void ClearModes();
|
||||||
void Clear();
|
void Clear();
|
||||||
void RemoveDiscarded();
|
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
|
class hsG3DDeviceModeRecord
|
||||||
@ -309,47 +268,34 @@ class hsG3DDeviceSelector : public hsRefCnt
|
|||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
kDevTypeUnknown = 0,
|
kDevTypeUnknown = 0,
|
||||||
kDevTypeGlide,
|
|
||||||
kDevTypeDirect3D,
|
kDevTypeDirect3D,
|
||||||
kDevTypeOpenGL,
|
kDevTypeOpenGL,
|
||||||
kDevTypeDirect3DTnL,
|
|
||||||
|
|
||||||
kNumDevTypes
|
kNumDevTypes
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
kHHTypeUnknown = 0,
|
kHHTypeUnknown = 0,
|
||||||
kHHD3DNullDev,
|
kHHD3DNullDev,
|
||||||
kHHD3DRampDev,
|
|
||||||
kHHD3DRGBDev,
|
|
||||||
kHHD3DHALDev,
|
kHHD3DHALDev,
|
||||||
kHHD3DMMXDev,
|
|
||||||
kHHD3DTnLHalDev,
|
kHHD3DTnLHalDev,
|
||||||
kHHD3DRefDev,
|
kHHD3DRefDev,
|
||||||
kHHD3D3dfxDev,
|
|
||||||
kHHD3D3dfxVoodoo5Dev,
|
|
||||||
|
|
||||||
kNumHHTypes
|
kNumHHTypes
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
kCapsNone = 0,
|
kCapsNone = 0,
|
||||||
kCapsNoWindow,
|
|
||||||
kCapsMipmap,
|
kCapsMipmap,
|
||||||
kCapsPerspective,
|
kCapsPerspective,
|
||||||
kCapsHardware,
|
kCapsHardware,
|
||||||
kCapsWBuffer,
|
|
||||||
kCapsCompressTextures,
|
kCapsCompressTextures,
|
||||||
kCapsHWTransform,
|
kCapsHWTransform,
|
||||||
kCapsDither,
|
|
||||||
kCapsFogLinear,
|
kCapsFogLinear,
|
||||||
kCapsFogExp,
|
kCapsFogExp,
|
||||||
kCapsFogExp2,
|
kCapsFogExp2,
|
||||||
kCapsFogRange,
|
kCapsFogRange,
|
||||||
kCapsLODWatch,
|
|
||||||
kCapsUNUSED,
|
|
||||||
kCapsDoesSmallTextures,
|
kCapsDoesSmallTextures,
|
||||||
kCapsPixelFog,
|
kCapsPixelFog,
|
||||||
kCapsBadYonStuff,
|
kCapsBadYonStuff,
|
||||||
kCapsNoKindaSmallTexs,
|
|
||||||
kCapsCubicTextures,
|
kCapsCubicTextures,
|
||||||
kCapsCubicMipmap,
|
kCapsCubicMipmap,
|
||||||
kCapsZBias,
|
kCapsZBias,
|
||||||
@ -360,7 +306,6 @@ public:
|
|||||||
kCapsCantShadow,
|
kCapsCantShadow,
|
||||||
kCapsMaxUVWSrc2,
|
kCapsMaxUVWSrc2,
|
||||||
kCapsCantProj,
|
kCapsCantProj,
|
||||||
kCapsLimitedProj,
|
|
||||||
kCapsShareDepth,
|
kCapsShareDepth,
|
||||||
kCapsBadManaged,
|
kCapsBadManaged,
|
||||||
kCapsNoAniso,
|
kCapsNoAniso,
|
||||||
@ -381,37 +326,19 @@ protected:
|
|||||||
|
|
||||||
char fErrorString[ 128 ];
|
char fErrorString[ 128 ];
|
||||||
|
|
||||||
|
void IClear();
|
||||||
|
void IRemoveDiscarded();
|
||||||
|
|
||||||
void ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG3DDeviceRecord& srcDevRec);
|
void ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG3DDeviceRecord& srcDevRec);
|
||||||
void ITryDirect3DTnLDriver(D3DEnum_DriverInfo* drivInfo);
|
void ITryDirect3DTnLDriver(D3DEnum_DriverInfo* drivInfo);
|
||||||
void ITryDirect3DTnL(hsWinRef winRef);
|
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,
|
void IFudgeDirectXDevice( hsG3DDeviceRecord &record,
|
||||||
D3DEnum_DriverInfo *driverInfo, D3DEnum_DeviceInfo *deviceInfo );
|
D3DEnum_DriverInfo *driverInfo, D3DEnum_DeviceInfo *deviceInfo );
|
||||||
uint32_t IAdjustDirectXMemory( uint32_t cardMem );
|
uint32_t IAdjustDirectXMemory( uint32_t cardMem );
|
||||||
|
|
||||||
bool IGetD3DCardInfo( hsG3DDeviceRecord &record, void *driverInfo, void *deviceInfo,
|
bool IGetD3DCardInfo( hsG3DDeviceRecord &record, void *driverInfo, void *deviceInfo,
|
||||||
uint32_t *vendorID, uint32_t *deviceID, char **driverString, char **descString );
|
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 );
|
void ISetFudgeFactors( uint8_t chipsetID, hsG3DDeviceRecord &record );
|
||||||
|
|
||||||
@ -419,65 +346,10 @@ public:
|
|||||||
hsG3DDeviceSelector();
|
hsG3DDeviceSelector();
|
||||||
virtual ~hsG3DDeviceSelector();
|
virtual ~hsG3DDeviceSelector();
|
||||||
|
|
||||||
void Clear();
|
|
||||||
void RemoveDiscarded();
|
|
||||||
void RemoveUnusableDevModes(bool bTough); // Removes modes and devices not allowed supported in release
|
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);
|
void Enumerate(hsWinRef winRef);
|
||||||
hsTArray<hsG3DDeviceRecord>& GetDeviceRecords() { return fRecords; }
|
|
||||||
|
|
||||||
bool GetDefault(hsG3DDeviceModeRecord *dmr);
|
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
|
#endif // hsG3DDeviceSelector_inc
|
||||||
|
Reference in New Issue
Block a user