Skip to content

Commit

Permalink
fix: fix bad rendering with bDepthBufferCulling
Browse files Browse the repository at this point in the history
With bDepthBufferCulling enabled, culling is incorrect if diskcache is
on until ShaderCache is cleared. This is a stopgap until root cause is
identified.
  • Loading branch information
alandtse committed Oct 8, 2024
1 parent a51466d commit 08c8887
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Features/VolumetricLighting.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "VolumetricLighting.h"
#include "ShaderCache.h"
#include "State.h"
#include "Util.h"

Expand Down Expand Up @@ -51,6 +52,15 @@ void VolumetricLighting::RestoreDefaultSettings()

void VolumetricLighting::DataLoaded()
{
auto& shaderCache = SIE::ShaderCache::Instance();
const static auto address = REL::Offset{ 0x1ec6b88 }.address();
bool& bDepthBufferCulling = *reinterpret_cast<bool*>(address);

if (REL::Module::IsVR() && bDepthBufferCulling && shaderCache.IsDiskCache()) {
// clear cache to fix bug caused by bDepthBufferCulling
logger::info("Force clearing cache due to bDepthBufferCulling");
shaderCache.Clear();
}
}

void VolumetricLighting::PostPostLoad()
Expand Down

0 comments on commit 08c8887

Please sign in to comment.