Fix lightmaps baking on D3D12

This commit is contained in:
Wojtek Figat
2021-06-07 13:09:52 +02:00
parent 3872d74bd2
commit 36c4c3c86a
3 changed files with 10 additions and 3 deletions

View File

@@ -9,6 +9,8 @@
#if DEBUG_EXPORT_LIGHTMAPS_PREVIEW || DEBUG_EXPORT_CACHE_PREVIEW || DEBUG_EXPORT_HEMISPHERES_PREVIEW
#include "Engine/Engine/Globals.h"
String GetDebugDataPath()
{
auto result = Globals::ProjectCacheFolder / TEXT("ShadowsOfMordor_Debug");
@@ -165,7 +167,7 @@ void ShadowsOfMordor::Builder::downloadDebugHemisphereAtlases(SceneBuildCache* s
GPUTexture* atlas = DebugExportHemispheresAtlases[atlasIndex];
TextureData textureData;
if (atlas->DownloadData(&textureData))
if (atlas->DownloadData(textureData))
{
LOG(Error, "Cannot download hemispheres atlas data.");
continue;

View File

@@ -135,7 +135,7 @@ bool ShadowsOfMordor::Builder::doWorkInner(DateTime buildStart)
}
}
reportProgress(BuildProgressStep::RenderHemispheres, 1.0f);
return true;
return false;
}
#endif

View File

@@ -17,6 +17,7 @@
#include "Engine/Terrain/TerrainPatch.h"
#include "Engine/Terrain/TerrainManager.h"
#include "Engine/Foliage/Foliage.h"
#include "Engine/Graphics/GPUDevice.h"
#include "Engine/Profiler/Profiler.h"
namespace ShadowsOfMordor
@@ -37,6 +38,8 @@ namespace ShadowsOfMordor
void ShadowsOfMordor::Builder::onJobRender(GPUContext* context)
{
if (_workerActiveSceneIndex < 0 || _workerActiveSceneIndex >= _scenes.Count())
return;
auto scene = _scenes[_workerActiveSceneIndex];
int32 atlasSize = (int32)scene->GetSettings().AtlasSize;
@@ -465,7 +468,9 @@ void ShadowsOfMordor::Builder::onJobRender(GPUContext* context)
Swap(scene->TempLightmapData, lightmapEntry.LightmapData);
// Keep blurring the empty lightmap texels (from background)
const int32 blurPasses = 24;
int32 blurPasses = 24;
if (context->GetDevice()->GetRendererType() == RendererType::DirectX12)
blurPasses = 0; // TODO: fix CS_Dilate passes on D3D12 (probably UAV synchronization issue)
for (int32 blurPassIndex = 0; blurPassIndex < blurPasses; blurPassIndex++)
{
context->UnBindSR(0);