Conversation
📝 WalkthroughWalkthroughTwo shader material classes now allocate instances from the per-thread scrap heap via RE::MemoryManager and construct them in-place using placement new; corresponding headers add placement-delete operators calling RE::free(). Public Create() signatures and external behavior are unchanged. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (3)**/*.{cpp,cxx,cc,c,h,hpp,hxx,hlsl,hlsli,fx,fxh,py}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/**/*.{cpp,cxx,cc,h,hpp,hxx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (1)📓 Common learnings🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @src/TruePBR/BSLightingShaderMaterialPBR.cpp:
- Around line 10-15: BSLightingShaderMaterialPBR::Make currently allocates raw
memory from a static scrapHeap and never runs the constructor, leaving members
like pbrFlags, coatRoughness, fuzzColor and texture smart pointers uninitialized
and also incorrectly caches a thread-local heap; change it to obtain the heap
per-call (remove the static scrapHeap) and perform placement-new on the
allocated memory (new (mem) BSLightingShaderMaterialPBR()) so the constructor
runs and initializes members, and add #include <new> to enable placement new if
not already included.
In @src/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp:
- Around line 16-21: The Make() function currently allocates raw memory from a
cached static scrapHeap and never invokes the constructor; fix it by retrieving
the thread-local heap on each call (call
RE::MemoryManager::GetSingleton()->GetThreadScrapHeap() inside Make()—do NOT
cache it in a static), allocate the required size from that per-call heap, and
then construct the object with placement new so the constructor of
BSLightingShaderMaterialPBRLandscape runs and initializes members (do the same
change for BSLightingShaderMaterialPBR::Make()). Ensure you replace the static
scrapHeap with a local variable and perform placement-new on the allocated
memory before returning the pointer.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/TruePBR/BSLightingShaderMaterialPBR.cppsrc/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{cpp,cxx,cc,c,h,hpp,hxx,hlsl,hlsli,fx,fxh,py}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Do not include TODO/FIXME placeholders; provide complete, working solutions
Files:
src/TruePBR/BSLightingShaderMaterialPBR.cppsrc/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp
src/**/*.{cpp,cxx,cc,h,hpp,hxx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{cpp,cxx,cc,h,hpp,hxx}: Ensure SE/AE/VR runtime compatibility; use runtime detection patterns (e.g., REL::RelocateMember())
Include robust error handling and resource management with graceful degradation in the plugin code
Files:
src/TruePBR/BSLightingShaderMaterialPBR.cppsrc/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp
**/*
⚙️ CodeRabbit configuration file
**/*: When reviewing PRs, please provide suggestions for:
Conventional Commit Titles (if not following https://www.conventionalcommits.org/ or
if the existing title does not describe the code changes):
Format: type(scope): description
Length: 50 characters limit for title, 72 for body
Style: lowercase description, no ending period
Examples:
- feat(vr): add cross-eye sampling
- fix(water): resolve flowmap bug
- docs: update shader documentation
Issue References (if PR fixes bugs or implements features):
Suggest adding appropriate GitHub keywords:Otherwise, use your standard review approach focusing on code quality.
Files:
src/TruePBR/BSLightingShaderMaterialPBR.cppsrc/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp
🧠 Learnings (1)
📓 Common learnings
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Run Shader Unit Tests
- GitHub Check: Build plugin and addons
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @src/TruePBR/BSLightingShaderMaterialPBR.cpp:
- Around line 12-14: Do not cache the MemoryManager singleton as a static; call
RE::MemoryManager::GetSingleton() each time and use its
GetThreadScrapHeap()->Allocate(...) result for placement new, and add a null
check on the returned pointer before calling placement new on
BSLightingShaderMaterialPBR; if Allocate() returns nullptr, handle the failure
(e.g., log via your logger and return nullptr or propagate an error) instead of
dereferencing a null pointer.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/TruePBR/BSLightingShaderMaterialPBR.cppsrc/TruePBR/BSLightingShaderMaterialPBR.hsrc/TruePBR/BSLightingShaderMaterialPBRLandscape.cppsrc/TruePBR/BSLightingShaderMaterialPBRLandscape.h
🚧 Files skipped from review as they are similar to previous changes (1)
- src/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{cpp,cxx,cc,c,h,hpp,hxx,hlsl,hlsli,fx,fxh,py}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Do not include TODO/FIXME placeholders; provide complete, working solutions
Files:
src/TruePBR/BSLightingShaderMaterialPBR.cppsrc/TruePBR/BSLightingShaderMaterialPBRLandscape.hsrc/TruePBR/BSLightingShaderMaterialPBR.h
src/**/*.{cpp,cxx,cc,h,hpp,hxx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{cpp,cxx,cc,h,hpp,hxx}: Ensure SE/AE/VR runtime compatibility; use runtime detection patterns (e.g., REL::RelocateMember())
Include robust error handling and resource management with graceful degradation in the plugin code
Files:
src/TruePBR/BSLightingShaderMaterialPBR.cppsrc/TruePBR/BSLightingShaderMaterialPBRLandscape.hsrc/TruePBR/BSLightingShaderMaterialPBR.h
**/*
⚙️ CodeRabbit configuration file
**/*: When reviewing PRs, please provide suggestions for:
Conventional Commit Titles (if not following https://www.conventionalcommits.org/ or
if the existing title does not describe the code changes):
Format: type(scope): description
Length: 50 characters limit for title, 72 for body
Style: lowercase description, no ending period
Examples:
- feat(vr): add cross-eye sampling
- fix(water): resolve flowmap bug
- docs: update shader documentation
Issue References (if PR fixes bugs or implements features):
Suggest adding appropriate GitHub keywords:Otherwise, use your standard review approach focusing on code quality.
Files:
src/TruePBR/BSLightingShaderMaterialPBR.cppsrc/TruePBR/BSLightingShaderMaterialPBRLandscape.hsrc/TruePBR/BSLightingShaderMaterialPBR.h
🧠 Learnings (1)
📓 Common learnings
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build plugin and addons
🔇 Additional comments (1)
src/TruePBR/BSLightingShaderMaterialPBR.h (1)
52-53: Implementation is consistent with the Landscape variant.The placement delete operator matches the pattern used in
BSLightingShaderMaterialPBRLandscape. The same verification regardingRE::free()compatibility with thread scrap heap allocation applies here.
|
✅ A pre-release build is available for this PR: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @src/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp:
- Around line 18-21: The code currently assigns to raw allocated memory with
"*memory = {}" which invokes assignment on unconstructed memory; instead, call
the constructor in-place using placement new to construct a
BSLightingShaderMaterialPBRLandscape at the pointer returned by
memoryManager->GetThreadScrapHeap()->Allocate(...) so the object's non-trivial
constructor and destructor run (replace the assignment with placement new for
BSLightingShaderMaterialPBRLandscape at variable memory and then return that
pointer).
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/TruePBR/BSLightingShaderMaterialPBR.cppsrc/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- src/TruePBR/BSLightingShaderMaterialPBR.cpp
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{cpp,cxx,cc,c,h,hpp,hxx,hlsl,hlsli,fx,fxh,py}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Do not include TODO/FIXME placeholders; provide complete, working solutions
Files:
src/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp
src/**/*.{cpp,cxx,cc,h,hpp,hxx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{cpp,cxx,cc,h,hpp,hxx}: Ensure SE/AE/VR runtime compatibility; use runtime detection patterns (e.g., REL::RelocateMember())
Include robust error handling and resource management with graceful degradation in the plugin code
Files:
src/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp
**/*
⚙️ CodeRabbit configuration file
**/*: When reviewing PRs, please provide suggestions for:
Conventional Commit Titles (if not following https://www.conventionalcommits.org/ or
if the existing title does not describe the code changes):
Format: type(scope): description
Length: 50 characters limit for title, 72 for body
Style: lowercase description, no ending period
Examples:
- feat(vr): add cross-eye sampling
- fix(water): resolve flowmap bug
- docs: update shader documentation
Issue References (if PR fixes bugs or implements features):
Suggest adding appropriate GitHub keywords:Otherwise, use your standard review approach focusing on code quality.
Files:
src/TruePBR/BSLightingShaderMaterialPBRLandscape.cpp
🧠 Learnings (1)
📓 Common learnings
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build plugin and addons
|
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.