From d0861e9896bf2e60c3eba2bf075b08eeb467a28b Mon Sep 17 00:00:00 2001 From: sicsix <8847273+sicsix@users.noreply.github.com> Date: Mon, 4 Aug 2025 08:39:05 +1000 Subject: [PATCH] fix(VL): broken VL with VL core feature disabled --- src/Hooks.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/Hooks.cpp b/src/Hooks.cpp index d46817d726..84d490d581 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -963,23 +963,25 @@ namespace Hooks if (state->enabledClasses[RE::BSShader::Type::ImageSpace]) { RE::BSImagespaceShader* isShader = CurrentlyDispatchedShader; uint32_t techniqueId = CurrentComputeShaderTechniqueId; - if (CurrentlyDispatchedShader == nullptr) { - techniqueId = 0; - if (CurrentlyDispatchedComputeShader->name == std::string_view("ISVolumetricLightingGenerateCS")) { - isShader = vl.GetOrCreateGenerateCS(CurrentlyDispatchedComputeShader); - } else if (CurrentlyDispatchedComputeShader->name == std::string_view("ISVolumetricLightingRaymarchCS")) { - isShader = vl.GetOrCreateRaymarchCS(CurrentlyDispatchedComputeShader); + if (vl.loaded) { + if (CurrentlyDispatchedShader == nullptr) { + techniqueId = 0; + if (CurrentlyDispatchedComputeShader->name == "ISVolumetricLightingGenerateCS"sv) { + isShader = vl.GetOrCreateGenerateCS(CurrentlyDispatchedComputeShader); + } else if (CurrentlyDispatchedComputeShader->name == "ISVolumetricLightingRaymarchCS"sv) { + isShader = vl.GetOrCreateRaymarchCS(CurrentlyDispatchedComputeShader); + } + } else if (CurrentlyDispatchedComputeShader->name == "ISVolumetricLightingBlurHCS"sv) { + techniqueId = 0; + isShader = vl.GetOrCreateBlurHCS(CurrentlyDispatchedComputeShader); + vl.SetDimensionsCB(); + vl.SetGroupCountsHCS(threadGroupCountX); + } else if (CurrentlyDispatchedComputeShader->name == "ISVolumetricLightingBlurVCS"sv) { + techniqueId = 0; + isShader = vl.GetOrCreateBlurVCS(CurrentlyDispatchedComputeShader); + vl.SetDimensionsCB(); + vl.SetGroupCountsVCS(threadGroupCountY); } - } else if (vl.loaded && CurrentlyDispatchedComputeShader->name == std::string_view("ISVolumetricLightingBlurHCS")) { - techniqueId = 0; - isShader = vl.GetOrCreateBlurHCS(CurrentlyDispatchedComputeShader); - vl.SetDimensionsCB(); - vl.SetGroupCountsHCS(threadGroupCountX); - } else if (vl.loaded && CurrentlyDispatchedComputeShader->name == std::string_view("ISVolumetricLightingBlurVCS")) { - techniqueId = 0; - isShader = vl.GetOrCreateBlurVCS(CurrentlyDispatchedComputeShader); - vl.SetDimensionsCB(); - vl.SetGroupCountsVCS(threadGroupCountY); } if (isShader != nullptr) { if (auto* computeShader = shaderCache->GetComputeShader(*isShader, techniqueId)) {