Seems we are attempting to use the probes before we have baked textures for them

This commit is contained in:
Magnus Norddahl 2025-07-09 13:39:32 +02:00
commit 9105bf3fb1
2 changed files with 15 additions and 4 deletions

View file

@ -441,8 +441,19 @@ int VkDescriptorSetManager::GetLightProbeTextureIndex(int probeIndex)
if (LightProbes[probeIndex] == -1)
{
LightProbes[probeIndex] = AddBindlessTextureIndex(fb->GetTextureManager()->Irradiancemaps[probeIndex].View.get(), fb->GetSamplerManager()->IrradiancemapSampler.get());
AddBindlessTextureIndex(fb->GetTextureManager()->Prefiltermaps[probeIndex].View.get(), fb->GetSamplerManager()->PrefiltermapSampler.get());
auto textures = fb->GetTextureManager();
// Seems we might be rendering a probe before we have data for it
if (textures->Irradiancemaps.size() > (size_t)probeIndex && textures->Irradiancemaps[probeIndex].View &&
textures->Prefiltermaps.size() > (size_t)probeIndex && textures->Prefiltermaps[probeIndex].View)
{
LightProbes[probeIndex] = AddBindlessTextureIndex(textures->Irradiancemaps[probeIndex].View.get(), fb->GetSamplerManager()->IrradiancemapSampler.get());
AddBindlessTextureIndex(textures->Prefiltermaps[probeIndex].View.get(), fb->GetSamplerManager()->PrefiltermapSampler.get());
}
else
{
return 0;
}
}
return LightProbes[probeIndex];

View file

@ -418,7 +418,7 @@ void VkTextureManager::UploadIrradiancemap(int cubeCount, const TArray<uint16_t>
{
int createStart = Irradiancemaps.size();
if (Irradiancemaps.size() <= (size_t)cubeCount)
Irradiancemaps.resize(cubeCount + 1);
Irradiancemaps.resize(cubeCount);
int w = IrradiancemapSize;
int h = IrradiancemapSize;
@ -497,7 +497,7 @@ void VkTextureManager::UploadPrefiltermap(int cubeCount, const TArray<uint16_t>&
{
int createStart = Prefiltermaps.size();
if (Prefiltermaps.size() <= (size_t)cubeCount)
Prefiltermaps.resize(cubeCount + 1);
Prefiltermaps.resize(cubeCount);
int w = PrefiltermapSize;
int h = PrefiltermapSize;