mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-16 17:21:10 +00:00
- Fix VkRaytrace::Raytrace not working properly if called multiple times per frame.
- Only call VkRaytrace::Raytrace once per scene
This commit is contained in:
parent
cdd6336793
commit
b7618d3a5d
4 changed files with 10 additions and 7 deletions
|
@ -62,6 +62,12 @@ void VkLightmap::SetLevelMesh(LevelMesh* level)
|
|||
lastSurfaceCount = 0;
|
||||
}
|
||||
|
||||
void VkLightmap::BeginFrame()
|
||||
{
|
||||
lights.Pos = 0;
|
||||
vertices.Pos = 0;
|
||||
}
|
||||
|
||||
void VkLightmap::Raytrace(const TArray<LevelMeshSurface*>& surfaces)
|
||||
{
|
||||
if (surfaces.Size())
|
||||
|
@ -138,9 +144,6 @@ void VkLightmap::RenderBakeImage()
|
|||
cmdbuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, raytrace.pipelineLayout.get(), 0, raytrace.descriptorSet0.get());
|
||||
cmdbuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, raytrace.pipelineLayout.get(), 1, raytrace.descriptorSet1.get());
|
||||
|
||||
lights.Pos = 0;
|
||||
vertices.Pos = 0;
|
||||
|
||||
for (int i = 0, count = selectedSurfaces.Size(); i < count; i++)
|
||||
{
|
||||
auto& selectedSurface = selectedSurfaces[i];
|
||||
|
@ -407,7 +410,6 @@ void VkLightmap::BlurBakeImage()
|
|||
void VkLightmap::CopyBakeImageResult()
|
||||
{
|
||||
uint32_t pixels = 0;
|
||||
uint32_t surfacesRenderer = 0;
|
||||
|
||||
std::set<int> seenPages;
|
||||
std::vector<VkImageCopy> regions;
|
||||
|
@ -434,11 +436,10 @@ void VkLightmap::CopyBakeImageResult()
|
|||
seenPages.insert(surface->atlasPageIndex);
|
||||
|
||||
pixels += surface->Area();
|
||||
surfacesRenderer++;
|
||||
lastSurfaceCount++;
|
||||
}
|
||||
}
|
||||
|
||||
lastSurfaceCount = surfacesRenderer;
|
||||
lastPixelCount = pixels;
|
||||
totalPixelCount += pixels;
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
VkLightmap(VulkanRenderDevice* fb);
|
||||
~VkLightmap();
|
||||
|
||||
void BeginFrame();
|
||||
void Raytrace(const TArray<LevelMeshSurface*>& surfaces);
|
||||
void SetLevelMesh(LevelMesh* level);
|
||||
|
||||
|
|
|
@ -487,6 +487,7 @@ void VulkanRenderDevice::BeginFrame()
|
|||
for (auto& renderstate : mRenderState)
|
||||
renderstate->BeginFrame();
|
||||
mDescriptorSetManager->BeginFrame();
|
||||
mLightmap->BeginFrame();
|
||||
}
|
||||
|
||||
void VulkanRenderDevice::Draw2D()
|
||||
|
|
|
@ -415,7 +415,7 @@ void HWDrawInfo::CreateScene(bool drawpsprites, FRenderState& state)
|
|||
|
||||
void HWDrawInfo::UpdateLightmaps()
|
||||
{
|
||||
if (VisibleSurfaces.Size() < unsigned(lm_background_updates))
|
||||
if (!outer && VisibleSurfaces.Size() < unsigned(lm_background_updates))
|
||||
{
|
||||
for (auto& e : level.levelMesh->Surfaces)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue