Removed continuity_break code, added tiny DCQ switch
The continuity_break code is rendered superfluous by the FlushGraphics and RenderingCond pair now, and it was breaking the situation where you try to push onto a full queue. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@403 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -101,7 +101,3 @@ The bugs reported but not yet verified:
|
|||||||
|
|
||||||
- In starmap, when any zone of influence is moving, the starmap cursor behaves badly
|
- In starmap, when any zone of influence is moving, the starmap cursor behaves badly
|
||||||
(erases what it passes over). Leaving and returning to the starmap fixes it
|
(erases what it passes over). Leaving and returning to the starmap fixes it
|
||||||
|
|
||||||
- Under FreeBSD, waiting on condition variables doesn't seem to
|
|
||||||
actually wait or hand control to the renderer, thus spinlocking and
|
|
||||||
crashing.
|
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
0.2:
|
0.2:
|
||||||
|
- Defining DCQ_OF_DOOM lowers the DrawCommandQueue size to 512, to aid in
|
||||||
|
simulating severe overload stresses on the machine
|
||||||
|
- Removed TFB_FlushGraphics' dependency on GraphicsSem, which the new
|
||||||
|
condition variable code both breaks and makes unnecessary
|
||||||
- Scan tint is now cleared right after the scan, from PhracturedBlue
|
- Scan tint is now cleared right after the scan, from PhracturedBlue
|
||||||
- Recoded the DCQ to not sit on the heap, added debugging info
|
- Recoded the DCQ to not sit on the heap, added debugging info
|
||||||
- Fixed Outfit Starship and Shipyard graphics, from TDuck
|
- Fixed Outfit Starship and Shipyard graphics, from TDuck
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ FlushGraphics (void)
|
|||||||
{
|
{
|
||||||
TFB_DrawCommand DrawCommand;
|
TFB_DrawCommand DrawCommand;
|
||||||
TFB_BatchReset ();
|
TFB_BatchReset ();
|
||||||
continuity_break = 1;
|
|
||||||
DrawCommand.Type = TFB_DRAWCOMMANDTYPE_FLUSHGRAPHICS;
|
DrawCommand.Type = TFB_DRAWCOMMANDTYPE_FLUSHGRAPHICS;
|
||||||
DrawCommand.image = 0;
|
DrawCommand.image = 0;
|
||||||
TFB_EnqueueDrawCommand(&DrawCommand);
|
TFB_EnqueueDrawCommand(&DrawCommand);
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ static Uint32 DCQ_locking_thread = 0;
|
|||||||
// become tolerable before initiating livelock deterrence and game
|
// become tolerable before initiating livelock deterrence and game
|
||||||
// slowdown. Other constants for controlling the frameskip/slowdown
|
// slowdown. Other constants for controlling the frameskip/slowdown
|
||||||
// balance may be found in sdl_common.c near TFB_FlushGraphics.
|
// balance may be found in sdl_common.c near TFB_FlushGraphics.
|
||||||
|
#ifdef DCQ_OF_DOOM
|
||||||
|
#define DCQ_MAX 512
|
||||||
|
#else
|
||||||
#define DCQ_MAX 16384
|
#define DCQ_MAX 16384
|
||||||
|
#endif
|
||||||
TFB_DrawCommand DCQ[DCQ_MAX];
|
TFB_DrawCommand DCQ[DCQ_MAX];
|
||||||
|
|
||||||
TFB_DrawCommandQueue DrawCommandQueue;
|
TFB_DrawCommandQueue DrawCommandQueue;
|
||||||
@@ -151,16 +155,17 @@ TFB_DrawCommandQueue_Push (TFB_DrawCommand* Command)
|
|||||||
while (DrawCommandQueue.FullSize >= DCQ_MAX - 1)
|
while (DrawCommandQueue.FullSize >= DCQ_MAX - 1)
|
||||||
{
|
{
|
||||||
int old_depth, i;
|
int old_depth, i;
|
||||||
fprintf (stderr, "DCQ overload (Size = %d). Sleeping until renderer is done.\n", DrawCommandQueue.Size);
|
fprintf (stderr, "DCQ overload (Size = %d, FullSize = %d). Sleeping until renderer is done.\n", DrawCommandQueue.Size, DrawCommandQueue.FullSize);
|
||||||
// Restore the DCQ locking level. I *think* this is
|
// Restore the DCQ locking level. I *think* this is
|
||||||
// always 1, but...
|
// always 1, but...
|
||||||
|
TFB_BatchReset ();
|
||||||
old_depth = DCQ_locking_depth;
|
old_depth = DCQ_locking_depth;
|
||||||
for (i = 0; i < old_depth; i++)
|
for (i = 0; i < old_depth; i++)
|
||||||
Unlock_DCQ ();
|
Unlock_DCQ ();
|
||||||
WaitCondVar (RenderingCond);
|
WaitCondVar (RenderingCond);
|
||||||
for (i = 0; i < old_depth; i++)
|
for (i = 0; i < old_depth; i++)
|
||||||
Lock_DCQ ();
|
Lock_DCQ ();
|
||||||
fprintf (stderr, "DCQ clear (Size = %d). Continuing.\n", DrawCommandQueue.Size);
|
fprintf (stderr, "DCQ clear (Size = %d, FullSize = %d). Continuing.\n", DrawCommandQueue.Size, DrawCommandQueue.FullSize);
|
||||||
}
|
}
|
||||||
DCQ[DrawCommandQueue.InsertionPoint] = *Command;
|
DCQ[DrawCommandQueue.InsertionPoint] = *Command;
|
||||||
DrawCommandQueue.InsertionPoint = (DrawCommandQueue.InsertionPoint + 1) % DCQ_MAX;
|
DrawCommandQueue.InsertionPoint = (DrawCommandQueue.InsertionPoint + 1) % DCQ_MAX;
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ volatile int TransitionAmount = 255;
|
|||||||
SDL_Rect TransitionClipRect;
|
SDL_Rect TransitionClipRect;
|
||||||
|
|
||||||
int GfxFlags = 0;
|
int GfxFlags = 0;
|
||||||
volatile int continuity_break;
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TFB_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
TFB_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||||
@@ -511,9 +509,15 @@ TFB_ComputeFPS ()
|
|||||||
// on slower machines. Even there, it's seems nonexistent outside of
|
// on slower machines. Even there, it's seems nonexistent outside of
|
||||||
// communications screens. --Michael
|
// communications screens. --Michael
|
||||||
|
|
||||||
|
#ifdef DCQ_OF_DOOM
|
||||||
|
#define DCQ_FORCE_SLOWDOWN_SIZE 128
|
||||||
|
#define DCQ_FORCE_BREAK_SIZE 512
|
||||||
|
#define DCQ_LIVELOCK_MAX 256
|
||||||
|
#else
|
||||||
#define DCQ_FORCE_SLOWDOWN_SIZE 1024
|
#define DCQ_FORCE_SLOWDOWN_SIZE 1024
|
||||||
#define DCQ_FORCE_BREAK_SIZE 4096
|
#define DCQ_FORCE_BREAK_SIZE 4096
|
||||||
#define DCQ_LIVELOCK_MAX 2048
|
#define DCQ_LIVELOCK_MAX 2048
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_FlushGraphics () // Only call from main thread!!
|
TFB_FlushGraphics () // Only call from main thread!!
|
||||||
@@ -548,23 +552,6 @@ TFB_FlushGraphics () // Only call from main thread!!
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!continuity_break) {
|
|
||||||
// TODO: a more optimal way of getting the lock on GraphicsSem..
|
|
||||||
// cannot currently use SDL_SemWait because it would break
|
|
||||||
// the usage of continuity_break
|
|
||||||
// Michael asks: Why are we locking, then releasing, the GraphicsSem?
|
|
||||||
|
|
||||||
semval = TimeoutSetSemaphore (GraphicsSem, ONE_SECOND / 10);
|
|
||||||
if (semval != 0)
|
|
||||||
{
|
|
||||||
BroadcastCondVar (RenderingCond);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
SDL_SemPost (GraphicsSem);
|
|
||||||
}
|
|
||||||
continuity_break = 0;
|
|
||||||
|
|
||||||
if (GfxFlags & TFB_GFXFLAGS_SHOWFPS)
|
if (GfxFlags & TFB_GFXFLAGS_SHOWFPS)
|
||||||
TFB_ComputeFPS ();
|
TFB_ComputeFPS ();
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ extern SDL_Surface *TransitionScreen;
|
|||||||
extern volatile int TransitionAmount;
|
extern volatile int TransitionAmount;
|
||||||
extern SDL_Rect TransitionClipRect;
|
extern SDL_Rect TransitionClipRect;
|
||||||
|
|
||||||
extern volatile int continuity_break;
|
|
||||||
extern int GfxFlags;
|
extern int GfxFlags;
|
||||||
|
|
||||||
void ScreenOrigin (FRAME Display, COORD sx, COORD sy);
|
void ScreenOrigin (FRAME Display, COORD sx, COORD sy);
|
||||||
|
|||||||
Reference in New Issue
Block a user