Repository navigation
render: context::current() returns a non-const context& - #196
Merged
Merged
Conversation
Rendering mutates the active context (frame state, draw commands); renderers must obtain a usable reference without const_cast. The context is owned by the code that created it, so returning a non-const reference is safe.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #196 +/- ##
=======================================
Coverage 28.53% 28.53%
=======================================
Files 239 239
Lines 8943 8943
Branches 2785 2785
=======================================
Hits 2552 2552
Misses 6057 6057
Partials 334 334 ☔ View full report in Codecov by Harness. |
igagis
approved these changes
Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ruis::render::context::current()now returnscontext&instead ofconst context&(the context stack also holds non-const pointers).Rendering mutates the active context (frame state, draw commands), so renderers must obtain a usable reference. Previously the only way was
const_castat every renderer call site (see the companion PR cppfw/ruis-render-vulkan). The context is owned by the code that created it, so returning a non-const reference is safe.Source-compatible for existing callers (a non-const reference binds to const usages as before).
Test plan