- Added a check for D3DLINECAPS_ANTIALIAS, but this is complicated by the

fact that NVidia's don't report it, even though they support it. If there
  are any cards that no longer have antialised lines on the automap, please
  let me know.
- Added vid_hwaalines cvar to force antialiased lines off for the
  Direct3D renderer, in case it doesn't really support them.


SVN r1210 (trunk)
This commit is contained in:
Randy Heit 2008-09-10 03:33:02 +00:00
parent d02097976e
commit d22f3ebfa6
4 changed files with 44 additions and 13 deletions

View file

@ -1,3 +1,11 @@
September 9, 2008
- Added a check for D3DLINECAPS_ANTIALIAS, but this is complicated by the
fact that NVidia's don't report it, even though they support it. If there
are any cards that no longer have antialised lines on the automap, please
let me know.
- Added vid_hwaalines cvar to force antialiased lines off for the
Direct3D renderer, in case it doesn't really support them.
September 9, 2008 (Changes by Graf Zahl) September 9, 2008 (Changes by Graf Zahl)
- Fixed: The new rolloff values being stored in FSoundChan need to be serialized - Fixed: The new rolloff values being stored in FSoundChan need to be serialized
for savegames. for savegames.

View file

@ -1,6 +1,6 @@
/* /*
** i_sound.cpp ** i_sound.cpp
** System interface for sound; uses fmod.dll ** System interface for sound; uses FMOD Ex.
** **
**--------------------------------------------------------------------------- **---------------------------------------------------------------------------
** Copyright 1998-2008 Randy Heit ** Copyright 1998-2008 Randy Heit

View file

@ -214,6 +214,7 @@ CUSTOM_CVAR(Bool, vid_hw2d, true, CVAR_NOINITCALL)
} }
CVAR(Int, d3d_showpacks, 0, 0) CVAR(Int, d3d_showpacks, 0, 0)
CVAR(Bool, vid_hwaalines, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
@ -273,9 +274,9 @@ D3DFB::D3DFB (int width, int height, bool fullscreen)
return; return;
} }
memcpy (SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256); memcpy(SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256);
Windowed = !(static_cast<Win32Video *>(Video)->GoFullscreen (fullscreen)); Windowed = !(static_cast<Win32Video *>(Video)->GoFullscreen(fullscreen));
TrueHeight = height; TrueHeight = height;
if (fullscreen) if (fullscreen)
@ -294,23 +295,23 @@ D3DFB::D3DFB (int width, int height, bool fullscreen)
LBOffsetI = (TrueHeight - Height) / 2; LBOffsetI = (TrueHeight - Height) / 2;
LBOffset = float(LBOffsetI); LBOffset = float(LBOffsetI);
FillPresentParameters (&d3dpp, fullscreen, VSync); FillPresentParameters(&d3dpp, fullscreen, VSync);
HRESULT hr; HRESULT hr;
if (FAILED(hr = D3D->CreateDevice (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window, if (FAILED(hr = D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice))) D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
{ {
if (FAILED(D3D->CreateDevice (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window, if (FAILED(D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice))) D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
{ {
if (d3dpp.FullScreen_RefreshRateInHz != 0) if (d3dpp.FullScreen_RefreshRateInHz != 0)
{ {
d3dpp.FullScreen_RefreshRateInHz = 0; d3dpp.FullScreen_RefreshRateInHz = 0;
if (FAILED(hr = D3D->CreateDevice (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window, if (FAILED(hr = D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice))) D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
{ {
if (FAILED(D3D->CreateDevice (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window, if (FAILED(D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice))) D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
{ {
D3DDevice = NULL; D3DDevice = NULL;
@ -321,14 +322,34 @@ D3DFB::D3DFB (int width, int height, bool fullscreen)
} }
if (D3DDevice != NULL) if (D3DDevice != NULL)
{ {
CreateResources (); D3DADAPTER_IDENTIFIER9 adapter_id;
SetInitialState (); D3DDEVICE_CREATION_PARAMETERS create_params;
if (FAILED(hr = D3DDevice->GetDeviceCaps(&DeviceCaps)))
{
memset(&DeviceCaps, 0, sizeof(DeviceCaps));
}
if (SUCCEEDED(hr = D3DDevice->GetCreationParameters(&create_params)) &&
SUCCEEDED(hr = D3D->GetAdapterIdentifier(create_params.AdapterOrdinal, 0, &adapter_id)))
{
// NVidia's drivers lie, claiming they don't support
// antialiased lines when, really, they do.
if (adapter_id.VendorId == 0x10de)
{
DeviceCaps.LineCaps |= D3DLINECAPS_ANTIALIAS;
}
// I don't know about ATI's drivers. The only ATI device
// I have readily available to test with (a Mobility X300)
// really doesn't support them.
}
CreateResources();
SetInitialState();
} }
} }
D3DFB::~D3DFB () D3DFB::~D3DFB ()
{ {
ReleaseResources (); ReleaseResources();
SAFE_RELEASE( D3DDevice ); SAFE_RELEASE( D3DDevice );
delete[] QuadExtra; delete[] QuadExtra;
} }
@ -352,8 +373,6 @@ void D3DFB::SetInitialState()
D3DDevice->SetSamplerState(1, D3DSAMP_ADDRESSU, SM14 ? D3DTADDRESS_BORDER : D3DTADDRESS_CLAMP); D3DDevice->SetSamplerState(1, D3DSAMP_ADDRESSU, SM14 ? D3DTADDRESS_BORDER : D3DTADDRESS_CLAMP);
D3DDevice->SetSamplerState(1, D3DSAMP_ADDRESSV, SM14 ? D3DTADDRESS_BORDER : D3DTADDRESS_CLAMP); D3DDevice->SetSamplerState(1, D3DSAMP_ADDRESSV, SM14 ? D3DTADDRESS_BORDER : D3DTADDRESS_CLAMP);
D3DDevice->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, TRUE);
NeedGammaUpdate = true; NeedGammaUpdate = true;
NeedPalUpdate = true; NeedPalUpdate = true;
OldRenderTarget = NULL; OldRenderTarget = NULL;
@ -946,6 +965,7 @@ void D3DFB::Draw3DPart(bool copy3d)
DrawLetterbox(); DrawLetterbox();
InScene = true; InScene = true;
D3DDevice->BeginScene(); D3DDevice->BeginScene();
D3DDevice->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, (DeviceCaps.LineCaps & D3DLINECAPS_ANTIALIAS) && vid_hwaalines);
assert(OldRenderTarget == NULL); assert(OldRenderTarget == NULL);
if (TempRenderTexture != NULL && if (TempRenderTexture != NULL &&
((Windowed && GammaFixerShader && TempRenderTexture != FinalWipeScreen) || GatheringWipeScreen || PixelDoubling)) ((Windowed && GammaFixerShader && TempRenderTexture != FinalWipeScreen) || GatheringWipeScreen || PixelDoubling))

View file

@ -324,6 +324,8 @@ private:
void EndLineBatch(); void EndLineBatch();
void EndBatch(); void EndBatch();
D3DCAPS9 DeviceCaps;
// State // State
void EnableAlphaTest(BOOL enabled); void EnableAlphaTest(BOOL enabled);
void SetAlphaBlend(D3DBLENDOP op, D3DBLEND srcblend=D3DBLEND(0), D3DBLEND destblend=D3DBLEND(0)); void SetAlphaBlend(D3DBLENDOP op, D3DBLEND srcblend=D3DBLEND(0), D3DBLEND destblend=D3DBLEND(0));
@ -365,6 +367,7 @@ private:
bool InScene; bool InScene;
bool SM14; bool SM14;
bool GatheringWipeScreen; bool GatheringWipeScreen;
bool AALines;
D3DPal *Palettes; D3DPal *Palettes;
D3DTex *Textures; D3DTex *Textures;
PackingTexture *Packs; PackingTexture *Packs;