mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-30 07:51:28 +00:00
Fix some r_scene_multithreaded crashes
This commit is contained in:
parent
fb87f90d86
commit
bdb35e5e86
4 changed files with 17 additions and 6 deletions
|
@ -59,8 +59,6 @@ CVAR(Bool, r_linearsky, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
|||
EXTERN_CVAR(Int, r_skymode)
|
||||
EXTERN_CVAR(Bool, cl_oldfreelooklimit)
|
||||
|
||||
std::pair<PalEntry, PalEntry>& R_GetSkyCapColor(FGameTexture* tex);
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
static FSoftwareTexture *GetSWTex(FTextureID texid, bool allownull = true)
|
||||
|
@ -255,6 +253,8 @@ namespace swrenderer
|
|||
angle1 = UMulScale16(ang, frontcyl) + frontpos;
|
||||
angle2 = UMulScale16(ang, backcyl) + backpos;
|
||||
|
||||
auto skycapcolors = Thread->GetSkyCapColor(frontskytex);
|
||||
|
||||
drawerargs.SetFrontTexture(Thread, frontskytex, angle1);
|
||||
drawerargs.SetBackTexture(Thread, backskytex, angle2);
|
||||
drawerargs.SetTextureVStep(uv_step);
|
||||
|
@ -262,9 +262,8 @@ namespace swrenderer
|
|||
drawerargs.SetDest(viewport, start_x, y1);
|
||||
drawerargs.SetCount(y2 - y1);
|
||||
drawerargs.SetFadeSky(r_skymode == 2 && !(Level->flags & LEVEL_FORCETILEDSKY));
|
||||
auto& col = R_GetSkyCapColor(frontskytex->GetTexture());
|
||||
drawerargs.SetSolidTop(col.first);
|
||||
drawerargs.SetSolidBottom(col.second);
|
||||
drawerargs.SetSolidTop(skycapcolors.first);
|
||||
drawerargs.SetSolidBottom(skycapcolors.second);
|
||||
|
||||
if (!backskytex)
|
||||
drawerargs.DrawSingleSkyColumn(Thread);
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
#include "r_memory.h"
|
||||
#include "common/rendering/polyrenderer/drawers/poly_thread.h"
|
||||
|
||||
std::pair<PalEntry, PalEntry>& R_GetSkyCapColor(FGameTexture* tex);
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
RenderThread::RenderThread(RenderScene *scene, bool mainThread)
|
||||
|
@ -120,6 +122,13 @@ namespace swrenderer
|
|||
}
|
||||
}
|
||||
|
||||
std::pair<PalEntry, PalEntry> RenderThread::GetSkyCapColor(FSoftwareTexture* tex)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(loadmutex);
|
||||
std::pair<PalEntry, PalEntry> colors = R_GetSkyCapColor(tex->GetTexture());
|
||||
return colors;
|
||||
}
|
||||
|
||||
static std::mutex polyobjmutex;
|
||||
void RenderThread::PreparePolyObject(subsector_t *sub)
|
||||
{
|
||||
|
|
|
@ -92,6 +92,9 @@ namespace swrenderer
|
|||
|
||||
// Setup poly object in a threadsafe manner
|
||||
void PreparePolyObject(subsector_t *sub);
|
||||
|
||||
// Retrieve skycap color in a threadsafe way
|
||||
std::pair<PalEntry, PalEntry> GetSkyCapColor(FSoftwareTexture* tex);
|
||||
|
||||
private:
|
||||
std::unique_ptr<SWTruecolorDrawers> tc_drawers;
|
||||
|
|
|
@ -66,7 +66,7 @@ void PeekThreadedErrorPane();
|
|||
EXTERN_CVAR(Int, r_clearbuffer)
|
||||
EXTERN_CVAR(Int, r_debug_draw)
|
||||
|
||||
CVAR(Int, r_scene_multithreaded, 0, 0);
|
||||
CVAR(Int, r_scene_multithreaded, 1, 0);
|
||||
CVAR(Bool, r_models, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
|
||||
bool r_modelscene = false;
|
||||
|
|
Loading…
Reference in a new issue