Skip to content

This is just for caching and reducing look ups. Minor performance boost. #1273

Open
mcdubhghlas wants to merge 5 commits into
Redot-Engine:masterfrom
mcdubhghlas:master
Open

This is just for caching and reducing look ups. Minor performance boost. #1273
mcdubhghlas wants to merge 5 commits into
Redot-Engine:masterfrom
mcdubhghlas:master

Conversation

@mcdubhghlas

@mcdubhghlas mcdubhghlas commented Jun 3, 2026

Copy link
Copy Markdown
Member

If anything, it's just a little cleaner.

Summary by CodeRabbit

  • Performance Improvements
    • Improved clustered rendering efficiency by reducing unnecessary buffer updates and computing render/shadow pass counts up front.
    • Streamlined render-scene parameter sourcing and debug decision handling to avoid repeated lookups.
    • Updated camera data handling to pass transform and projection parameters by reference, reducing copying.
  • Bug Fixes
    • Tightened cast validity checks in the script analyzer to use strict built-in conversion rules, improving correctness of reported cast outcomes.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7d5454a4-274a-4675-9212-28137cfd279d

📥 Commits

Reviewing files that changed from the base of the PR and between 32d6f94 and 47c025c.

📒 Files selected for processing (1)
  • modules/gdscript/gdscript_analyzer.cpp

Walkthrough

The PR refactors clustered rendering to cache scene data and debug state across render passes, updates camera parameter passing to const references, and tightens GDScript builtin cast validation.

Changes

Clustered Renderer Optimization

Layer / File(s) Summary
Instance buffer and shadow loop optimization
servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
_update_instance_data_buffer() uses a direct instance-data reference with an empty-data early return, and _pre_opaque_render() iterates shadow passes using precomputed counts.
Scene render refactoring with local caching
servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
_render_scene() introduces a local scene_data pointer, caches debug draw mode into booleans, computes motion-vector requirements, and updates scene-data assignments and GI setup to use the cached pointer.
Render passes using cached scene data
servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
Opaque, motion, alpha, depth-prepass, sky radiance, debug probe, SSS/SSR, FSR2, TAA, MetalFX, and debug SDFGI paths now source camera, projection, jitter, and debug-state values from scene_data and cached debug flags.

Camera and Cast Validation

Layer / File(s) Summary
Camera parameter passing optimization
servers/rendering/renderer_scene_render.h, servers/rendering/renderer_scene_render.cpp
RendererSceneRender::CameraData::set_camera now takes Transform3D and Projection by const reference in both the declaration and definition.
Strict builtin cast checks
modules/gdscript/gdscript_analyzer.cpp
GDScriptAnalyzer::reduce_cast() switches builtin-to-builtin compatibility from Variant::can_convert() to Variant::can_convert_strict().

Estimated code review effort: 2 (Simple) | ~12 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and generic, so it does not clearly summarize the main change in the pull request. Replace it with a concise, specific title that names the main optimization or code path changed.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@Shakai-Dev Shakai-Dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested & it does in fact give a minor performance boost. Code lgtm

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants