aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-11-04 19:42:47 +0000
committerVaxry <[email protected]>2024-11-04 19:45:23 +0000
commit88e9e0394541a853600bc2c910005c05fa156269 (patch)
tree767de503b0a559a8198f690c6e9867773694fdc5
parent0fb9a04526b06adfb3fd16b64e13b7d110ae7855 (diff)
downloadHyprland-88e9e0394541a853600bc2c910005c05fa156269.tar.gz
Hyprland-88e9e0394541a853600bc2c910005c05fa156269.zip
renderer: add expand_undersized_textures
adds an option to disable the texture expansion for textures that are smaller while resizing up
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/render/Renderer.cpp28
2 files changed, 17 insertions, 12 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 62c71dc7..c5d53e6a 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -590,6 +590,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("render:explicit_sync", Hyprlang::INT{2});
m_pConfig->addConfigValue("render:explicit_sync_kms", Hyprlang::INT{2});
m_pConfig->addConfigValue("render:direct_scanout", Hyprlang::INT{0});
+ m_pConfig->addConfigValue("render:expand_undersized_textures", Hyprlang::INT{1});
// devices
m_pConfig->addSpecialCategory("device", {"name"});
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index a133899b..6af3a99d 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -1084,8 +1084,10 @@ void CHyprRenderer::renderSessionLockMissing(PHLMONITOR pMonitor) {
void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface, PHLMONITOR pMonitor, bool main, const Vector2D& projSize,
const Vector2D& projSizeUnscaled, bool fixMisalignedFSV1) {
if (!pWindow || !pWindow->m_bIsX11) {
- Vector2D uvTL;
- Vector2D uvBR = Vector2D(1, 1);
+ static auto PEXPANDEDGES = CConfigValue<Hyprlang::INT>("render:expand_undersized_textures");
+
+ Vector2D uvTL;
+ Vector2D uvBR = Vector2D(1, 1);
if (pSurface->current.viewport.hasSource) {
// we stretch it to dest. if no dest, to 1,1
@@ -1115,16 +1117,18 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
// this will break if later on xdg geometry is hit, but we really try
// to let the apps know to NOT add CSD. Also if source is there.
// there is no way to fix this if that's the case
- const auto MONITOR_WL_SCALE = std::ceil(pMonitor->scale);
- const bool SCALE_UNAWARE = MONITOR_WL_SCALE != pSurface->current.scale && !pSurface->current.viewport.hasDestination;
- const auto EXPECTED_SIZE =
- ((pSurface->current.viewport.hasDestination ? pSurface->current.viewport.destination : pSurface->current.bufferSize / pSurface->current.scale) * pMonitor->scale)
- .round();
- if (!SCALE_UNAWARE && (EXPECTED_SIZE.x < projSize.x || EXPECTED_SIZE.y < projSize.y)) {
- // this will not work with shm AFAIK, idk why.
- // NOTE: this math is wrong if we have a source... or geom updates later, but I don't think we can do much
- const auto FIX = projSize / EXPECTED_SIZE;
- uvBR = uvBR * FIX;
+ if (*PEXPANDEDGES) {
+ const auto MONITOR_WL_SCALE = std::ceil(pMonitor->scale);
+ const bool SCALE_UNAWARE = MONITOR_WL_SCALE != pSurface->current.scale && !pSurface->current.viewport.hasDestination;
+ const auto EXPECTED_SIZE =
+ ((pSurface->current.viewport.hasDestination ? pSurface->current.viewport.destination : pSurface->current.bufferSize / pSurface->current.scale) * pMonitor->scale)
+ .round();
+ if (!SCALE_UNAWARE && (EXPECTED_SIZE.x < projSize.x || EXPECTED_SIZE.y < projSize.y)) {
+ // this will not work with shm AFAIK, idk why.
+ // NOTE: this math is wrong if we have a source... or geom updates later, but I don't think we can do much
+ const auto FIX = projSize / EXPECTED_SIZE;
+ uvBR = uvBR * FIX;
+ }
}
g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft = uvTL;