Skip to content

Commit

Permalink
chore: add missing changes
Browse files Browse the repository at this point in the history
  • Loading branch information
doodlum committed Feb 4, 2025
1 parent 05f1476 commit 7745c14
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
16 changes: 7 additions & 9 deletions src/Deferred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,20 @@ void Deferred::CopyShadowData()

void Deferred::ReflectionsPrepasses()
{
auto& shaderCache = SIE::ShaderCache::Instance();
auto shaderCache = globals::shaderCache;

if (!shaderCache.IsEnabled())
if (!shaderCache->IsEnabled())
return;

State::GetSingleton()->UpdateSharedData(false);

auto variableCache = VariableCache::GetSingleton();
globals::state->UpdateSharedData(false);

ZoneScoped;
TracyD3D11Zone(variableCache->state->tracyCtx, "Early Prepass");
TracyD3D11Zone(globals::game::graphicsState->tracyCtx, "Early Prepass");

auto context = variableCache->context;
auto context = globals::d3d::context;
context->OMSetRenderTargets(0, nullptr, nullptr); // Unbind all bound render targets

variableCache->stateUpdateFlags->set(RE::BSGraphics::ShaderFlags::DIRTY_RENDERTARGET); // Run OMSetRenderTargets again
globals::game::stateUpdateFlags->set(RE::BSGraphics::ShaderFlags::DIRTY_RENDERTARGET); // Run OMSetRenderTargets again

for (auto* feature : Feature::GetFeatureList()) {
if (feature->loaded) {
Expand Down Expand Up @@ -810,7 +808,7 @@ void Deferred::Hooks::BSShaderAccumulator_ShadowMapOrMask_BlendedDecals::thunk(R

void Deferred::Hooks::BSCubeMapCamera_RenderCubemap::thunk(RE::NiAVObject* camera, int a2, bool a3, bool a4, bool a5)
{
auto deferred = VariableCache::GetSingleton()->deferred;
auto deferred = globals::deferred;

deferred->inReflections = true;
deferred->ReflectionsPrepasses();
Expand Down
2 changes: 1 addition & 1 deletion src/Features/CloudShadows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void CloudShadows::ReflectionsPrepass()
!RE::Sky::GetSingleton()->currentClimate)
return;

auto& context = State::GetSingleton()->context;
auto context = globals::d3d::context;

context->CopyResource(texCubemapCloudOccCopy->resource.get(), texCubemapCloudOcc->resource.get());

Expand Down
14 changes: 6 additions & 8 deletions src/Features/DynamicCubemaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,13 +653,11 @@ void DynamicCubemaps::SetupResources()

void DynamicCubemaps::Reset()
{
if (auto sky = globals::game::sky)
if (auto sky = globals::game::sky){
activeReflections = sky->mode.get() == RE::Sky::Mode::kFull;
fakeReflections = activeReflections && sky->flags.any(RE::Sky::Flags::kHideSky);
}
else
{
activeReflections = false;
fakeReflections = false;
}
fakeReflections = activeReflections && sky->flags.any(RE::Sky::Flags::kHideSky);
} else {
activeReflections = false;
fakeReflections = false;
}
}
4 changes: 2 additions & 2 deletions src/Features/TerrainShadows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ void TerrainShadows::Precompute()
logger::info("Creating shadow texture...");
{
if (texShadowHeight) {
auto context = State::GetSingleton()->context;
auto context = globals::d3d::context;

std::array<ID3D11ShaderResourceView*, 1> srvs = { nullptr };
context->PSSetShaderResources(60, (uint)srvs.size(), srvs.data());
Expand Down Expand Up @@ -416,7 +416,7 @@ void TerrainShadows::UpdateShadow()
void TerrainShadows::ReflectionsPrepass()
{
if (texShadowHeight) {
auto context = State::GetSingleton()->context;
auto context = globals::d3d::context;

std::array<ID3D11ShaderResourceView*, 1> srvs = { texShadowHeight->srv.get() };
context->PSSetShaderResources(60, (uint)srvs.size(), srvs.data());
Expand Down

0 comments on commit 7745c14

Please sign in to comment.