mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-18 01:21:32 +00:00
- Add polyobj support to r_scene_multithreaded
This commit is contained in:
parent
adcc7588ec
commit
4545539045
3 changed files with 24 additions and 18 deletions
|
@ -103,23 +103,28 @@ namespace swrenderer
|
||||||
// calls to GetPixels for this to work.
|
// calls to GetPixels for this to work.
|
||||||
|
|
||||||
static std::mutex loadmutex;
|
static std::mutex loadmutex;
|
||||||
loadmutex.lock();
|
|
||||||
try
|
std::unique_lock<std::mutex> lock(loadmutex);
|
||||||
|
|
||||||
|
texture->GetPixels();
|
||||||
|
const FTexture::Span *spans;
|
||||||
|
texture->GetColumn(0, &spans);
|
||||||
|
if (Viewport->RenderTarget->IsBgra())
|
||||||
{
|
{
|
||||||
texture->GetPixels();
|
texture->GetPixelsBgra();
|
||||||
const FTexture::Span *spans;
|
texture->GetColumnBgra(0, &spans);
|
||||||
texture->GetColumn(0, &spans);
|
|
||||||
if (Viewport->RenderTarget->IsBgra())
|
|
||||||
{
|
|
||||||
texture->GetPixelsBgra();
|
|
||||||
texture->GetColumnBgra(0, &spans);
|
|
||||||
}
|
|
||||||
loadmutex.unlock();
|
|
||||||
}
|
}
|
||||||
catch (...)
|
}
|
||||||
|
|
||||||
|
void RenderThread::PreparePolyObject(subsector_t *sub)
|
||||||
|
{
|
||||||
|
static std::mutex polyobjmutex;
|
||||||
|
|
||||||
|
std::unique_lock<std::mutex> lock(polyobjmutex);
|
||||||
|
|
||||||
|
if (sub->BSP == nullptr || sub->BSP->bDirty)
|
||||||
{
|
{
|
||||||
loadmutex.unlock();
|
sub->BuildPolyBSP();
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,9 @@ namespace swrenderer
|
||||||
|
|
||||||
// Make sure texture can accessed safely
|
// Make sure texture can accessed safely
|
||||||
void PrepareTexture(FTexture *texture);
|
void PrepareTexture(FTexture *texture);
|
||||||
|
|
||||||
|
// Setup poly object in a threadsafe manner
|
||||||
|
void PreparePolyObject(subsector_t *sub);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<SWTruecolorDrawers> tc_drawers;
|
std::unique_ptr<SWTruecolorDrawers> tc_drawers;
|
||||||
|
|
|
@ -390,10 +390,8 @@ namespace swrenderer
|
||||||
|
|
||||||
void RenderOpaquePass::AddPolyobjs(subsector_t *sub)
|
void RenderOpaquePass::AddPolyobjs(subsector_t *sub)
|
||||||
{
|
{
|
||||||
if (sub->BSP == nullptr || sub->BSP->bDirty)
|
Thread->PreparePolyObject(sub);
|
||||||
{
|
|
||||||
sub->BuildPolyBSP();
|
|
||||||
}
|
|
||||||
if (sub->BSP->Nodes.Size() == 0)
|
if (sub->BSP->Nodes.Size() == 0)
|
||||||
{
|
{
|
||||||
RenderSubsector(&sub->BSP->Subsectors[0]);
|
RenderSubsector(&sub->BSP->Subsectors[0]);
|
||||||
|
|
Loading…
Reference in a new issue