fix: fix ctd modifying pSamplerDesc#1252
Conversation
WalkthroughThe change updates the implementation of the Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
⏰ 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)
🔇 Additional comments (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Pull Request Overview
This PR prevents the original sampler descriptor from being mutated by copying it before clamping its MaxAnisotropy value.
- Removed in-place modification of
pSamplerDesc - Introduced a local copy (
descCopy) and applied the clamp to that - Passed the modified copy into the downstream function
Comments suppressed due to low confidence (2)
src/Hooks.cpp:300
- [nitpick] The variable name
descCopyis generic; consider renaming it to something more descriptive likesanitizedDescormutableDescto clarify its purpose.
D3D11_SAMPLER_DESC descCopy = *pSamplerDesc; // make a copy, pSamplerDesc is supposed to be immutable
src/Hooks.cpp:300
- Consider adding a unit test to verify that the original
pSamplerDescremains unchanged afterCreateSamplerStateand that the clamping logic correctly applies to the copy.
D3D11_SAMPLER_DESC descCopy = *pSamplerDesc; // make a copy, pSamplerDesc is supposed to be immutable
|
✅ A pre-release build is available for this PR: |
Summary by CodeRabbit