Add HWDrawContext so that multiple threads can maintain their own drawinfo without need for synchronization

This commit is contained in:
Magnus Norddahl 2023-06-29 03:33:07 +02:00
commit a7f4971d5d
26 changed files with 296 additions and 299 deletions

View file

@ -24,7 +24,7 @@ void HWMeshCache::Clear()
TranslucentDepthBiased.reset();
}
void HWMeshCache::Update(FRenderViewpoint& vp)
void HWMeshCache::Update(HWDrawContext* drawctx, FRenderViewpoint& vp)
{
if (!gl_meshcache)
return;
@ -74,7 +74,7 @@ void HWMeshCache::Update(FRenderViewpoint& vp)
if (!Opaque)
{
HWDrawInfo* di = HWDrawInfo::StartDrawInfo(vp.ViewLevel, nullptr, vp, nullptr);
HWDrawInfo* di = HWDrawInfo::StartDrawInfo(drawctx, vp.ViewLevel, nullptr, vp, nullptr);
di->MeshBuilding = true;
MeshBuilder state;
@ -98,7 +98,7 @@ void HWMeshCache::Update(FRenderViewpoint& vp)
HWFlat flat;
flat.section = subsector->section;
sector_t* front = hw_FakeFlat(subsector->render_sector, area_default, false);
sector_t* front = hw_FakeFlat(di->drawctx, subsector->render_sector, area_default, false);
flat.ProcessSector(di, state, front);
}
}