fix Savage crashes in D3D
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[0000]
|
||||
DriverRegex=Voodoo3|3dfx
|
||||
Renderers=d3d
|
||||
Renderers=d3d,opengl
|
||||
Width=640
|
||||
Height=480
|
||||
DisplayColor=16
|
||||
@@ -36,25 +36,29 @@ AntiAliasing=0
|
||||
|
||||
[0003]
|
||||
DriverRegex=Savage
|
||||
Renderers=d3d,opengl // OpenGL driver doesn't support EXT_texture_env_combine
|
||||
// OpenGL is unusable on my Savage IV with even the latest drivers.
|
||||
// It draws 30 frames of gibberish then crashes. I haven't spent time
|
||||
// debugging because the d3d renderer works (mostly!). -Chris
|
||||
Renderers=d3d
|
||||
Width=640
|
||||
Height=480
|
||||
DisplayColor=16
|
||||
TextureColor=16
|
||||
AntiAliasing=0
|
||||
|
||||
[0004]
|
||||
DriverRegex=OpenGL // Please add a comment. What is this supposed to match? -Chris
|
||||
Renderers=opengl
|
||||
Width=640
|
||||
Height=480
|
||||
DisplayColor=16
|
||||
TextureColor=16
|
||||
AntiAliasing=1 // Right now, they've got to have NVidia or ATi Cards anyway..
|
||||
#// Please add a comment. What is this supposed to match? -Chris
|
||||
#[0004]
|
||||
#DriverRegex=OpenGL
|
||||
#Renderers=opengl
|
||||
#Width=640
|
||||
#Height=480
|
||||
#DisplayColor=16
|
||||
#TextureColor=16
|
||||
#AntiAliasing=1 // Right now, they've got to have NVidia or ATi Cards anyway..
|
||||
|
||||
// Default graphics settings used for all cards that don't match above.
|
||||
// This must be the very last entry!
|
||||
[0005]
|
||||
[0004]
|
||||
DriverRegex=
|
||||
Renderers=opengl,d3d
|
||||
Width=640
|
||||
|
||||
@@ -91,7 +91,15 @@ static void SetPalette( unsigned TexResource )
|
||||
|
||||
/* Load it. */
|
||||
#ifndef _XBOX
|
||||
g_pd3dDevice->SetPaletteEntries( iPalIndex, g_TexResourceToTexturePalette[TexResource].p );
|
||||
TexturePalette& pal = g_TexResourceToTexturePalette[TexResource];
|
||||
|
||||
// Cards that don't support palettes with alpha will crash unless
|
||||
// all entires have full alpha.
|
||||
if( ! (g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) )
|
||||
for(int j=0; j<256; j++)
|
||||
pal.p[j].peFlags = 255;
|
||||
|
||||
g_pd3dDevice->SetPaletteEntries( iPalIndex, pal.p );
|
||||
#else
|
||||
ASSERT(0);
|
||||
#endif
|
||||
@@ -529,6 +537,11 @@ void RageDisplay_D3D::EndFrame()
|
||||
|
||||
bool RageDisplay_D3D::SupportsTextureFormat( PixelFormat pixfmt )
|
||||
{
|
||||
// Some cards (Savage) don't support alpha in palettes.
|
||||
// Don't allow paletted textures if this is the case.
|
||||
if( pixfmt == FMT_PAL && !(g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) )
|
||||
return false;
|
||||
|
||||
D3DFORMAT d3dfmt = D3DFORMATS[pixfmt];
|
||||
HRESULT hr = g_pd3d->CheckDeviceFormat(
|
||||
D3DADAPTER_DEFAULT,
|
||||
@@ -717,7 +730,6 @@ void RageDisplay_D3D::SetTextureModeGlow(GlowMode m)
|
||||
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
||||
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
|
||||
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
|
||||
|
||||
}
|
||||
|
||||
void RageDisplay_D3D::SetTextureFiltering( bool b )
|
||||
|
||||
@@ -1,8 +1,25 @@
|
||||
#ifndef RAGEDISPLAY_D3D_H
|
||||
#define RAGEDISPLAY_D3D_H
|
||||
|
||||
class RageException_D3DNotInstalled: public exception { };
|
||||
class RageException_D3DNoAcceleration: public exception { };
|
||||
class RageException_D3DNotInstalled: public exception
|
||||
{
|
||||
const char *what() { return
|
||||
"DirectX 8.1 or greater is not installed. You can download it from:\n"
|
||||
"http://search.microsoft.com/gomsuri.asp?n=1&c=rp_BestBets&siteid=us&target=http://www.microsoft.com/downloads/details.aspx?FamilyID=a19bed22-0b25-4e5d-a584-6389d8a3dad0&displaylang=en"; }
|
||||
};
|
||||
class RageException_D3DNoAcceleration: public exception
|
||||
{
|
||||
const char *what() { return
|
||||
"Your system is reporting that Direct3D hardware acceleration is not available. "
|
||||
"Please obtain an updated driver from your video card manufacturer.\n\n"; }
|
||||
};
|
||||
class RageException_D3DNoPalettedAlpha: public exception
|
||||
{
|
||||
const char *what() { return
|
||||
"Your video card doesn'thardware acceleration is not available. "
|
||||
"Please obtain an updated driver from your video card manufacturer.\n\n"; }
|
||||
};
|
||||
|
||||
|
||||
class RageDisplay_D3D: public RageDisplay
|
||||
{
|
||||
|
||||
@@ -267,8 +267,6 @@ static void CheckSettings()
|
||||
#include "archutils/Win32/VideoDriverInfo.h"
|
||||
#include "regex.h"
|
||||
|
||||
static const CString D3DURL = "http://search.microsoft.com/gomsuri.asp?n=1&c=rp_BestBets&siteid=us&target=http://www.microsoft.com/downloads/details.aspx?FamilyID=a19bed22-0b25-4e5d-a584-6389d8a3dad0&displaylang=en";
|
||||
|
||||
RageDisplay *CreateDisplay()
|
||||
{
|
||||
/* We never want to bother users with having to decide which API to use.
|
||||
@@ -395,8 +393,9 @@ RageDisplay *CreateDisplay()
|
||||
error += "Initializing Direct3D...\n";
|
||||
try {
|
||||
return new RageDisplay_D3D( params );
|
||||
} catch(RageException_D3DNotInstalled e) {
|
||||
error += "DirectX 8.1 or greater is not installed. You can download it from:\n"+D3DURL+"\n\n";
|
||||
} catch(exception e) {
|
||||
error += e.what();
|
||||
error += "\n\n";
|
||||
} catch(RageException_D3DNoAcceleration e) {
|
||||
error += "Your system is reporting that Direct3D hardware acceleration is not available. "
|
||||
"Please obtain an updated driver from your video card manufacturer.\n\n";
|
||||
|
||||
Reference in New Issue
Block a user