renderer: fixup damage_ring rotation

This commit is contained in:
Vaxry 2024-02-19 18:17:32 +00:00
parent fe9c8d8745
commit d62e7a5125
2 changed files with 20 additions and 13 deletions

View file

@ -1098,14 +1098,14 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (UNLOCK_SC)
wlr_output_lock_software_cursors(pMonitor->output, true);
if (pMonitor->forceFullFrames > 0) {
pMonitor->forceFullFrames -= 1;
if (pMonitor->forceFullFrames > 10)
pMonitor->forceFullFrames = 0;
}
pMonitor->renderingActive = true;
// we need to cleanup fading out when rendering the appropriate context
g_pCompositor->cleanupFadingOut(pMonitor->ID);
// TODO: this is getting called with extents being 0,0,0,0 should it be?
// potentially can save on resources.
TRACY_GPU_ZONE("Render");
if (pMonitor == g_pCompositor->getMonitorFromCursor())
@ -1120,7 +1120,6 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
}
CRegion damage;
if (!beginRender(pMonitor, damage, RENDER_MODE_NORMAL)) {
Debug::log(ERR, "renderer: couldn't beginRender()!");
@ -1132,11 +1131,6 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
return;
}
wlr_damage_ring_rotate_buffer(&pMonitor->damage, m_pCurrentWlrBuffer, damage.pixman());
// we need to cleanup fading out when rendering the appropriate context
g_pCompositor->cleanupFadingOut(pMonitor->ID);
// if we have no tracking or full tracking, invalidate the entire monitor
if (**PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || **PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || pMonitor->forceFullFrames > 0 || damageBlinkCleanup > 0 ||
pMonitor->isMirror() /* why??? */) {
@ -1165,9 +1159,15 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
}
}
// apply modified damage to render pass
// update damage in renderdata as we modified it
g_pHyprOpenGL->m_RenderData.damage.set(damage);
if (pMonitor->forceFullFrames > 0) {
pMonitor->forceFullFrames -= 1;
if (pMonitor->forceFullFrames > 10)
pMonitor->forceFullFrames = 0;
}
EMIT_HOOK_EVENT("render", RENDER_BEGIN);
bool renderCursor = true;
@ -1258,6 +1258,8 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (UNLOCK_SC)
wlr_output_lock_software_cursors(pMonitor->output, false);
damageMonitor(pMonitor);
return;
}
@ -2484,6 +2486,9 @@ bool CHyprRenderer::beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode
return false;
}
if (mode == RENDER_MODE_NORMAL)
wlr_damage_ring_rotate_buffer(&pMonitor->damage, m_pCurrentWlrBuffer, damage.pixman());
m_pCurrentRenderbuffer->bind();
g_pHyprOpenGL->begin(pMonitor, &damage);

View file

@ -73,6 +73,8 @@ class CHyprRenderer {
void makeEGLCurrent();
void unsetEGL();
// if RENDER_MODE_NORMAL, provided damage will be written to.
// otherwise, it will be the one used.
bool beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode mode = RENDER_MODE_NORMAL, wlr_buffer* buffer = nullptr, CFramebuffer* fb = nullptr);
void endRender();