mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- removed DirectDraw backend.
This commit is contained in:
parent
3c3c2f03e8
commit
40bbe5cd8a
8 changed files with 4 additions and 1467 deletions
|
@ -493,7 +493,6 @@ set( PLAT_WIN32_SOURCES
|
||||||
win32/critsec.cpp
|
win32/critsec.cpp
|
||||||
win32/fb_d3d9.cpp
|
win32/fb_d3d9.cpp
|
||||||
win32/fb_d3d9_wipe.cpp
|
win32/fb_d3d9_wipe.cpp
|
||||||
win32/fb_ddraw.cpp
|
|
||||||
win32/hardware.cpp
|
win32/hardware.cpp
|
||||||
win32/helperthread.cpp
|
win32/helperthread.cpp
|
||||||
win32/i_cd.cpp
|
win32/i_cd.cpp
|
||||||
|
|
|
@ -95,7 +95,7 @@ EXTERN_CVAR(Float, transsouls)
|
||||||
EXTERN_CVAR(Int, vid_refreshrate)
|
EXTERN_CVAR(Int, vid_refreshrate)
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
extern cycle_t BlitCycles;
|
cycle_t BlitCycles;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void gl_LoadExtensions();
|
void gl_LoadExtensions();
|
||||||
|
|
|
@ -476,7 +476,7 @@ VideoModes[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
cycle_t BlitCycles;
|
extern cycle_t BlitCycles;
|
||||||
cycle_t FlipCycles;
|
cycle_t FlipCycles;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ CUSTOM_CVAR (Float, bgamma, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
|
||||||
static cycle_t BlitCycles;
|
extern cycle_t BlitCycles;
|
||||||
static cycle_t SDLFlipCycles;
|
static cycle_t SDLFlipCycles;
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -97,7 +97,6 @@ class Win32Video : public IVideo
|
||||||
void AddLetterboxModes ();
|
void AddLetterboxModes ();
|
||||||
void ScaleModes (int doubling);
|
void ScaleModes (int doubling);
|
||||||
|
|
||||||
friend class DDrawFB;
|
|
||||||
friend class D3DFB;
|
friend class D3DFB;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,87 +16,6 @@
|
||||||
|
|
||||||
extern HANDLE FPSLimitEvent;
|
extern HANDLE FPSLimitEvent;
|
||||||
|
|
||||||
class DDrawFB : public BaseWinFB
|
|
||||||
{
|
|
||||||
typedef BaseWinFB Super;
|
|
||||||
public:
|
|
||||||
DDrawFB (int width, int height, bool fullscreen);
|
|
||||||
~DDrawFB ();
|
|
||||||
|
|
||||||
bool IsValid ();
|
|
||||||
bool Lock (bool buffer);
|
|
||||||
void Unlock ();
|
|
||||||
void ForceBuffering (bool force);
|
|
||||||
void Update ();
|
|
||||||
PalEntry *GetPalette ();
|
|
||||||
void GetFlashedPalette (PalEntry pal[256]);
|
|
||||||
void UpdatePalette ();
|
|
||||||
bool SetGamma (float gamma);
|
|
||||||
bool SetFlash (PalEntry rgb, int amount);
|
|
||||||
void GetFlash (PalEntry &rgb, int &amount);
|
|
||||||
int GetPageCount ();
|
|
||||||
int QueryNewPalette ();
|
|
||||||
void PaletteChanged ();
|
|
||||||
void SetVSync (bool vsync);
|
|
||||||
void NewRefreshRate();
|
|
||||||
HRESULT GetHR ();
|
|
||||||
bool Is8BitMode();
|
|
||||||
virtual int GetTrueHeight() { return TrueHeight; }
|
|
||||||
|
|
||||||
void Blank ();
|
|
||||||
bool PaintToWindow ();
|
|
||||||
|
|
||||||
private:
|
|
||||||
enum LockSurfRes { NoGood, Good, GoodWasLost };
|
|
||||||
|
|
||||||
bool CreateResources ();
|
|
||||||
void ReleaseResources ();
|
|
||||||
bool CreateSurfacesAttached ();
|
|
||||||
bool CreateSurfacesComplex ();
|
|
||||||
bool CreateBlitterSource ();
|
|
||||||
LockSurfRes LockSurf (LPRECT lockrect, LPDIRECTDRAWSURFACE surf);
|
|
||||||
void RebuildColorTable ();
|
|
||||||
void MaybeCreatePalette ();
|
|
||||||
bool AddBackBuf (LPDIRECTDRAWSURFACE *surface, int num);
|
|
||||||
HRESULT AttemptRestore ();
|
|
||||||
|
|
||||||
HRESULT LastHR;
|
|
||||||
uint8_t GammaTable[3][256];
|
|
||||||
PalEntry SourcePalette[256];
|
|
||||||
PALETTEENTRY PalEntries[256];
|
|
||||||
DWORD FlipFlags;
|
|
||||||
|
|
||||||
LPDIRECTDRAWPALETTE Palette;
|
|
||||||
LPDIRECTDRAWSURFACE PrimarySurf;
|
|
||||||
LPDIRECTDRAWSURFACE BackSurf;
|
|
||||||
LPDIRECTDRAWSURFACE BackSurf2;
|
|
||||||
LPDIRECTDRAWSURFACE BlitSurf;
|
|
||||||
LPDIRECTDRAWSURFACE LockingSurf;
|
|
||||||
LPDIRECTDRAWCLIPPER Clipper;
|
|
||||||
HPALETTE GDIPalette;
|
|
||||||
DWORD ClipSize;
|
|
||||||
PalEntry Flash;
|
|
||||||
int FlashAmount;
|
|
||||||
int BufferCount;
|
|
||||||
int BufferPitch;
|
|
||||||
int TrueHeight;
|
|
||||||
int PixelDoubling;
|
|
||||||
float Gamma;
|
|
||||||
|
|
||||||
bool NeedGammaUpdate;
|
|
||||||
bool NeedPalUpdate;
|
|
||||||
bool NeedResRecreate;
|
|
||||||
bool PaletteChangeExpected;
|
|
||||||
bool MustBuffer; // The screen is not 8-bit, or there is no backbuffer
|
|
||||||
bool BufferingNow; // Most recent Lock was buffered
|
|
||||||
bool WasBuffering; // Second most recent Lock was buffered
|
|
||||||
bool Write8bit;
|
|
||||||
bool UpdatePending; // On final unlock, call Update()
|
|
||||||
bool UseBlitter; // Use blitter to copy from sys mem to video mem
|
|
||||||
bool UsePfx;
|
|
||||||
|
|
||||||
DDrawFB() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
class D3DFB : public BaseWinFB
|
class D3DFB : public BaseWinFB
|
||||||
{
|
{
|
||||||
|
|
|
@ -672,70 +672,11 @@ DFrameBuffer *Win32Video::CreateFrameBuffer (int width, int height, bool bgra, b
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fb = new DDrawFB (width, height, fullscreen);
|
I_FatalError("Unable to create framebuffer. Direct3D not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG1 ("New fb created @ %p\n", fb);
|
LOG1 ("New fb created @ %p\n", fb);
|
||||||
|
|
||||||
// If we could not create the framebuffer, try again with slightly
|
|
||||||
// different parameters in this order:
|
|
||||||
// 1. Try with the closest size
|
|
||||||
// 2. Try in the opposite screen mode with the original size
|
|
||||||
// 3. Try in the opposite screen mode with the closest size
|
|
||||||
// This is a somewhat confusing mass of recursion here.
|
|
||||||
|
|
||||||
while (fb == NULL || !fb->IsValid ())
|
|
||||||
{
|
|
||||||
static HRESULT hr;
|
|
||||||
|
|
||||||
if (fb != NULL)
|
|
||||||
{
|
|
||||||
if (retry == 0)
|
|
||||||
{
|
|
||||||
hr = fb->GetHR ();
|
|
||||||
}
|
|
||||||
delete fb;
|
|
||||||
|
|
||||||
LOG1 ("fb is bad: %08lx\n", hr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG ("Could not create fb at all\n");
|
|
||||||
}
|
|
||||||
screen = NULL;
|
|
||||||
|
|
||||||
LOG1 ("Retry number %d\n", retry);
|
|
||||||
|
|
||||||
switch (retry)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
owidth = width;
|
|
||||||
oheight = height;
|
|
||||||
case 2:
|
|
||||||
// Try a different resolution. Hopefully that will work.
|
|
||||||
I_ClosestResolution (&width, &height, 8);
|
|
||||||
LOG2 ("Retry with size %d,%d\n", width, height);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
// Try changing fullscreen mode. Maybe that will work.
|
|
||||||
width = owidth;
|
|
||||||
height = oheight;
|
|
||||||
fullscreen = !fullscreen;
|
|
||||||
LOG1 ("Retry with fullscreen %d\n", fullscreen);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// I give up!
|
|
||||||
LOG3 ("Could not create new screen (%d x %d): %08lx", owidth, oheight, hr);
|
|
||||||
I_FatalError ("Could not create new screen (%d x %d): %08lx", owidth, oheight, hr);
|
|
||||||
}
|
|
||||||
|
|
||||||
++retry;
|
|
||||||
fb = static_cast<DDrawFB *>(CreateFrameBuffer (width, height, bgra, fullscreen, NULL));
|
|
||||||
}
|
|
||||||
retry = 0;
|
|
||||||
|
|
||||||
fb->SetFlash (flashColor, flashAmount);
|
fb->SetFlash (flashColor, flashAmount);
|
||||||
return fb;
|
return fb;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue