mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Fixed: DDrawFB::Lock() should only act on NeedResRecreate when going from LockCount 0 -> 1.
- Fixed: When DDrawFB::Lock() has to recreate resources, it left the LockCount at 0. This causes problems if something else locks it before it is unlocked, because the second locker will think it is the first. This happens in R_RenderViewToCanvas(). See DDrawFB::PaletteChanged() for the most common reason why Lock() would need to recreate resources. - Fixed: DDrawFB::CreateSurfacesComplex() had debugging cruft left in that skipped all but the last attempts. - Fixed logging of video debug info to a file to not multiply define dbg. SVN r3195 (trunk)
This commit is contained in:
parent
d642c5b1b0
commit
11c24334c5
3 changed files with 18 additions and 6 deletions
|
@ -461,7 +461,7 @@ bool DDrawFB::CreateSurfacesComplex ()
|
|||
{
|
||||
DDSURFACEDESC ddsd = { sizeof(ddsd), };
|
||||
HRESULT hr;
|
||||
int tries = 2;
|
||||
int tries = 0;
|
||||
|
||||
LOG ("creating surfaces using a complex primary\n");
|
||||
|
||||
|
@ -801,10 +801,14 @@ bool DDrawFB::Lock ()
|
|||
|
||||
bool DDrawFB::Lock (bool useSimpleCanvas)
|
||||
{
|
||||
static int lock_num;
|
||||
bool wasLost;
|
||||
|
||||
// LOG2 (" Lock (%d) <%d>\n", buffered, LockCount);
|
||||
|
||||
LOG3("Lock %5x <%d> %d\n", (AppActive << 16) | (SessionState << 12) | (MustBuffer << 8) |
|
||||
(useSimpleCanvas << 4) | (int)UseBlitter, LockCount, lock_num++);
|
||||
|
||||
if (LockCount++ > 0)
|
||||
{
|
||||
return false;
|
||||
|
@ -812,15 +816,16 @@ bool DDrawFB::Lock (bool useSimpleCanvas)
|
|||
|
||||
wasLost = false;
|
||||
|
||||
if (NeedResRecreate)
|
||||
if (NeedResRecreate && LockCount == 1)
|
||||
{
|
||||
LOG("Recreating resources\n");
|
||||
NeedResRecreate = false;
|
||||
ReleaseResources ();
|
||||
CreateResources ();
|
||||
// ReleaseResources sets LockCount to 0.
|
||||
LockCount = 1;
|
||||
}
|
||||
|
||||
LOG5 ("Lock %d %d %d %d %d\n", AppActive, SessionState, MustBuffer, useSimpleCanvas, UseBlitter);
|
||||
|
||||
if (!AppActive || SessionState || MustBuffer || useSimpleCanvas || !UseBlitter)
|
||||
{
|
||||
Buffer = MemBuffer;
|
||||
|
@ -859,6 +864,7 @@ void DDrawFB::Unlock ()
|
|||
|
||||
if (LockCount == 0)
|
||||
{
|
||||
LOG("Unlock called when already unlocked\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -895,6 +901,7 @@ DDrawFB::LockSurfRes DDrawFB::LockSurf (LPRECT lockrect, LPDIRECTDRAWSURFACE toL
|
|||
lockingLocker = true;
|
||||
if (LockingSurf == NULL)
|
||||
{
|
||||
LOG("LockingSurf lost\n");
|
||||
if (!CreateResources ())
|
||||
{
|
||||
if (LastHR != DDERR_UNSUPPORTEDMODE)
|
||||
|
|
|
@ -498,7 +498,7 @@ enum
|
|||
};
|
||||
|
||||
#if 0
|
||||
#define STARTLOG do { if (!dbg) dbg = fopen ("k:/vid.log", "w"); } while(0)
|
||||
#define STARTLOG do { if (!dbg) dbg = fopen ("e:/vid.log", "w"); } while(0)
|
||||
#define STOPLOG do { if (dbg) { fclose (dbg); dbg=NULL; } } while(0)
|
||||
#define LOG(x) do { if (dbg) { fprintf (dbg, x); fflush (dbg); } } while(0)
|
||||
#define LOG1(x,y) do { if (dbg) { fprintf (dbg, x, y); fflush (dbg); } } while(0)
|
||||
|
@ -506,7 +506,8 @@ enum
|
|||
#define LOG3(x,y,z,zz) do { if (dbg) { fprintf (dbg, x, y, z, zz); fflush (dbg); } } while(0)
|
||||
#define LOG4(x,y,z,a,b) do { if (dbg) { fprintf (dbg, x, y, z, a, b); fflush (dbg); } } while(0)
|
||||
#define LOG5(x,y,z,a,b,c) do { if (dbg) { fprintf (dbg, x, y, z, a, b, c); fflush (dbg); } } while(0)
|
||||
FILE *dbg;
|
||||
extern FILE *dbg;
|
||||
#define VID_FILE_DEBUG 1
|
||||
#elif _DEBUG && 0
|
||||
#define STARTLOG
|
||||
#define STOPLOG
|
||||
|
|
|
@ -112,6 +112,10 @@ IDirect3DDevice9 *D3Device;
|
|||
CVAR (Bool, vid_forceddraw, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR (Int, vid_adapter, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
#if VID_FILE_DEBUG
|
||||
FILE *dbg;
|
||||
#endif
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
Win32Video::Win32Video (int parm)
|
||||
|
|
Loading…
Reference in a new issue