Skip to content

Commit

Permalink
fix(VR): fix ctd on start
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Oct 23, 2024
1 parent 09d5993 commit 2de4b7e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,18 @@ namespace EffectExtensions

void EffectSetupGeometry(ID3D11Resource* pResource)
{
if (RE::BSRenderPass* EffectRenderPass = BSEffectShader_SetupGeometry::CurrentRenderPass; EffectRenderPass && EffectRenderPass->geometry && pResource == static_cast<void*>(RE::BSGraphics::RendererShadowState::GetSingleton()->GetRuntimeData().currentPixelShader->constantBuffers[2].buffer)) {
auto shadowState = RE::BSGraphics::RendererShadowState::GetSingleton();
GET_INSTANCE_MEMBER(currentPixelShader, shadowState)
if (RE::BSRenderPass* EffectRenderPass = BSEffectShader_SetupGeometry::CurrentRenderPass;
EffectRenderPass && EffectRenderPass->geometry &&
pResource == static_cast<void*>(currentPixelShader->constantBuffers[2].buffer)) {
if (auto* shaderProperty = static_cast<RE::BSShaderProperty*>(EffectRenderPass->geometry->GetGeometryRuntimeData().properties[1].get())) {
stl::enumeration<EffectExtendedFlags> flags;
if (shaderProperty->flags.any(RE::BSShaderProperty::EShaderPropertyFlag::kUniformScale)) {
flags.set(EffectExtendedFlags::Shadows);
}

const auto& effectPSConstants = ShaderConstants::EffectPS::Get();
auto shadowState = RE::BSGraphics::RendererShadowState::GetSingleton();
shadowState->SetPSConstant(flags, RE::BSGraphics::ConstantGroupLevel::PerGeometry, effectPSConstants.ExtendedFlags);
}
}
Expand Down

0 comments on commit 2de4b7e

Please sign in to comment.