mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-10 17:09:49 +01:00
renderer: use a render pass for render modif in client render
fixes #8918
This commit is contained in:
parent
aff34089c4
commit
4e93b2def5
4 changed files with 64 additions and 19 deletions
|
@ -110,7 +110,6 @@ struct SMonitorRenderData {
|
||||||
|
|
||||||
struct SCurrentRenderData {
|
struct SCurrentRenderData {
|
||||||
PHLMONITORREF pMonitor;
|
PHLMONITORREF pMonitor;
|
||||||
PHLWORKSPACE pWorkspace = nullptr;
|
|
||||||
Mat3x3 projection;
|
Mat3x3 projection;
|
||||||
Mat3x3 savedProjection;
|
Mat3x3 savedProjection;
|
||||||
Mat3x3 monitorProjection;
|
Mat3x3 monitorProjection;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "pass/TexPassElement.hpp"
|
#include "pass/TexPassElement.hpp"
|
||||||
#include "pass/ClearPassElement.hpp"
|
#include "pass/ClearPassElement.hpp"
|
||||||
#include "pass/RectPassElement.hpp"
|
#include "pass/RectPassElement.hpp"
|
||||||
|
#include "pass/RendererHintsPassElement.hpp"
|
||||||
#include "pass/SurfacePassElement.hpp"
|
#include "pass/SurfacePassElement.hpp"
|
||||||
#include "debug/Log.hpp"
|
#include "debug/Log.hpp"
|
||||||
|
|
||||||
|
@ -787,12 +788,6 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA
|
||||||
static auto PBACKGROUNDCOLOR = CConfigValue<Hyprlang::INT>("misc:background_color");
|
static auto PBACKGROUNDCOLOR = CConfigValue<Hyprlang::INT>("misc:background_color");
|
||||||
static auto PXPMODE = CConfigValue<Hyprlang::INT>("render:xp_mode");
|
static auto PXPMODE = CConfigValue<Hyprlang::INT>("render:xp_mode");
|
||||||
|
|
||||||
SRenderModifData RENDERMODIFDATA;
|
|
||||||
if (translate != Vector2D{0, 0})
|
|
||||||
RENDERMODIFDATA.modifs.emplace_back(std::make_pair<>(SRenderModifData::eRenderModifType::RMOD_TYPE_TRANSLATE, translate));
|
|
||||||
if (scale != 1.f)
|
|
||||||
RENDERMODIFDATA.modifs.emplace_back(std::make_pair<>(SRenderModifData::eRenderModifType::RMOD_TYPE_SCALE, scale));
|
|
||||||
|
|
||||||
if (!pMonitor)
|
if (!pMonitor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -805,7 +800,19 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA
|
||||||
// todo: matrices are buggy atm for some reason, but probably would be preferable in the long run
|
// todo: matrices are buggy atm for some reason, but probably would be preferable in the long run
|
||||||
// g_pHyprOpenGL->saveMatrix();
|
// g_pHyprOpenGL->saveMatrix();
|
||||||
// g_pHyprOpenGL->setMatrixScaleTranslate(translate, scale);
|
// g_pHyprOpenGL->setMatrixScaleTranslate(translate, scale);
|
||||||
g_pHyprOpenGL->m_RenderData.renderModif = RENDERMODIFDATA;
|
|
||||||
|
SRenderModifData RENDERMODIFDATA;
|
||||||
|
if (translate != Vector2D{0, 0})
|
||||||
|
RENDERMODIFDATA.modifs.emplace_back(std::make_pair<>(SRenderModifData::eRenderModifType::RMOD_TYPE_TRANSLATE, translate));
|
||||||
|
if (scale != 1.f)
|
||||||
|
RENDERMODIFDATA.modifs.emplace_back(std::make_pair<>(SRenderModifData::eRenderModifType::RMOD_TYPE_SCALE, scale));
|
||||||
|
|
||||||
|
CScopeGuard x([] {});
|
||||||
|
|
||||||
|
if (!RENDERMODIFDATA.modifs.empty()) {
|
||||||
|
g_pHyprRenderer->m_sRenderPass.add(makeShared<CRendererHintsPassElement>(CRendererHintsPassElement::SData{RENDERMODIFDATA}));
|
||||||
|
x = CScopeGuard([] { g_pHyprRenderer->m_sRenderPass.add(makeShared<CRendererHintsPassElement>(CRendererHintsPassElement::SData{SRenderModifData{}})); });
|
||||||
|
}
|
||||||
|
|
||||||
if (!pWorkspace) {
|
if (!pWorkspace) {
|
||||||
// allow rendering without a workspace. In this case, just render layers.
|
// allow rendering without a workspace. In this case, just render layers.
|
||||||
|
@ -828,8 +835,6 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA
|
||||||
renderLayer(ls.lock(), pMonitor, time);
|
renderLayer(ls.lock(), pMonitor, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pHyprOpenGL->m_RenderData.renderModif = {};
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -933,7 +938,6 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA
|
||||||
renderDragIcon(pMonitor, time);
|
renderDragIcon(pMonitor, time);
|
||||||
|
|
||||||
//g_pHyprOpenGL->restoreMatrix();
|
//g_pHyprOpenGL->restoreMatrix();
|
||||||
g_pHyprOpenGL->m_RenderData.renderModif = {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderLockscreen(PHLMONITOR pMonitor, timespec* now, const CBox& geometry) {
|
void CHyprRenderer::renderLockscreen(PHLMONITOR pMonitor, timespec* now, const CBox& geometry) {
|
||||||
|
@ -1436,9 +1440,7 @@ void CHyprRenderer::renderWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace
|
||||||
translate = Vector2D{};
|
translate = Vector2D{};
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pHyprOpenGL->m_RenderData.pWorkspace = pWorkspace;
|
|
||||||
renderAllClientsForWorkspace(pMonitor, pWorkspace, now, translate, scale);
|
renderAllClientsForWorkspace(pMonitor, pWorkspace, now, translate, scale);
|
||||||
g_pHyprOpenGL->m_RenderData.pWorkspace = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::sendFrameEventsToWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace, timespec* now) {
|
void CHyprRenderer::sendFrameEventsToWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace, timespec* now) {
|
||||||
|
|
19
src/render/pass/RendererHintsPassElement.cpp
Normal file
19
src/render/pass/RendererHintsPassElement.cpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#include "RendererHintsPassElement.hpp"
|
||||||
|
#include "../OpenGL.hpp"
|
||||||
|
|
||||||
|
CRendererHintsPassElement::CRendererHintsPassElement(const CRendererHintsPassElement::SData& data_) : data(data_) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRendererHintsPassElement::draw(const CRegion& damage) {
|
||||||
|
if (data.renderModif.has_value())
|
||||||
|
g_pHyprOpenGL->m_RenderData.renderModif = *data.renderModif;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRendererHintsPassElement::needsLiveBlur() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRendererHintsPassElement::needsPrecomputeBlur() {
|
||||||
|
return false;
|
||||||
|
}
|
25
src/render/pass/RendererHintsPassElement.hpp
Normal file
25
src/render/pass/RendererHintsPassElement.hpp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#pragma once
|
||||||
|
#include "PassElement.hpp"
|
||||||
|
#include <optional>
|
||||||
|
#include "../OpenGL.hpp"
|
||||||
|
|
||||||
|
class CRendererHintsPassElement : public IPassElement {
|
||||||
|
public:
|
||||||
|
struct SData {
|
||||||
|
std::optional<SRenderModifData> renderModif;
|
||||||
|
};
|
||||||
|
|
||||||
|
CRendererHintsPassElement(const SData& data);
|
||||||
|
virtual ~CRendererHintsPassElement() = default;
|
||||||
|
|
||||||
|
virtual void draw(const CRegion& damage);
|
||||||
|
virtual bool needsLiveBlur();
|
||||||
|
virtual bool needsPrecomputeBlur();
|
||||||
|
|
||||||
|
virtual const char* passName() {
|
||||||
|
return "CRendererHintsPassElement";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SData data;
|
||||||
|
};
|
Loading…
Reference in a new issue