diff --git a/docs/rh-log.txt b/docs/rh-log.txt index b8ec9ba28..5d182df5a 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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) - Fixed: The new rolloff values being stored in FSoundChan need to be serialized for savegames. diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index 3366ae8cf..434fc10a1 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -1,6 +1,6 @@ /* ** i_sound.cpp -** System interface for sound; uses fmod.dll +** System interface for sound; uses FMOD Ex. ** **--------------------------------------------------------------------------- ** Copyright 1998-2008 Randy Heit diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index fe61f07b9..364dffe92 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -214,6 +214,7 @@ CUSTOM_CVAR(Bool, vid_hw2d, true, CVAR_NOINITCALL) } CVAR(Int, d3d_showpacks, 0, 0) +CVAR(Bool, vid_hwaalines, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // CODE -------------------------------------------------------------------- @@ -273,9 +274,9 @@ D3DFB::D3DFB (int width, int height, bool fullscreen) return; } - memcpy (SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256); + memcpy(SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256); - Windowed = !(static_cast(Video)->GoFullscreen (fullscreen)); + Windowed = !(static_cast(Video)->GoFullscreen(fullscreen)); TrueHeight = height; if (fullscreen) @@ -294,23 +295,23 @@ D3DFB::D3DFB (int width, int height, bool fullscreen) LBOffsetI = (TrueHeight - Height) / 2; LBOffset = float(LBOffsetI); - FillPresentParameters (&d3dpp, fullscreen, VSync); + FillPresentParameters(&d3dpp, fullscreen, VSync); 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))) { - 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))) { if (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))) { - 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))) { D3DDevice = NULL; @@ -321,14 +322,34 @@ D3DFB::D3DFB (int width, int height, bool fullscreen) } if (D3DDevice != NULL) { - CreateResources (); - SetInitialState (); + D3DADAPTER_IDENTIFIER9 adapter_id; + 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 () { - ReleaseResources (); + ReleaseResources(); SAFE_RELEASE( D3DDevice ); delete[] QuadExtra; } @@ -352,8 +373,6 @@ void D3DFB::SetInitialState() D3DDevice->SetSamplerState(1, D3DSAMP_ADDRESSU, SM14 ? D3DTADDRESS_BORDER : D3DTADDRESS_CLAMP); D3DDevice->SetSamplerState(1, D3DSAMP_ADDRESSV, SM14 ? D3DTADDRESS_BORDER : D3DTADDRESS_CLAMP); - D3DDevice->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, TRUE); - NeedGammaUpdate = true; NeedPalUpdate = true; OldRenderTarget = NULL; @@ -946,6 +965,7 @@ void D3DFB::Draw3DPart(bool copy3d) DrawLetterbox(); InScene = true; D3DDevice->BeginScene(); + D3DDevice->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, (DeviceCaps.LineCaps & D3DLINECAPS_ANTIALIAS) && vid_hwaalines); assert(OldRenderTarget == NULL); if (TempRenderTexture != NULL && ((Windowed && GammaFixerShader && TempRenderTexture != FinalWipeScreen) || GatheringWipeScreen || PixelDoubling)) diff --git a/src/win32/win32iface.h b/src/win32/win32iface.h index 14cc3194b..6e1bd7f5f 100644 --- a/src/win32/win32iface.h +++ b/src/win32/win32iface.h @@ -324,6 +324,8 @@ private: void EndLineBatch(); void EndBatch(); + D3DCAPS9 DeviceCaps; + // State void EnableAlphaTest(BOOL enabled); void SetAlphaBlend(D3DBLENDOP op, D3DBLEND srcblend=D3DBLEND(0), D3DBLEND destblend=D3DBLEND(0)); @@ -365,6 +367,7 @@ private: bool InScene; bool SM14; bool GatheringWipeScreen; + bool AALines; D3DPal *Palettes; D3DTex *Textures; PackingTexture *Packs;