renderer: stop looping over null texture surfaces (#12446)

fixes #12445
This commit is contained in:
Vaxry 2025-11-24 23:48:18 +00:00 committed by GitHub
parent 475e87b351
commit fe6a855bbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -612,6 +612,12 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
renderdata.surfaceCounter = 0;
pWindow->m_wlSurface->resource()->breadthfirst(
[this, &renderdata, &pWindow](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
if (!s->m_current.texture)
return;
if (s->m_current.size.x < 1 || s->m_current.size.y < 1)
return;
renderdata.localPos = offset;
renderdata.texture = s->m_current.texture;
renderdata.surface = s;
@ -685,6 +691,12 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
popup->m_wlSurface->resource()->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
if (!s->m_current.texture)
return;
if (s->m_current.size.x < 1 || s->m_current.size.y < 1)
return;
renderdata.localPos = offset;
renderdata.texture = s->m_current.texture;
renderdata.surface = s;
@ -765,6 +777,12 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
if (!popups)
pLayer->m_surface->resource()->breadthfirst(
[this, &renderdata, &pLayer](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
if (!s->m_current.texture)
return;
if (s->m_current.size.x < 1 || s->m_current.size.y < 1)
return;
renderdata.localPos = offset;
renderdata.texture = s->m_current.texture;
renderdata.surface = s;
@ -785,10 +803,18 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
return;
const auto SURF = popup->m_wlSurface->resource();
if (!SURF->m_current.texture)
return;
if (SURF->m_current.size.x < 1 || SURF->m_current.size.y < 1)
return;
Vector2D pos = popup->coordsRelativeToParent();
renderdata.localPos = pos;
renderdata.texture = popup->m_wlSurface->resource()->m_current.texture;
renderdata.surface = popup->m_wlSurface->resource();
renderdata.texture = SURF->m_current.texture;
renderdata.surface = SURF;
renderdata.mainSurface = false;
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
renderdata.surfaceCounter++;
@ -821,6 +847,12 @@ void CHyprRenderer::renderIMEPopup(CInputPopup* pPopup, PHLMONITOR pMonitor, con
SURF->breadthfirst(
[this, &renderdata, &SURF](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
if (!s->m_current.texture)
return;
if (s->m_current.size.x < 1 || s->m_current.size.y < 1)
return;
renderdata.localPos = offset;
renderdata.texture = s->m_current.texture;
renderdata.surface = s;
@ -842,6 +874,12 @@ void CHyprRenderer::renderSessionLockSurface(WP<SSessionLockSurface> pSurface, P
renderdata.surface->breadthfirst(
[this, &renderdata, &pSurface](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
if (!s->m_current.texture)
return;
if (s->m_current.size.x < 1 || s->m_current.size.y < 1)
return;
renderdata.localPos = offset;
renderdata.texture = s->m_current.texture;
renderdata.surface = s;
@ -2534,6 +2572,12 @@ void CHyprRenderer::makeSnapshot(WP<CPopup> popup) {
popup->m_wlSurface->resource()->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
if (!s->m_current.texture)
return;
if (s->m_current.size.x < 1 || s->m_current.size.y < 1)
return;
renderdata.localPos = offset;
renderdata.texture = s->m_current.texture;
renderdata.surface = s;