diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2023-11-24 10:54:21 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-24 10:54:21 +0000 |
| commit | 2ebfd0c7456eff7e9c03d379d1dfbc611dc26672 (patch) | |
| tree | 9fa0d65224283e717ef7a06bb60870a5d319e13e /src/helpers | |
| parent | e40e486f61f2643578b9977b86f408799dbc75fd (diff) | |
renderer: Move to a full Hyprland GL rendering pipeline (#3920)
Also updates wlroots
Diffstat (limited to 'src/helpers')
| -rw-r--r-- | src/helpers/Monitor.cpp | 9 | ||||
| -rw-r--r-- | src/helpers/Monitor.hpp | 54 | ||||
| -rw-r--r-- | src/helpers/Region.cpp | 9 | ||||
| -rw-r--r-- | src/helpers/Region.hpp | 2 |
4 files changed, 48 insertions, 26 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 20880d8d..833a7a5a 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -643,3 +643,12 @@ void CMonitor::moveTo(const Vector2D& pos) { Vector2D CMonitor::middle() { return vecPosition + vecSize / 2.f; } + +void CMonitor::updateMatrix() { + wlr_matrix_identity(projMatrix.data()); + if (transform != WL_OUTPUT_TRANSFORM_NORMAL) { + wlr_matrix_translate(projMatrix.data(), vecTransformedSize.x / 2.0, vecTransformedSize.y / 2.0); + wlr_matrix_transform(projMatrix.data(), transform); + wlr_matrix_translate(projMatrix.data(), -vecTransformedSize.x / 2.0, -vecTransformedSize.y / 2.0); + } +}
\ No newline at end of file diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index 2aa7e7eb..f354ca6d 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -50,32 +50,33 @@ class CMonitor { drmModeModeInfo customDrmMode = {}; // WLR stuff - wlr_damage_ring damage; - wlr_output* output = nullptr; - float refreshRate = 60; - int framesToSkip = 0; - int forceFullFrames = 0; - bool noFrameSchedule = false; - bool scheduledRecalc = false; - wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL; - bool gammaChanged = false; - float xwaylandScale = 1.f; - - bool dpmsStatus = true; - bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it. - bool enabled10bit = false; // as above, this can be TRUE even if 10 bit failed. - bool createdByUser = false; - uint32_t drmFormat = DRM_FORMAT_INVALID; - bool isUnsafeFallback = false; - - bool pendingFrame = false; // if we schedule a frame during rendering, reschedule it after - bool renderingActive = false; - - wl_event_source* renderTimer = nullptr; // for RAT - bool RATScheduled = false; - CTimer lastPresentationTimer; - - SMonitorRule activeMonitorRule; + wlr_damage_ring damage; + wlr_output* output = nullptr; + float refreshRate = 60; + int framesToSkip = 0; + int forceFullFrames = 0; + bool noFrameSchedule = false; + bool scheduledRecalc = false; + wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL; + bool gammaChanged = false; + float xwaylandScale = 1.f; + std::array<float, 9> projMatrix = {0}; + + bool dpmsStatus = true; + bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it. + bool enabled10bit = false; // as above, this can be TRUE even if 10 bit failed. + bool createdByUser = false; + uint32_t drmFormat = DRM_FORMAT_INVALID; + bool isUnsafeFallback = false; + + bool pendingFrame = false; // if we schedule a frame during rendering, reschedule it after + bool renderingActive = false; + + wl_event_source* renderTimer = nullptr; // for RAT + bool RATScheduled = false; + CTimer lastPresentationTimer; + + SMonitorRule activeMonitorRule; // mirroring CMonitor* pMirrorOf = nullptr; @@ -123,6 +124,7 @@ class CMonitor { void setSpecialWorkspace(const int& id); void moveTo(const Vector2D& pos); Vector2D middle(); + void updateMatrix(); bool m_bEnabled = false; bool m_bRenderingInitPassed = false; diff --git a/src/helpers/Region.cpp b/src/helpers/Region.cpp index 06b8536c..df7de442 100644 --- a/src/helpers/Region.cpp +++ b/src/helpers/Region.cpp @@ -93,6 +93,15 @@ CRegion& CRegion::translate(const Vector2D& vec) { return *this; } +CRegion& CRegion::transform(const wl_output_transform t, double w, double h) { + wlr_region_transform(&m_rRegion, &m_rRegion, t, w, h); + return *this; +} + +CRegion CRegion::copy() const { + return CRegion(*this); +} + CRegion& CRegion::scale(float scale) { wlr_region_scale(&m_rRegion, &m_rRegion, scale); return *this; diff --git a/src/helpers/Region.hpp b/src/helpers/Region.hpp index 1c6923df..7554aa58 100644 --- a/src/helpers/Region.hpp +++ b/src/helpers/Region.hpp @@ -45,12 +45,14 @@ class CRegion { CRegion& intersect(const CRegion& other); CRegion& intersect(double x, double y, double w, double h); CRegion& translate(const Vector2D& vec); + CRegion& transform(const wl_output_transform t, double w, double h); CRegion& invert(pixman_box32_t* box); CRegion& scale(float scale); CBox getExtents(); bool containsPoint(const Vector2D& vec) const; bool empty() const; Vector2D closestPoint(const Vector2D& vec) const; + CRegion copy() const; std::vector<pixman_box32_t> getRects() const; |
