Skip to content

fix: fixes for flickering lighting#1288

Merged
doodlum merged 8 commits into
devfrom
llf-fixes-weird
Jul 21, 2025
Merged

fix: fixes for flickering lighting#1288
doodlum merged 8 commits into
devfrom
llf-fixes-weird

Conversation

@doodlum
Copy link
Copy Markdown
Collaborator

@doodlum doodlum commented Jul 21, 2025

Fixes LLF shadow lights properly, using a bitmask.
Fixes weird flickering on 1.5.97 due to optimisations specific to that version breaking hooks.
Cleaned up some things whilst trying to fix issues.

Summary by CodeRabbit

  • New Features
    • Improved control over shadow light handling by introducing a shadow bitmask, allowing selective filtering of shadow lights.
  • Bug Fixes
    • Enhanced reliability in light processing by updating how shadow lights are managed and tracked during rendering.
  • Refactor
    • Updated internal logic for memory patching to improve compatibility and maintainability across different modules.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 21, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The changes introduce a shadow light bitmask mechanism to the lighting system, updating both shader and C++ code to track, store, and utilize shadow light presence via a bitmask. Additionally, the patching logic for the lighting shader's geometry setup is revised to use multiple targeted memory patches, varying by module type.

Changes

File(s) Change Summary
features/Light Limit Fix/Shaders/LightLimitFix/LightLimitFix.hlsli Added ShadowBitMask and padding to the constant buffer; updated IsLightIgnored to check shadow bitmask.
src/Features/LightLimitFix.cpp Tracks and updates ShadowBitMask in the lighting setup; refreshes constant buffer when shadow composition changes.
src/Features/LightLimitFix.h Modified StrictLightDataCB struct to include ShadowBitMask; added previousShadowBitMask to class.
src/Hooks.cpp Changed patching for geometry setup: now applies multiple register-zeroing patches at explicit offsets per module.

Sequence Diagram(s)

sequenceDiagram
    participant RenderPass
    participant LightLimitFix
    participant Shader

    RenderPass->>LightLimitFix: Setup lighting
    LightLimitFix->>LightLimitFix: Reset ShadowBitMask
    loop For each shadow light
        LightLimitFix->>LightLimitFix: Set bit in ShadowBitMask
    end
    LightLimitFix->>Shader: Update constant buffer with ShadowBitMask
    Shader->>Shader: IsLightIgnored(light)
    alt Light has Shadow flag
        Shader->>Shader: Check ShadowBitMask & (1 << shadowLightIndex)
        Shader->>Shader: Return result
    else
        Shader->>Shader: Continue with existing ignore logic
    end
Loading

Suggested reviewers

  • doodlum

Poem

In the warren where shadows play,
A bitmask now leads the way.
Lights are counted, flags are checked,
Old padding gone, new fields connect.
With nimble paws, the patch hops through—
Geometry shines in world space too!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1860b6f and 709e019.

⛔ Files ignored due to path filters (1)
  • package/Shaders/Lighting.hlsl is excluded by !**/*.hlsl
📒 Files selected for processing (4)
  • features/Light Limit Fix/Shaders/LightLimitFix/LightLimitFix.hlsli (2 hunks)
  • src/Features/LightLimitFix.cpp (3 hunks)
  • src/Features/LightLimitFix.h (2 hunks)
  • src/Hooks.cpp (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.
@doodlum doodlum changed the title fix: fix for some lighting issues fix: fixes for flickering lighting Jul 21, 2025
@doodlum doodlum merged commit b61854d into dev Jul 21, 2025
10 of 13 checks passed
@github-actions
Copy link
Copy Markdown

Using provided base ref: 1860b6f
Using base ref: 1860b6f
Base commit date: 2025-07-20T12:52:27+01:00 (Sunday, July 20, 2025 12:52 PM)
No actionable suggestions for changed features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant