-
Notifications
You must be signed in to change notification settings - Fork 138
fix: fix effect shader decals #1186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ae221a0
97891d5
a7f17be
94b5adc
41ea5c1
f2425d9
f6141b1
6282ece
38f0880
fde08d0
157f02c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -849,41 +849,58 @@ namespace Hooks | |
| static inline REL::Relocation<decltype(thunk)> func; | ||
| }; | ||
|
|
||
| struct BSBatchRenderer_RenderPassImmediately1 | ||
| void BSBatchRenderer_RenderPassImmediately1::thunk(RE::BSRenderPass* a_pass, uint32_t a_technique, bool a_alphaTest, uint32_t a_renderFlags) | ||
| { | ||
| static void thunk(RE::BSRenderPass* pass, uint32_t technique, bool alphaTest, uint32_t renderFlags) | ||
| { | ||
| if (globals::features::lightLimitFix->loaded && !globals::features::lightLimitFix->CheckParticleLights(pass, technique)) | ||
| return; | ||
| if (globals::features::lightLimitFix->loaded && !globals::features::lightLimitFix->CheckParticleLights(a_pass, a_technique)) | ||
| return; | ||
|
|
||
| func(pass, technique, alphaTest, renderFlags); | ||
| // Separate deferred and forward blended decals | ||
| if (globals::state->inWorld && a_pass->accumulationHint == 3 && !a_pass->shaderProperty->flags.all(RE::BSShaderProperty::EShaderPropertyFlag::kZBufferWrite)) { | ||
| RenderPass call{ a_pass, a_technique, a_alphaTest, a_renderFlags }; | ||
| globals::state->blendedDecalRenderPasses.push_back(call); | ||
| return; | ||
| } | ||
| static inline REL::Relocation<decltype(thunk)> func; | ||
| }; | ||
|
|
||
| func(a_pass, a_technique, a_alphaTest, a_renderFlags); | ||
| } | ||
|
|
||
| struct BSBatchRenderer_RenderPassImmediately2 | ||
| { | ||
| static void thunk(RE::BSRenderPass* pass, uint32_t technique, bool alphaTest, uint32_t renderFlags) | ||
| static void thunk(RE::BSRenderPass* a_pass, uint32_t a_technique, bool a_alphaTest, uint32_t a_renderFlags) | ||
| { | ||
| if (globals::features::lightLimitFix->loaded && !globals::features::lightLimitFix->CheckParticleLights(pass, technique)) | ||
| if (globals::features::lightLimitFix->loaded && !globals::features::lightLimitFix->CheckParticleLights(a_pass, a_technique)) | ||
| return; | ||
|
|
||
| if (globals::features::interiorSunShadows->loaded) | ||
| globals::features::interiorSunShadows->UpdateRasterStateCullMode(pass, technique); | ||
| globals::features::interiorSunShadows->UpdateRasterStateCullMode(a_pass, a_technique); | ||
|
|
||
| // Separate deferred and forward blended decals | ||
| if (globals::state->inWorld && a_pass->accumulationHint == 3 && !a_pass->shaderProperty->flags.all(RE::BSShaderProperty::EShaderPropertyFlag::kZBufferWrite)) { | ||
| RenderPass call{ a_pass, a_technique, a_alphaTest, a_renderFlags }; | ||
| globals::state->blendedDecalRenderPasses.push_back(call); | ||
| return; | ||
| } | ||
|
Comment on lines
+877
to
+882
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add null pointer check for shader property access. Same issue as in the first hook - missing null check for Apply this diff to add safety: // Separate deferred and forward blended decals
-if (globals::state->inWorld && a_pass->accumulationHint == 3 && !a_pass->shaderProperty->flags.all(RE::BSShaderProperty::EShaderPropertyFlag::kZBufferWrite)) {
+if (globals::state->inWorld && a_pass->accumulationHint == 3 && a_pass->shaderProperty && !a_pass->shaderProperty->flags.all(RE::BSShaderProperty::EShaderPropertyFlag::kZBufferWrite)) {🤖 Prompt for AI Agents |
||
|
|
||
| func(pass, technique, alphaTest, renderFlags); | ||
| func(a_pass, a_technique, a_alphaTest, a_renderFlags); | ||
| } | ||
| static inline REL::Relocation<decltype(thunk)> func; | ||
| }; | ||
|
|
||
| struct BSBatchRenderer_RenderPassImmediately3 | ||
| { | ||
| static void thunk(RE::BSRenderPass* pass, uint32_t technique, bool alphaTest, uint32_t renderFlags) | ||
| static void thunk(RE::BSRenderPass* a_pass, uint32_t a_technique, bool a_alphaTest, uint32_t a_renderFlags) | ||
| { | ||
| if (globals::features::lightLimitFix->loaded && !globals::features::lightLimitFix->CheckParticleLights(pass, technique)) | ||
| if (globals::features::lightLimitFix->loaded && !globals::features::lightLimitFix->CheckParticleLights(a_pass, a_technique)) | ||
| return; | ||
|
|
||
| func(pass, technique, alphaTest, renderFlags); | ||
| // Separate deferred and forward blended decals | ||
| if (globals::state->inWorld && a_pass->accumulationHint == 3 && !a_pass->shaderProperty->flags.all(RE::BSShaderProperty::EShaderPropertyFlag::kZBufferWrite)) { | ||
| RenderPass call{ a_pass, a_technique, a_alphaTest, a_renderFlags }; | ||
| globals::state->blendedDecalRenderPasses.push_back(call); | ||
| return; | ||
| } | ||
|
Comment on lines
+896
to
+901
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add null pointer check for shader property access. Same issue as in the other hooks - missing null check for Apply this diff to add safety: // Separate deferred and forward blended decals
-if (globals::state->inWorld && a_pass->accumulationHint == 3 && !a_pass->shaderProperty->flags.all(RE::BSShaderProperty::EShaderPropertyFlag::kZBufferWrite)) {
+if (globals::state->inWorld && a_pass->accumulationHint == 3 && a_pass->shaderProperty && !a_pass->shaderProperty->flags.all(RE::BSShaderProperty::EShaderPropertyFlag::kZBufferWrite)) {🤖 Prompt for AI Agents |
||
|
|
||
| func(a_pass, a_technique, a_alphaTest, a_renderFlags); | ||
| } | ||
| static inline REL::Relocation<decltype(thunk)> func; | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add null pointer check for shader property access.
The code accesses
a_pass->shaderProperty->flagswithout checking ifshaderPropertyis null, which could cause crashes.Apply this diff to add safety:
📝 Committable suggestion
🤖 Prompt for AI Agents