Skip to content

to_window_coords, get_viewport: top-left origin window coordinates - #9

Merged
igagis merged 4 commits into
mainfrom
top-left-origin
Dec 1, 2026
Merged

igagis merged 4 commits into
mainfrom
top-left-origin

Conversation

@igagis-bot

Copy link
Copy Markdown
Contributor

Unify the Vulkan renderer on the top-left origin window coordinate convention (x right, y down) used by the rest of the framework:

  • to_window_coords() computes the result in the viewport's coordinate frame (clamped) and adds the viewport offset, instead of always using the swapchain dimensions
  • get_viewport() returns the viewport stored by set_viewport() (top-left origin), falling back to the effective target's dimensions (framebuffer or swapchain) until set_viewport() has been called

Vulkan already uses top-left origin natively, so no y-flip is needed.

Window coordinates are always top-left origin (x right, y down):
- to_window_coords() computes the result in the viewport's coordinate
  frame (clamped) and adds the viewport offset
- get_viewport() returns the viewport stored by set_viewport() (top-left
  origin), falling back to the effective target's dimensions until
  set_viewport() has been called
@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (ba630fa) to head (88e5034).

Files with missing lines Patch % Lines
src/ruis/render/vulkan/context.cpp 0.00% 5 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main      #9   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         24      24           
  Lines       1388    1387    -1     
  Branches     499     499           
=====================================
+ Misses      1388    1387    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Comment thread src/ruis/render/vulkan/context.cpp Resolved
Until set_viewport() is called the stored rect is zero-sized by default,
so the framebuffer/window-dimensions fallback was unnecessary and
could misrepresent the state (it also made the pre-set state
ambiguous with a genuine viewport).
@igagis
igagis merged commit 29a3b0e into main Dec 1, 2026
23 checks passed
@igagis
igagis deleted the top-left-origin branch December 1, 2026 09:19
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.

2 participants