This commit is contained in:
Rachael Alexanderson 2017-05-22 13:10:19 -04:00
commit 7600fdb200
13 changed files with 175 additions and 11 deletions

View file

@ -1576,8 +1576,7 @@ DEFINE_ACTION_FUNCTION(DSBarInfo, GetProtrusion)
DBaseStatusBar *CreateCustomStatusBar(int scriptno)
{
auto script = SBarInfoScript[scriptno];
if (script == NULL)
I_FatalError("Tried to create a status bar with no script!");
if (script == nullptr) return nullptr;
auto sbar = (DBaseStatusBar*)PClass::FindClass("SBarInfoWrapper")->CreateNew();
auto core = new DSBarInfo(sbar, script);

View file

@ -303,6 +303,15 @@ void ST_CreateStatusBar(bool bTitleLevel)
{
StatusBar = CreateCustomStatusBar(SCRIPT_DEFAULT);
}
// SBARINFO failed so try the current statusbarclass again.
if (StatusBar == nullptr)
{
auto cls = PClass::FindClass(gameinfo.statusbarclass);
if (cls != nullptr)
{
StatusBar = (DBaseStatusBar *)cls->CreateNew();
}
}
}
if (StatusBar == nullptr)
{

View file

@ -933,6 +933,7 @@ void GLSceneDrawer::WriteSavePic (player_t *player, FileWriter *file, int width,
{
GL_IRECT bounds;
P_FindParticleSubsectors(); // make sure that all recently spawned particles have a valid subsector.
bounds.left=0;
bounds.top=0;
bounds.width=width;

View file

@ -1185,10 +1185,11 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
y = particle->Pos.Y;
z = particle->Pos.Z;
float scalefac=particle->size/4.0f;
// [BB] The smooth particles are smaller than the other ones. Compensate for this here.
if (gl_particles_style==2)
scalefac *= 1.7;
float factor;
if (gl_particles_style == 1) factor = 1.3f / 7.f;
else if (gl_particles_style == 2) factor = 2.5f / 7.f;
else factor = 1 / 7.f;
float scalefac=particle->size * factor;
float viewvecX = GLRenderer->mViewVector.X;
float viewvecY = GLRenderer->mViewVector.Y;

View file

@ -36,6 +36,7 @@
musicBlock::musicBlock ()
{
memset (this, 0, sizeof(*this));
for(auto &oplchannel : oplchannels) oplchannel.Panning = 64; // default to center panning.
for(auto &voice : voices) voice.index = ~0u; // mark all free.
}

View file

@ -33,6 +33,11 @@
#include "r_thread.h"
#include "swrenderer/r_memory.h"
#include "swrenderer/r_renderthread.h"
#include <chrono>
#ifdef WIN32
void PeekThreadedErrorPane();
#endif
CVAR(Bool, r_multithreaded, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
@ -73,10 +78,20 @@ void DrawerThreads::Execute(DrawerCommandQueuePtr commands)
void DrawerThreads::WaitForWorkers()
{
using namespace std::chrono_literals;
// Wait for workers to finish
auto queue = Instance();
std::unique_lock<std::mutex> end_lock(queue->end_mutex);
queue->end_condition.wait(end_lock, [&]() { return queue->tasks_left == 0; });
if (!queue->end_condition.wait_for(end_lock, 5s, [&]() { return queue->tasks_left == 0; }))
{
#ifdef WIN32
PeekThreadedErrorPane();
#endif
// Invoke the crash reporter so that we can capture the call stack of whatever the hung worker thread is doing
int *threadCrashed = nullptr;
*threadCrashed = 0xdeadbeef;
}
end_lock.unlock();
// Clean up

View file

@ -57,6 +57,11 @@
#include "swrenderer/r_memory.h"
#include "swrenderer/r_renderthread.h"
#include "swrenderer/things/r_playersprite.h"
#include <chrono>
#ifdef WIN32
void PeekThreadedErrorPane();
#endif
EXTERN_CVAR(Bool, r_shadercolormaps)
EXTERN_CVAR(Int, r_clearbuffer)
@ -217,9 +222,18 @@ namespace swrenderer
// Wait for everyone to finish:
if (Threads.size() > 1)
{
using namespace std::chrono_literals;
std::unique_lock<std::mutex> end_lock(end_mutex);
finished_threads++;
end_condition.wait(end_lock, [&]() { return finished_threads == Threads.size(); });
if (!end_condition.wait_for(end_lock, 5s, [&]() { return finished_threads == Threads.size(); }))
{
#ifdef WIN32
PeekThreadedErrorPane();
#endif
// Invoke the crash reporter so that we can capture the call stack of whatever the hung worker thread is doing
int *threadCrashed = nullptr;
*threadCrashed = 0xdeadbeef;
}
finished_threads = 0;
}

View file

@ -821,6 +821,13 @@ void ShowErrorPane(const char *text)
}
}
void PeekThreadedErrorPane()
{
// Allow SendMessage from another thread to call its message handler so that it can display the crash dialog
MSG msg;
PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE);
}
//==========================================================================
//
// DoMain