Revert "Merge pull request #88 from vaxerski/scaling"

This reverts commit f68ddc382a, reversing
changes made to ba573a529a.
This commit is contained in:
vaxerski 2022-05-18 14:42:00 +02:00
parent f68ddc382a
commit 5b15d3b4f4
6 changed files with 48 additions and 63 deletions

View file

@ -28,8 +28,8 @@ void Events::listener_change(wl_listener* listener, void* data) {
wlr_box BOX; wlr_box BOX;
wlr_output_layout_get_box(g_pCompositor->m_sWLROutputLayout, m.output, &BOX); wlr_output_layout_get_box(g_pCompositor->m_sWLROutputLayout, m.output, &BOX);
//m.vecSize.x = BOX.width; m.vecSize.x = BOX.width;
// m.vecSize.y = BOX.height; m.vecSize.y = BOX.height;
m.vecPosition.x = BOX.x; m.vecPosition.x = BOX.x;
m.vecPosition.y = BOX.y; m.vecPosition.y = BOX.y;
@ -38,7 +38,7 @@ void Events::listener_change(wl_listener* listener, void* data) {
CONFIGHEAD->state.x = m.vecPosition.x; CONFIGHEAD->state.x = m.vecPosition.x;
CONFIGHEAD->state.y = m.vecPosition.y; CONFIGHEAD->state.y = m.vecPosition.y;
wlr_output_set_custom_mode(m.output, m.vecPixelSize.x, m.vecPixelSize.y, (int)(round(m.refreshRate * 1000))); wlr_output_set_custom_mode(m.output, m.vecSize.x, m.vecSize.y, (int)(round(m.refreshRate * 1000)));
} }
wlr_output_manager_v1_set_configuration(g_pCompositor->m_sWLROutputMgr, CONFIG); wlr_output_manager_v1_set_configuration(g_pCompositor->m_sWLROutputMgr, CONFIG);
@ -181,11 +181,10 @@ void Events::listener_monitorFrame(void* owner, void* data) {
// if we have no tracking or full tracking, invalidate the entire monitor // if we have no tracking or full tracking, invalidate the entire monitor
if (DTMODE == DAMAGE_TRACKING_NONE || DTMODE == DAMAGE_TRACKING_MONITOR) { if (DTMODE == DAMAGE_TRACKING_NONE || DTMODE == DAMAGE_TRACKING_MONITOR) {
pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y); pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y);
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage); pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
} else { } else {
// if we use blur we need to expand the damage for proper blurring // if we use blur we need to expand the damage for proper blurring
if (g_pConfigManager->getInt("decoration:blur") == 1) { if (g_pConfigManager->getInt("decoration:blur") == 1) {
// TODO: can this be optimized? // TODO: can this be optimized?
@ -206,12 +205,12 @@ void Events::listener_monitorFrame(void* owner, void* data) {
// potentially can save on resources. // potentially can save on resources.
g_pHyprOpenGL->begin(PMONITOR, &damage); g_pHyprOpenGL->begin(PMONITOR, &damage);
g_pHyprOpenGL->clear(CColor(100, 11, 11, 255)); g_pHyprOpenGL->clear(CColor(11, 11, 11, 255));
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper" g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
g_pHyprRenderer->renderAllClientsForMonitor(PMONITOR->ID, &now); g_pHyprRenderer->renderAllClientsForMonitor(PMONITOR->ID, &now);
wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
wlr_output_render_software_cursors(PMONITOR->output, NULL); wlr_output_render_software_cursors(PMONITOR->output, NULL);
@ -224,10 +223,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
pixman_region32_init(&frameDamage); pixman_region32_init(&frameDamage);
const auto TRANSFORM = wlr_output_transform_invert(PMONITOR->output->transform); const auto TRANSFORM = wlr_output_transform_invert(PMONITOR->output->transform);
wlr_region_transform(&frameDamage, &PMONITOR->damage->current, TRANSFORM, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y); wlr_region_transform(&frameDamage, &PMONITOR->damage->current, TRANSFORM, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y);
if (DTMODE == DAMAGE_TRACKING_NONE || DTMODE == DAMAGE_TRACKING_MONITOR)
pixman_region32_union_rect(&frameDamage, &frameDamage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y);
wlr_output_set_damage(PMONITOR->output, &frameDamage); wlr_output_set_damage(PMONITOR->output, &frameDamage);
pixman_region32_fini(&frameDamage); pixman_region32_fini(&frameDamage);

View file

@ -9,7 +9,6 @@
struct SMonitor { struct SMonitor {
Vector2D vecPosition = Vector2D(0,0); Vector2D vecPosition = Vector2D(0,0);
Vector2D vecSize = Vector2D(0,0); Vector2D vecSize = Vector2D(0,0);
Vector2D vecPixelSize = Vector2D(0,0);
bool primary = false; bool primary = false;

View file

@ -63,7 +63,7 @@ void CFramebuffer::bind() {
#else #else
glBindFramebuffer(GL_FRAMEBUFFER, m_iFb); glBindFramebuffer(GL_FRAMEBUFFER, m_iFb);
#endif #endif
glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y); glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.y);
} }
void CFramebuffer::release() { void CFramebuffer::release() {

View file

@ -127,12 +127,12 @@ GLuint CHyprOpenGLImpl::compileShader(const GLuint& type, std::string src) {
return shader; return shader;
} }
void CHyprOpenGLImpl::begin(SMonitor* pMonitor, pixman_region32_t* pDamage, bool fake) { void CHyprOpenGLImpl::begin(SMonitor* pMonitor, pixman_region32_t* pDamage) {
m_RenderData.pMonitor = pMonitor; m_RenderData.pMonitor = pMonitor;
glViewport(0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); glViewport(0, 0, pMonitor->vecSize.x, pMonitor->vecSize.y);
wlr_matrix_projection(m_RenderData.projection, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: this is deprecated wlr_matrix_projection(m_RenderData.projection, pMonitor->vecSize.x, pMonitor->vecSize.y, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: this is deprecated
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@ -140,16 +140,16 @@ void CHyprOpenGLImpl::begin(SMonitor* pMonitor, pixman_region32_t* pDamage, bool
m_iWLROutputFb = m_iCurrentOutputFb; m_iWLROutputFb = m_iCurrentOutputFb;
// ensure a framebuffer for the monitor exists // ensure a framebuffer for the monitor exists
if (m_mMonitorRenderResources.find(pMonitor) == m_mMonitorRenderResources.end() || m_mMonitorRenderResources[pMonitor].primaryFB.m_Size != pMonitor->vecPixelSize) { if (m_mMonitorRenderResources.find(pMonitor) == m_mMonitorRenderResources.end() || m_mMonitorRenderResources[pMonitor].primaryFB.m_Size != pMonitor->vecSize) {
m_mMonitorRenderResources[pMonitor].stencilTex.allocate(); m_mMonitorRenderResources[pMonitor].stencilTex.allocate();
m_mMonitorRenderResources[pMonitor].primaryFB.m_pStencilTex = &m_mMonitorRenderResources[pMonitor].stencilTex; m_mMonitorRenderResources[pMonitor].primaryFB.m_pStencilTex = &m_mMonitorRenderResources[pMonitor].stencilTex;
m_mMonitorRenderResources[pMonitor].mirrorFB.m_pStencilTex = &m_mMonitorRenderResources[pMonitor].stencilTex; m_mMonitorRenderResources[pMonitor].mirrorFB.m_pStencilTex = &m_mMonitorRenderResources[pMonitor].stencilTex;
m_mMonitorRenderResources[pMonitor].mirrorSwapFB.m_pStencilTex = &m_mMonitorRenderResources[pMonitor].stencilTex; m_mMonitorRenderResources[pMonitor].mirrorSwapFB.m_pStencilTex = &m_mMonitorRenderResources[pMonitor].stencilTex;
m_mMonitorRenderResources[pMonitor].primaryFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); m_mMonitorRenderResources[pMonitor].primaryFB.alloc(pMonitor->vecSize.x * pMonitor->scale, pMonitor->vecSize.y * pMonitor->scale);
m_mMonitorRenderResources[pMonitor].mirrorFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); m_mMonitorRenderResources[pMonitor].mirrorFB.alloc(pMonitor->vecSize.x * pMonitor->scale, pMonitor->vecSize.y * pMonitor->scale);
m_mMonitorRenderResources[pMonitor].mirrorSwapFB.alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); m_mMonitorRenderResources[pMonitor].mirrorSwapFB.alloc(pMonitor->vecSize.x * pMonitor->scale, pMonitor->vecSize.y * pMonitor->scale);
createBGTextureForMonitor(pMonitor); createBGTextureForMonitor(pMonitor);
} }
@ -158,22 +158,19 @@ void CHyprOpenGLImpl::begin(SMonitor* pMonitor, pixman_region32_t* pDamage, bool
m_mMonitorRenderResources[pMonitor].primaryFB.bind(); m_mMonitorRenderResources[pMonitor].primaryFB.bind();
m_RenderData.pDamage = pDamage; m_RenderData.pDamage = pDamage;
m_bFakeFrame = fake;
} }
void CHyprOpenGLImpl::end() { void CHyprOpenGLImpl::end() {
// end the render, copy the data to the WLR framebuffer // end the render, copy the data to the WLR framebuffer
if (!m_bFakeFrame) { glBindFramebuffer(GL_FRAMEBUFFER, m_iWLROutputFb);
glBindFramebuffer(GL_FRAMEBUFFER, m_iWLROutputFb); wlr_box windowBox = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y};
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
pixman_region32_copy(m_RenderData.pDamage, &m_rOriginalDamageRegion); pixman_region32_copy(m_RenderData.pDamage, &m_rOriginalDamageRegion);
clear(CColor(11, 11, 11, 255)); clear(CColor(11, 11, 11, 255));
renderTexture(m_mMonitorRenderResources[m_RenderData.pMonitor].primaryFB.m_cTex, &monbox, 255.f, 0); scaleBox(&windowBox, m_RenderData.pMonitor->scale);
} renderTexture(m_mMonitorRenderResources[m_RenderData.pMonitor].primaryFB.m_cTex, &windowBox, 255.f, 0);
// reset our data // reset our data
m_RenderData.pMonitor = nullptr; m_RenderData.pMonitor = nullptr;
@ -200,7 +197,7 @@ void CHyprOpenGLImpl::clear(const CColor& color) {
void CHyprOpenGLImpl::scissor(const wlr_box* pBox) { void CHyprOpenGLImpl::scissor(const wlr_box* pBox) {
RASSERT(m_RenderData.pMonitor, "Tried to scissor without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to scissor without begin()!");
if (!pBox || true) { if (!pBox) {
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
return; return;
} }
@ -212,7 +209,7 @@ void CHyprOpenGLImpl::scissor(const wlr_box* pBox) {
void CHyprOpenGLImpl::scissor(const pixman_box32* pBox) { void CHyprOpenGLImpl::scissor(const pixman_box32* pBox) {
RASSERT(m_RenderData.pMonitor, "Tried to scissor without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to scissor without begin()!");
if (!pBox || true) { if (!pBox) {
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
return; return;
} }
@ -382,7 +379,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
// get transforms for the full monitor // get transforms for the full monitor
const auto TRANSFORM = wlr_output_transform_invert(WL_OUTPUT_TRANSFORM_NORMAL); const auto TRANSFORM = wlr_output_transform_invert(WL_OUTPUT_TRANSFORM_NORMAL);
float matrix[9]; float matrix[9];
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y};
wlr_matrix_project_box(matrix, &MONITORBOX, TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix); wlr_matrix_project_box(matrix, &MONITORBOX, TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix);
float glMatrix[9]; float glMatrix[9];
@ -425,9 +422,9 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
glUniformMatrix3fv(pShader->proj, 1, GL_FALSE, glMatrix); glUniformMatrix3fv(pShader->proj, 1, GL_FALSE, glMatrix);
glUniform1f(glGetUniformLocation(pShader->program, "radius"), BLURSIZE * (a / 255.f)); // this makes the blursize change with a glUniform1f(glGetUniformLocation(pShader->program, "radius"), BLURSIZE * (a / 255.f)); // this makes the blursize change with a
if (pShader == &m_shBLUR1) if (pShader == &m_shBLUR1)
glUniform2f(glGetUniformLocation(m_shBLUR1.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecPixelSize.x / 2.f), 0.5f / (m_RenderData.pMonitor->vecPixelSize.y / 2.f)); glUniform2f(glGetUniformLocation(m_shBLUR1.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecSize.x / 2.f), 0.5f / (m_RenderData.pMonitor->vecSize.y / 2.f));
else else
glUniform2f(glGetUniformLocation(m_shBLUR2.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecPixelSize.x * 2.f), 0.5f / (m_RenderData.pMonitor->vecPixelSize.y * 2.f)); glUniform2f(glGetUniformLocation(m_shBLUR2.program, "halfpixel"), 0.5f / (m_RenderData.pMonitor->vecSize.x * 2.f), 0.5f / (m_RenderData.pMonitor->vecSize.y * 2.f));
glUniform1i(pShader->tex, 0); glUniform1i(pShader->tex, 0);
glVertexAttribPointer(pShader->posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts); glVertexAttribPointer(pShader->posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
@ -506,7 +503,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
pixman_region32_t inverseOpaque; pixman_region32_t inverseOpaque;
pixman_region32_init(&inverseOpaque); pixman_region32_init(&inverseOpaque);
if (a == 255.f) { if (a == 255.f) {
pixman_box32_t monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; pixman_box32_t monbox = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y};
pixman_region32_copy(&inverseOpaque, &pSurface->current.opaque); pixman_region32_copy(&inverseOpaque, &pSurface->current.opaque);
pixman_region32_translate(&inverseOpaque, pBox->x, pBox->y); pixman_region32_translate(&inverseOpaque, pBox->x, pBox->y);
pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &monbox); pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &monbox);
@ -544,7 +541,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
// stencil done. Render everything. // stencil done. Render everything.
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y};
if (pixman_region32_not_empty(&damage)) { if (pixman_region32_not_empty(&damage)) {
// render our great blurred FB // render our great blurred FB
renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, a, &damage); renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, a, &damage);
@ -615,17 +612,17 @@ void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) {
// this is temporary, doesnt mess with the actual wlr damage // this is temporary, doesnt mess with the actual wlr damage
pixman_region32_t fakeDamage; pixman_region32_t fakeDamage;
pixman_region32_init(&fakeDamage); pixman_region32_init(&fakeDamage);
pixman_region32_union_rect(&fakeDamage, &fakeDamage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y); pixman_region32_union_rect(&fakeDamage, &fakeDamage, 0, 0, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y);
begin(PMONITOR, &fakeDamage, true); begin(PMONITOR, &fakeDamage);
pixman_region32_fini(&fakeDamage); pixman_region32_fini(&fakeDamage);
const auto PFRAMEBUFFER = &m_mWindowFramebuffers[pWindow]; const auto PFRAMEBUFFER = &m_mWindowFramebuffers[pWindow];
glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y); PFRAMEBUFFER->m_tTransform = g_pXWaylandManager->getWindowSurface(pWindow)->current.transform;
PFRAMEBUFFER->alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); PFRAMEBUFFER->alloc(PMONITOR->vecSize.x, PMONITOR->vecSize.y);
PFRAMEBUFFER->bind(); PFRAMEBUFFER->bind();
@ -652,6 +649,7 @@ void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) {
#else #else
glBindFramebuffer(GL_FRAMEBUFFER, m_iCurrentOutputFb); glBindFramebuffer(GL_FRAMEBUFFER, m_iCurrentOutputFb);
#endif #endif
glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.y);
end(); end();
@ -668,17 +666,17 @@ void CHyprOpenGLImpl::makeLayerSnapshot(SLayerSurface* pLayer) {
// this is temporary, doesnt mess with the actual wlr damage // this is temporary, doesnt mess with the actual wlr damage
pixman_region32_t fakeDamage; pixman_region32_t fakeDamage;
pixman_region32_init(&fakeDamage); pixman_region32_init(&fakeDamage);
pixman_region32_union_rect(&fakeDamage, &fakeDamage, 0, 0, (int)PMONITOR->vecPixelSize.x, (int)PMONITOR->vecPixelSize.y); pixman_region32_union_rect(&fakeDamage, &fakeDamage, 0, 0, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y);
begin(PMONITOR, &fakeDamage, true); begin(PMONITOR, &fakeDamage);
pixman_region32_fini(&fakeDamage); pixman_region32_fini(&fakeDamage);
const auto PFRAMEBUFFER = &m_mLayerFramebuffers[pLayer]; const auto PFRAMEBUFFER = &m_mLayerFramebuffers[pLayer];
glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y); PFRAMEBUFFER->m_tTransform = pLayer->layerSurface->surface->current.transform;
PFRAMEBUFFER->alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); PFRAMEBUFFER->alloc(PMONITOR->vecSize.x, PMONITOR->vecSize.y);
PFRAMEBUFFER->bind(); PFRAMEBUFFER->bind();
@ -696,6 +694,7 @@ void CHyprOpenGLImpl::makeLayerSnapshot(SLayerSurface* pLayer) {
#else #else
glBindFramebuffer(GL_FRAMEBUFFER, m_iCurrentOutputFb); glBindFramebuffer(GL_FRAMEBUFFER, m_iCurrentOutputFb);
#endif #endif
glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecSize.y);
end(); end();
@ -718,10 +717,10 @@ void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
wlr_box windowBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y}; wlr_box windowBox = {0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
pixman_region32_t fakeDamage; pixman_region32_t fakeDamage;
pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
renderTextureInternalWithDamage(it->second.m_cTex, &windowBox, PWINDOW->m_fAlpha.fl(), &fakeDamage, 0); renderTextureInternalWithDamage(it->second.m_cTex, &windowBox, PWINDOW->m_fAlpha.fl(), &fakeDamage, 0);
@ -744,10 +743,10 @@ void CHyprOpenGLImpl::renderSnapshot(SLayerSurface** pLayer) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(PLAYER->monitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(PLAYER->monitorID);
wlr_box windowBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y}; wlr_box windowBox = {0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
pixman_region32_t fakeDamage; pixman_region32_t fakeDamage;
pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
renderTextureInternalWithDamage(it->second.m_cTex, &windowBox, PLAYER->alpha.fl(), &fakeDamage, 0); renderTextureInternalWithDamage(it->second.m_cTex, &windowBox, PLAYER->alpha.fl(), &fakeDamage, 0);
@ -807,8 +806,8 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(SMonitor* pMonitor) {
void CHyprOpenGLImpl::clearWithTex() { void CHyprOpenGLImpl::clearWithTex() {
RASSERT(m_RenderData.pMonitor, "Tried to render BGtex without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render BGtex without begin()!");
wlr_box box = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; wlr_box box = {0, 0, m_RenderData.pMonitor->vecSize.x, m_RenderData.pMonitor->vecSize.y};
renderTexture(m_mMonitorBGTextures[m_RenderData.pMonitor], &box, 255, 0); renderTexture(m_mMonitorBGTextures[m_RenderData.pMonitor], &box, 255, 0);
} }

View file

@ -50,7 +50,7 @@ public:
CHyprOpenGLImpl(); CHyprOpenGLImpl();
void begin(SMonitor*, pixman_region32_t*, bool fake = false); void begin(SMonitor*, pixman_region32_t*);
void end(); void end();
void renderRect(wlr_box*, const CColor&, int round = 0); void renderRect(wlr_box*, const CColor&, int round = 0);
@ -92,8 +92,6 @@ private:
int m_iDRMFD; int m_iDRMFD;
std::string m_szExtensions; std::string m_szExtensions;
bool m_bFakeFrame = false;
// Shaders // Shaders
SQuad m_shQUAD; SQuad m_shQUAD;
CShader m_shRGBA; CShader m_shRGBA;

View file

@ -452,7 +452,6 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
double lx = 0, ly = 0; double lx = 0, ly = 0;
wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, m.output, &lx, &ly); wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, m.output, &lx, &ly);
pixman_region32_translate(&damageBox, lx, ly); pixman_region32_translate(&damageBox, lx, ly);
wlr_region_scale(&damageBox, &damageBox, m.scale);
wlr_output_damage_add(m.damage, &damageBox); wlr_output_damage_add(m.damage, &damageBox);
pixman_region32_translate(&damageBox, -lx, -ly); pixman_region32_translate(&damageBox, -lx, -ly);
} }
@ -473,7 +472,6 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) {
wlr_box fixedDamageBox = damageBox; wlr_box fixedDamageBox = damageBox;
fixedDamageBox.x -= m.vecPosition.x; fixedDamageBox.x -= m.vecPosition.x;
fixedDamageBox.y -= m.vecPosition.y; fixedDamageBox.y -= m.vecPosition.y;
scaleBox(&fixedDamageBox, m.scale);
wlr_output_damage_add_box(m.damage, &fixedDamageBox); wlr_output_damage_add_box(m.damage, &fixedDamageBox);
} }
@ -487,7 +485,6 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) {
wlr_box fixedDamageBox = damageBox; wlr_box fixedDamageBox = damageBox;
fixedDamageBox.x -= m.vecPosition.x; fixedDamageBox.x -= m.vecPosition.x;
fixedDamageBox.y -= m.vecPosition.y; fixedDamageBox.y -= m.vecPosition.y;
scaleBox(&fixedDamageBox, m.scale);
wlr_output_damage_add_box(m.damage, &fixedDamageBox); wlr_output_damage_add_box(m.damage, &fixedDamageBox);
} }
@ -497,7 +494,8 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) {
} }
void CHyprRenderer::damageMonitor(SMonitor* pMonitor) { void CHyprRenderer::damageMonitor(SMonitor* pMonitor) {
wlr_box damageBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y}; wlr_box damageBox = {0, 0, pMonitor->vecSize.x, pMonitor->vecSize.y};
scaleBox(&damageBox, pMonitor->scale);
wlr_output_damage_add_box(pMonitor->damage, &damageBox); wlr_output_damage_add_box(pMonitor->damage, &damageBox);
if (g_pConfigManager->getInt("debug:log_damage")) if (g_pConfigManager->getInt("debug:log_damage"))
@ -507,7 +505,6 @@ void CHyprRenderer::damageMonitor(SMonitor* pMonitor) {
void CHyprRenderer::damageBox(wlr_box* pBox) { void CHyprRenderer::damageBox(wlr_box* pBox) {
for (auto& m : g_pCompositor->m_lMonitors) { for (auto& m : g_pCompositor->m_lMonitors) {
wlr_box damageBox = {pBox->x - m.vecPosition.x, pBox->y - m.vecPosition.y, pBox->width, pBox->height}; wlr_box damageBox = {pBox->x - m.vecPosition.x, pBox->y - m.vecPosition.y, pBox->width, pBox->height};
scaleBox(&damageBox, m.scale);
wlr_output_damage_add_box(m.damage, &damageBox); wlr_output_damage_add_box(m.damage, &damageBox);
} }
@ -548,7 +545,7 @@ void CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorR
Debug::log(LOG, "Applying monitor rule for %s", pMonitor->szName.c_str()); Debug::log(LOG, "Applying monitor rule for %s", pMonitor->szName.c_str());
// Check if the rule isn't already applied // Check if the rule isn't already applied
if (!force && DELTALESSTHAN(pMonitor->vecPixelSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecPixelSize.y, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->scale == pMonitorRule->scale) { if (!force && DELTALESSTHAN(pMonitor->vecSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecSize.y, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->scale == pMonitorRule->scale) {
Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str()); Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str());
return; return;
} }
@ -607,12 +604,8 @@ void CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorR
} }
} else { } else {
wlr_output_set_custom_mode(pMonitor->output, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (int)pMonitorRule->refreshRate * 1000); wlr_output_set_custom_mode(pMonitor->output, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (int)pMonitorRule->refreshRate * 1000);
pMonitor->vecSize = pMonitorRule->resolution;
} }
pMonitor->vecPixelSize = pMonitor->vecSize;
pMonitor->vecSize = (pMonitor->vecSize / pMonitor->scale).floor();
// update renderer // update renderer
g_pHyprOpenGL->destroyMonitorResources(pMonitor); g_pHyprOpenGL->destroyMonitorResources(pMonitor);