refactor: Use new hyprutils casts (#11377)
This commit is contained in:
parent
aa6a78f0a4
commit
beee22a95e
116 changed files with 715 additions and 696 deletions
|
|
@ -47,7 +47,7 @@ bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) {
|
|||
}
|
||||
|
||||
auto status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
RASSERT((status == GL_FRAMEBUFFER_COMPLETE), "Framebuffer incomplete, couldn't create! (FB status: {}, GL Error: 0x{:x})", status, (int)glGetError());
|
||||
RASSERT((status == GL_FRAMEBUFFER_COMPLETE), "Framebuffer incomplete, couldn't create! (FB status: {}, GL Error: 0x{:x})", status, sc<int>(glGetError()));
|
||||
|
||||
Debug::log(LOG, "Framebuffer created, status {}", status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ const std::vector<const char*> ASSET_PATHS = {
|
|||
};
|
||||
|
||||
static inline void loadGLProc(void* pProc, const char* name) {
|
||||
void* proc = (void*)eglGetProcAddress(name);
|
||||
void* proc = rc<void*>(eglGetProcAddress(name));
|
||||
if (proc == nullptr) {
|
||||
Debug::log(CRIT, "[Tracy GPU Profiling] eglGetProcAddress({}) failed", name);
|
||||
abort();
|
||||
}
|
||||
*(void**)pProc = proc;
|
||||
*sc<void**>(pProc) = proc;
|
||||
}
|
||||
|
||||
static enum eLogLevel eglLogToLevel(EGLint type) {
|
||||
|
|
@ -142,7 +142,7 @@ void CHyprOpenGLImpl::initEGL(bool gbm) {
|
|||
if (eglInitialize(m_eglDisplay, &major, &minor) == EGL_FALSE)
|
||||
RASSERT(false, "EGL: failed to initialize a platform display");
|
||||
|
||||
const std::string EGLEXTENSIONS = (const char*)eglQueryString(m_eglDisplay, EGL_EXTENSIONS);
|
||||
const std::string EGLEXTENSIONS = eglQueryString(m_eglDisplay, EGL_EXTENSIONS);
|
||||
|
||||
m_exts.IMG_context_priority = EGLEXTENSIONS.contains("IMG_context_priority");
|
||||
m_exts.EXT_create_context_robustness = EGLEXTENSIONS.contains("EXT_create_context_robustness");
|
||||
|
|
@ -254,7 +254,7 @@ EGLDeviceEXT CHyprOpenGLImpl::eglDeviceFromDRMFD(int drmFD) {
|
|||
}
|
||||
|
||||
CHyprOpenGLImpl::CHyprOpenGLImpl() : m_drmFD(g_pCompositor->m_drmFD) {
|
||||
const std::string EGLEXTENSIONS = (const char*)eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
||||
const std::string EGLEXTENSIONS = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
||||
|
||||
Debug::log(LOG, "Supported EGL global extensions: ({}) {}", std::ranges::count(EGLEXTENSIONS, ' '), EGLEXTENSIONS);
|
||||
|
||||
|
|
@ -323,15 +323,15 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() : m_drmFD(g_pCompositor->m_drmFD) {
|
|||
|
||||
RASSERT(success, "EGL does not support KHR_platform_gbm or EXT_platform_device, this is an issue with your gpu driver.");
|
||||
|
||||
auto* const EXTENSIONS = (const char*)glGetString(GL_EXTENSIONS);
|
||||
auto* const EXTENSIONS = rc<const char*>(glGetString(GL_EXTENSIONS));
|
||||
RASSERT(EXTENSIONS, "Couldn't retrieve openGL extensions!");
|
||||
|
||||
m_extensions = EXTENSIONS;
|
||||
|
||||
Debug::log(LOG, "Creating the Hypr OpenGL Renderer!");
|
||||
Debug::log(LOG, "Using: {}", (char*)glGetString(GL_VERSION));
|
||||
Debug::log(LOG, "Vendor: {}", (char*)glGetString(GL_VENDOR));
|
||||
Debug::log(LOG, "Renderer: {}", (char*)glGetString(GL_RENDERER));
|
||||
Debug::log(LOG, "Using: {}", rc<const char*>(glGetString(GL_VERSION)));
|
||||
Debug::log(LOG, "Vendor: {}", rc<const char*>(glGetString(GL_VENDOR)));
|
||||
Debug::log(LOG, "Renderer: {}", rc<const char*>(glGetString(GL_RENDERER)));
|
||||
Debug::log(LOG, "Supported extensions: ({}) {}", std::ranges::count(m_extensions, ' '), m_extensions);
|
||||
|
||||
m_exts.EXT_read_format_bgra = m_extensions.contains("GL_EXT_read_format_bgra");
|
||||
|
|
@ -343,7 +343,7 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() : m_drmFD(g_pCompositor->m_drmFD) {
|
|||
if (!m_exts.EXT_image_dma_buf_import || !m_exts.EXT_image_dma_buf_import_modifiers)
|
||||
Debug::log(WARN, "Your GPU does not support DMABUFs, this will possibly cause issues and will take a hit on the performance.");
|
||||
|
||||
const std::string EGLEXTENSIONS_DISPLAY = (const char*)eglQueryString(m_eglDisplay, EGL_EXTENSIONS);
|
||||
const std::string EGLEXTENSIONS_DISPLAY = eglQueryString(m_eglDisplay, EGL_EXTENSIONS);
|
||||
|
||||
Debug::log(LOG, "Supported EGL display extensions: ({}) {}", std::ranges::count(EGLEXTENSIONS_DISPLAY, ' '), EGLEXTENSIONS_DISPLAY);
|
||||
|
||||
|
|
@ -563,9 +563,9 @@ EGLImageKHR CHyprOpenGLImpl::createEGLImage(const Aquamarine::SDMABUFAttrs& attr
|
|||
|
||||
if (m_hasModifiers && attrs.modifier != DRM_FORMAT_MOD_INVALID) {
|
||||
attribs[idx++] = attrNames[i].modlo;
|
||||
attribs[idx++] = static_cast<uint32_t>(attrs.modifier & 0xFFFFFFFF);
|
||||
attribs[idx++] = sc<uint32_t>(attrs.modifier & 0xFFFFFFFF);
|
||||
attribs[idx++] = attrNames[i].modhi;
|
||||
attribs[idx++] = static_cast<uint32_t>(attrs.modifier >> 32);
|
||||
attribs[idx++] = sc<uint32_t>(attrs.modifier >> 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -575,7 +575,7 @@ EGLImageKHR CHyprOpenGLImpl::createEGLImage(const Aquamarine::SDMABUFAttrs& attr
|
|||
|
||||
RASSERT(idx <= attribs.size(), "createEglImage: attribs array out of bounds.");
|
||||
|
||||
EGLImageKHR image = m_proc.eglCreateImageKHR(m_eglDisplay, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, nullptr, (int*)attribs.data());
|
||||
EGLImageKHR image = m_proc.eglCreateImageKHR(m_eglDisplay, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, nullptr, rc<int*>(attribs.data()));
|
||||
if (image == EGL_NO_IMAGE_KHR) {
|
||||
Debug::log(ERR, "EGL: EGLCreateImageKHR failed: {}", eglGetError());
|
||||
return EGL_NO_IMAGE_KHR;
|
||||
|
|
@ -652,7 +652,7 @@ GLuint CHyprOpenGLImpl::compileShader(const GLuint& type, std::string src, bool
|
|||
|
||||
auto shaderSource = src.c_str();
|
||||
|
||||
glShaderSource(shader, 1, (const GLchar**)&shaderSource, nullptr);
|
||||
glShaderSource(shader, 1, &shaderSource, nullptr);
|
||||
glCompileShader(shader);
|
||||
|
||||
GLint ok;
|
||||
|
|
@ -1421,8 +1421,8 @@ void CHyprOpenGLImpl::renderRectWithDamageInternal(const CBox& box, const CHyprC
|
|||
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
||||
|
||||
// Rounded corners
|
||||
m_shaders->m_shQUAD.setUniformFloat2(SHADER_TOP_LEFT, (float)TOPLEFT.x, (float)TOPLEFT.y);
|
||||
m_shaders->m_shQUAD.setUniformFloat2(SHADER_FULL_SIZE, (float)FULLSIZE.x, (float)FULLSIZE.y);
|
||||
m_shaders->m_shQUAD.setUniformFloat2(SHADER_TOP_LEFT, sc<float>(TOPLEFT.x), sc<float>(TOPLEFT.y));
|
||||
m_shaders->m_shQUAD.setUniformFloat2(SHADER_FULL_SIZE, sc<float>(FULLSIZE.x), sc<float>(FULLSIZE.y));
|
||||
m_shaders->m_shQUAD.setUniformFloat(SHADER_RADIUS, data.round);
|
||||
m_shaders->m_shQUAD.setUniformFloat(SHADER_ROUNDING_POWER, data.roundingPower);
|
||||
|
||||
|
|
@ -1846,7 +1846,7 @@ CFramebuffer* CHyprOpenGLImpl::blurFramebufferWithDamage(float a, CRegion* origi
|
|||
CRegion damage{*originalDamage};
|
||||
damage.transform(wlTransformToHyprutils(invertTransform(m_renderData.pMonitor->m_transform)), m_renderData.pMonitor->m_transformedSize.x,
|
||||
m_renderData.pMonitor->m_transformedSize.y);
|
||||
damage.expand(*PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, *PBLURPASSES));
|
||||
damage.expand(*PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, sc<int64_t>(1), sc<int64_t>(40)) * pow(2, *PBLURPASSES));
|
||||
|
||||
// helper
|
||||
const auto PMIRRORFB = &m_renderData.pCurrentMonData->mirrorFB;
|
||||
|
|
@ -2361,7 +2361,7 @@ void CHyprOpenGLImpl::renderBorder(const CBox& box, const CGradientValueData& gr
|
|||
m_shaders->m_shBORDER1.setUniformMatrix3fv(SHADER_PROJ, 1, GL_TRUE, glMatrix.getMatrix());
|
||||
m_shaders->m_shBORDER1.setUniform4fv(SHADER_GRADIENT, grad.m_colorsOkLabA.size() / 4, grad.m_colorsOkLabA);
|
||||
m_shaders->m_shBORDER1.setUniformInt(SHADER_GRADIENT_LENGTH, grad.m_colorsOkLabA.size() / 4);
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_ANGLE, (int)(grad.m_angle / (std::numbers::pi / 180.0)) % 360 * (std::numbers::pi / 180.0));
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_ANGLE, sc<int>(grad.m_angle / (std::numbers::pi / 180.0)) % 360 * (std::numbers::pi / 180.0));
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_ALPHA, data.a);
|
||||
m_shaders->m_shBORDER1.setUniformInt(SHADER_GRADIENT2_LENGTH, 0);
|
||||
|
||||
|
|
@ -2372,9 +2372,9 @@ void CHyprOpenGLImpl::renderBorder(const CBox& box, const CGradientValueData& gr
|
|||
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
|
||||
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
||||
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_TOP_LEFT, (float)TOPLEFT.x, (float)TOPLEFT.y);
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_FULL_SIZE, (float)FULLSIZE.x, (float)FULLSIZE.y);
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_FULL_SIZE_UNTRANSFORMED, (float)newBox.width, (float)newBox.height);
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_TOP_LEFT, sc<float>(TOPLEFT.x), sc<float>(TOPLEFT.y));
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_FULL_SIZE, sc<float>(FULLSIZE.x), sc<float>(FULLSIZE.y));
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_FULL_SIZE_UNTRANSFORMED, sc<float>(newBox.width), sc<float>(newBox.height));
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_RADIUS, round);
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_RADIUS_OUTER, data.outerRound == -1 ? round : data.outerRound);
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_ROUNDING_POWER, data.roundingPower);
|
||||
|
|
@ -2447,11 +2447,11 @@ void CHyprOpenGLImpl::renderBorder(const CBox& box, const CGradientValueData& gr
|
|||
m_shaders->m_shBORDER1.setUniformMatrix3fv(SHADER_PROJ, 1, GL_TRUE, glMatrix.getMatrix());
|
||||
m_shaders->m_shBORDER1.setUniform4fv(SHADER_GRADIENT, grad1.m_colorsOkLabA.size() / 4, grad1.m_colorsOkLabA);
|
||||
m_shaders->m_shBORDER1.setUniformInt(SHADER_GRADIENT_LENGTH, grad1.m_colorsOkLabA.size() / 4);
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_ANGLE, (int)(grad1.m_angle / (std::numbers::pi / 180.0)) % 360 * (std::numbers::pi / 180.0));
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_ANGLE, sc<int>(grad1.m_angle / (std::numbers::pi / 180.0)) % 360 * (std::numbers::pi / 180.0));
|
||||
if (!grad2.m_colorsOkLabA.empty())
|
||||
m_shaders->m_shBORDER1.setUniform4fv(SHADER_GRADIENT2, grad2.m_colorsOkLabA.size() / 4, grad2.m_colorsOkLabA);
|
||||
m_shaders->m_shBORDER1.setUniformInt(SHADER_GRADIENT2_LENGTH, grad2.m_colorsOkLabA.size() / 4);
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_ANGLE2, (int)(grad2.m_angle / (std::numbers::pi / 180.0)) % 360 * (std::numbers::pi / 180.0));
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_ANGLE2, sc<int>(grad2.m_angle / (std::numbers::pi / 180.0)) % 360 * (std::numbers::pi / 180.0));
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_ALPHA, data.a);
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_GRADIENT_LERP, lerp);
|
||||
|
||||
|
|
@ -2462,9 +2462,9 @@ void CHyprOpenGLImpl::renderBorder(const CBox& box, const CGradientValueData& gr
|
|||
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
|
||||
const auto FULLSIZE = Vector2D(transformedBox.width, transformedBox.height);
|
||||
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_TOP_LEFT, (float)TOPLEFT.x, (float)TOPLEFT.y);
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_FULL_SIZE, (float)FULLSIZE.x, (float)FULLSIZE.y);
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_FULL_SIZE_UNTRANSFORMED, (float)newBox.width, (float)newBox.height);
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_TOP_LEFT, sc<float>(TOPLEFT.x), sc<float>(TOPLEFT.y));
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_FULL_SIZE, sc<float>(FULLSIZE.x), sc<float>(FULLSIZE.y));
|
||||
m_shaders->m_shBORDER1.setUniformFloat2(SHADER_FULL_SIZE_UNTRANSFORMED, sc<float>(newBox.width), sc<float>(newBox.height));
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_RADIUS, round);
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_RADIUS_OUTER, data.outerRound == -1 ? round : data.outerRound);
|
||||
m_shaders->m_shBORDER1.setUniformFloat(SHADER_ROUNDING_POWER, data.roundingPower);
|
||||
|
|
@ -2508,7 +2508,7 @@ void CHyprOpenGLImpl::renderRoundedShadow(const CBox& box, int round, float roun
|
|||
|
||||
static auto PSHADOWPOWER = CConfigValue<Hyprlang::INT>("decoration:shadow:render_power");
|
||||
|
||||
const auto SHADOWPOWER = std::clamp((int)*PSHADOWPOWER, 1, 4);
|
||||
const auto SHADOWPOWER = std::clamp(sc<int>(*PSHADOWPOWER), 1, 4);
|
||||
|
||||
const auto col = color;
|
||||
|
||||
|
|
@ -2532,9 +2532,9 @@ void CHyprOpenGLImpl::renderRoundedShadow(const CBox& box, int round, float roun
|
|||
const auto FULLSIZE = Vector2D(newBox.width, newBox.height);
|
||||
|
||||
// Rounded corners
|
||||
m_shaders->m_shSHADOW.setUniformFloat2(SHADER_TOP_LEFT, (float)TOPLEFT.x, (float)TOPLEFT.y);
|
||||
m_shaders->m_shSHADOW.setUniformFloat2(SHADER_BOTTOM_RIGHT, (float)BOTTOMRIGHT.x, (float)BOTTOMRIGHT.y);
|
||||
m_shaders->m_shSHADOW.setUniformFloat2(SHADER_FULL_SIZE, (float)FULLSIZE.x, (float)FULLSIZE.y);
|
||||
m_shaders->m_shSHADOW.setUniformFloat2(SHADER_TOP_LEFT, sc<float>(TOPLEFT.x), sc<float>(TOPLEFT.y));
|
||||
m_shaders->m_shSHADOW.setUniformFloat2(SHADER_BOTTOM_RIGHT, sc<float>(BOTTOMRIGHT.x), sc<float>(BOTTOMRIGHT.y));
|
||||
m_shaders->m_shSHADOW.setUniformFloat2(SHADER_FULL_SIZE, sc<float>(FULLSIZE.x), sc<float>(FULLSIZE.y));
|
||||
m_shaders->m_shSHADOW.setUniformFloat(SHADER_RADIUS, range + round);
|
||||
m_shaders->m_shSHADOW.setUniformFloat(SHADER_ROUNDING_POWER, roundingPower);
|
||||
m_shaders->m_shSHADOW.setUniformFloat(SHADER_RANGE, range);
|
||||
|
|
@ -2623,7 +2623,7 @@ void CHyprOpenGLImpl::renderSplash(cairo_t* const CAIRO, cairo_surface_t* const
|
|||
static auto FALLBACKFONT = CConfigValue<std::string>("misc:font_family");
|
||||
|
||||
const auto FONTFAMILY = *PSPLASHFONT != STRVAL_EMPTY ? *PSPLASHFONT : *FALLBACKFONT;
|
||||
const auto FONTSIZE = (int)(size.y / 76);
|
||||
const auto FONTSIZE = sc<int>(size.y / 76);
|
||||
const auto COLOR = CHyprColor(*PSPLASHCOLOR);
|
||||
|
||||
PangoLayout* layoutText = pango_cairo_create_layout(CAIRO);
|
||||
|
|
@ -2724,7 +2724,7 @@ SP<CTexture> CHyprOpenGLImpl::renderText(const std::string& text, CHyprColor col
|
|||
pango_font_description_set_family_static(pangoFD, FONTFAMILY.c_str());
|
||||
pango_font_description_set_absolute_size(pangoFD, FONTSIZE * PANGO_SCALE);
|
||||
pango_font_description_set_style(pangoFD, italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
|
||||
pango_font_description_set_weight(pangoFD, static_cast<PangoWeight>(weight));
|
||||
pango_font_description_set_weight(pangoFD, sc<PangoWeight>(weight));
|
||||
pango_layout_set_font_description(layoutText, pangoFD);
|
||||
|
||||
cairo_set_source_rgba(CAIRO, COLOR.r, COLOR.g, COLOR.b, COLOR.a);
|
||||
|
|
@ -2755,7 +2755,7 @@ SP<CTexture> CHyprOpenGLImpl::renderText(const std::string& text, CHyprColor col
|
|||
pango_font_description_set_family_static(pangoFD, FONTFAMILY.c_str());
|
||||
pango_font_description_set_absolute_size(pangoFD, FONTSIZE * PANGO_SCALE);
|
||||
pango_font_description_set_style(pangoFD, italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
|
||||
pango_font_description_set_weight(pangoFD, static_cast<PangoWeight>(weight));
|
||||
pango_font_description_set_weight(pangoFD, sc<PangoWeight>(weight));
|
||||
pango_layout_set_font_description(layoutText, pangoFD);
|
||||
pango_layout_set_text(layoutText, text.c_str(), -1);
|
||||
|
||||
|
|
@ -2872,7 +2872,7 @@ void CHyprOpenGLImpl::ensureBackgroundTexturePresence() {
|
|||
static auto PNOWALLPAPER = CConfigValue<Hyprlang::INT>("misc:disable_hyprland_logo");
|
||||
static auto PFORCEWALLPAPER = CConfigValue<Hyprlang::INT>("misc:force_default_wallpaper");
|
||||
|
||||
const auto FORCEWALLPAPER = std::clamp(*PFORCEWALLPAPER, static_cast<int64_t>(-1L), static_cast<int64_t>(2L));
|
||||
const auto FORCEWALLPAPER = std::clamp(*PFORCEWALLPAPER, -1L, 2L);
|
||||
|
||||
if (*PNOWALLPAPER)
|
||||
m_backgroundTexture.reset();
|
||||
|
|
@ -2887,7 +2887,7 @@ void CHyprOpenGLImpl::ensureBackgroundTexturePresence() {
|
|||
|
||||
texPath += std::to_string(distribution(engine));
|
||||
} else
|
||||
texPath += std::to_string(std::clamp(*PFORCEWALLPAPER, (int64_t)0, (int64_t)2));
|
||||
texPath += std::to_string(std::clamp(*PFORCEWALLPAPER, sc<int64_t>(0), sc<int64_t>(2)));
|
||||
|
||||
texPath += ".png";
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ CRenderbuffer::CRenderbuffer(SP<Aquamarine::IBuffer> buffer, uint32_t format) :
|
|||
|
||||
glGenRenderbuffers(1, &m_rbo);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_rbo);
|
||||
g_pHyprOpenGL->m_proc.glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER, (GLeglImageOES)m_image);
|
||||
g_pHyprOpenGL->m_proc.glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER, m_image);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
|
||||
glGenFramebuffers(1, &m_framebuffer.m_fb);
|
||||
|
|
|
|||
|
|
@ -1139,10 +1139,10 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
|
|||
|
||||
// Adjust UV based on the xdg_surface geometry
|
||||
if (geom.x != 0 || geom.y != 0 || geom.w != 0 || geom.h != 0) {
|
||||
const auto XPERC = (double)geom.x / (double)pSurface->m_current.size.x;
|
||||
const auto YPERC = (double)geom.y / (double)pSurface->m_current.size.y;
|
||||
const auto WPERC = (double)(geom.x + geom.w ? geom.w : pSurface->m_current.size.x) / (double)pSurface->m_current.size.x;
|
||||
const auto HPERC = (double)(geom.y + geom.h ? geom.h : pSurface->m_current.size.y) / (double)pSurface->m_current.size.y;
|
||||
const auto XPERC = geom.x / pSurface->m_current.size.x;
|
||||
const auto YPERC = geom.y / pSurface->m_current.size.y;
|
||||
const auto WPERC = (geom.x + geom.w ? geom.w : pSurface->m_current.size.x) / pSurface->m_current.size.x;
|
||||
const auto HPERC = (geom.y + geom.h ? geom.h : pSurface->m_current.size.y) / pSurface->m_current.size.y;
|
||||
|
||||
const auto TOADDTL = Vector2D(XPERC * (uvBR.x - uvTL.x), YPERC * (uvBR.y - uvTL.y));
|
||||
uvBR = uvBR - Vector2D((1.0 - WPERC) * (uvBR.x - uvTL.x), (1.0 - HPERC) * (uvBR.y - uvTL.y));
|
||||
|
|
@ -1349,7 +1349,7 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) {
|
|||
|
||||
// if we have no tracking or full tracking, invalidate the entire monitor
|
||||
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || pMonitor->m_forceFullFrames > 0 || damageBlinkCleanup > 0)
|
||||
damage = {0, 0, (int)pMonitor->m_transformedSize.x * 10, (int)pMonitor->m_transformedSize.y * 10};
|
||||
damage = {0, 0, sc<int>(pMonitor->m_transformedSize.x) * 10, sc<int>(pMonitor->m_transformedSize.y) * 10};
|
||||
|
||||
finalDamage = damage;
|
||||
|
||||
|
|
@ -1375,7 +1375,7 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) {
|
|||
EMIT_HOOK_EVENT("render", RENDER_POST_MIRROR);
|
||||
renderCursor = false;
|
||||
} else {
|
||||
CBox renderBox = {0, 0, (int)pMonitor->m_pixelSize.x, (int)pMonitor->m_pixelSize.y};
|
||||
CBox renderBox = {0, 0, sc<int>(pMonitor->m_pixelSize.x), sc<int>(pMonitor->m_pixelSize.y)};
|
||||
renderWorkspace(pMonitor, pMonitor->m_activeWorkspace, NOW, renderBox);
|
||||
|
||||
renderLockscreen(pMonitor, NOW, renderBox);
|
||||
|
|
@ -1431,7 +1431,7 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) {
|
|||
frameDamage.transform(wlTransformToHyprutils(TRANSFORM), pMonitor->m_transformedSize.x, pMonitor->m_transformedSize.y);
|
||||
|
||||
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
|
||||
frameDamage.add(0, 0, (int)pMonitor->m_transformedSize.x, (int)pMonitor->m_transformedSize.y);
|
||||
frameDamage.add(0, 0, sc<int>(pMonitor->m_transformedSize.x), sc<int>(pMonitor->m_transformedSize.y));
|
||||
|
||||
if (*PDAMAGEBLINK)
|
||||
frameDamage.add(damage);
|
||||
|
|
@ -1481,8 +1481,8 @@ static hdr_output_metadata createHDRMetadata(SImageDescription settings, A
|
|||
default: return NO_HDR_METADATA; // empty metadata for SDR
|
||||
}
|
||||
|
||||
const auto toNits = [](uint32_t value) { return uint16_t(std::round(value)); };
|
||||
const auto to16Bit = [](float value) { return uint16_t(std::round(value * 50000)); };
|
||||
const auto toNits = [](uint32_t value) { return sc<uint16_t>(std::round(value)); };
|
||||
const auto to16Bit = [](float value) { return sc<uint16_t>(std::round(value * 50000)); };
|
||||
|
||||
auto colorimetry = settings.primariesNameSet || settings.primaries == SPCPRimaries{} ? getPrimaries(settings.primariesNamed) : settings.primaries;
|
||||
auto luminances = settings.masteringLuminances.max > 0 ?
|
||||
|
|
@ -1622,11 +1622,11 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
|
|||
|
||||
void CHyprRenderer::renderWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace, const Time::steady_tp& now, const CBox& geometry) {
|
||||
Vector2D translate = {geometry.x, geometry.y};
|
||||
float scale = (float)geometry.width / pMonitor->m_pixelSize.x;
|
||||
float scale = sc<float>(geometry.width) / pMonitor->m_pixelSize.x;
|
||||
|
||||
TRACY_GPU_ZONE("RenderWorkspace");
|
||||
|
||||
if (!DELTALESSTHAN((double)geometry.width / (double)geometry.height, pMonitor->m_pixelSize.x / pMonitor->m_pixelSize.y, 0.01)) {
|
||||
if (!DELTALESSTHAN(sc<double>(geometry.width) / sc<double>(geometry.height), pMonitor->m_pixelSize.x / pMonitor->m_pixelSize.y, 0.01)) {
|
||||
Debug::log(ERR, "Ignoring geometry in renderWorkspace: aspect ratio mismatch");
|
||||
scale = 1.f;
|
||||
translate = Vector2D{};
|
||||
|
|
@ -1792,7 +1792,7 @@ void CHyprRenderer::arrangeLayerArray(PHLMONITOR pMonitor, const std::vector<PHL
|
|||
box.y -= PSTATE->margin.bottom;
|
||||
|
||||
if (box.width <= 0 || box.height <= 0) {
|
||||
Debug::log(ERR, "LayerSurface {:x} has a negative/zero w/h???", (uintptr_t)ls.get());
|
||||
Debug::log(ERR, "LayerSurface {:x} has a negative/zero w/h???", rc<uintptr_t>(ls.get()));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2126,7 +2126,7 @@ std::tuple<float, float, float> CHyprRenderer::getRenderTimes(PHLMONITOR pMonito
|
|||
|
||||
static int handleCrashLoop(void* data) {
|
||||
|
||||
g_pHyprNotificationOverlay->addNotification("Hyprland will crash in " + std::to_string(10 - (int)(g_pHyprRenderer->m_crashingDistort * 2.f)) + "s.", CHyprColor(0), 5000,
|
||||
g_pHyprNotificationOverlay->addNotification("Hyprland will crash in " + std::to_string(10 - sc<int>(g_pHyprRenderer->m_crashingDistort * 2.f)) + "s.", CHyprColor(0), 5000,
|
||||
ICON_INFO);
|
||||
|
||||
g_pHyprRenderer->m_crashingDistort += 0.5f;
|
||||
|
|
@ -2150,7 +2150,7 @@ void CHyprRenderer::initiateManualCrash() {
|
|||
|
||||
g_pHyprOpenGL->m_globalTimer.reset();
|
||||
|
||||
static auto PDT = (Hyprlang::INT* const*)(g_pConfigManager->getConfigValuePtr("debug:damage_tracking"));
|
||||
static auto PDT = rc<Hyprlang::INT* const*>(g_pConfigManager->getConfigValuePtr("debug:damage_tracking"));
|
||||
|
||||
**PDT = 0;
|
||||
}
|
||||
|
|
@ -2419,12 +2419,12 @@ void CHyprRenderer::makeSnapshot(PHLWINDOW pWindow) {
|
|||
if (!shouldRenderWindow(pWindow))
|
||||
return; // ignore, window is not being rendered
|
||||
|
||||
Debug::log(LOG, "renderer: making a snapshot of {:x}", (uintptr_t)pWindow.get());
|
||||
Debug::log(LOG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(pWindow.get()));
|
||||
|
||||
// we need to "damage" the entire monitor
|
||||
// so that we render the entire window
|
||||
// this is temporary, doesn't mess with the actual damage
|
||||
CRegion fakeDamage{0, 0, (int)PMONITOR->m_transformedSize.x, (int)PMONITOR->m_transformedSize.y};
|
||||
CRegion fakeDamage{0, 0, sc<int>(PMONITOR->m_transformedSize.x), sc<int>(PMONITOR->m_transformedSize.y)};
|
||||
|
||||
PHLWINDOWREF ref{pWindow};
|
||||
|
||||
|
|
@ -2454,12 +2454,12 @@ void CHyprRenderer::makeSnapshot(PHLLS pLayer) {
|
|||
if (!PMONITOR || !PMONITOR->m_output || PMONITOR->m_pixelSize.x <= 0 || PMONITOR->m_pixelSize.y <= 0)
|
||||
return;
|
||||
|
||||
Debug::log(LOG, "renderer: making a snapshot of {:x}", (uintptr_t)pLayer.get());
|
||||
Debug::log(LOG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(pLayer.get()));
|
||||
|
||||
// we need to "damage" the entire monitor
|
||||
// so that we render the entire window
|
||||
// this is temporary, doesn't mess with the actual damage
|
||||
CRegion fakeDamage{0, 0, (int)PMONITOR->m_transformedSize.x, (int)PMONITOR->m_transformedSize.y};
|
||||
CRegion fakeDamage{0, 0, sc<int>(PMONITOR->m_transformedSize.x), sc<int>(PMONITOR->m_transformedSize.y)};
|
||||
|
||||
makeEGLCurrent();
|
||||
|
||||
|
|
@ -2491,7 +2491,7 @@ void CHyprRenderer::makeSnapshot(WP<CPopup> popup) {
|
|||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
||||
return;
|
||||
|
||||
Debug::log(LOG, "renderer: making a snapshot of {:x}", (uintptr_t)popup.get());
|
||||
Debug::log(LOG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(popup.get()));
|
||||
|
||||
CRegion fakeDamage{0, 0, PMONITOR->m_transformedSize.x, PMONITOR->m_transformedSize.y};
|
||||
|
||||
|
|
|
|||
|
|
@ -124,10 +124,10 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
|||
static auto PINNERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:gaps_in");
|
||||
static auto PKEEPUPPERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:keep_upper_gap");
|
||||
static auto PTEXTOFFSET = CConfigValue<Hyprlang::INT>("group:groupbar:text_offset");
|
||||
auto* const GROUPCOLACTIVE = (CGradientValueData*)(PGROUPCOLACTIVE.ptr())->getData();
|
||||
auto* const GROUPCOLINACTIVE = (CGradientValueData*)(PGROUPCOLINACTIVE.ptr())->getData();
|
||||
auto* const GROUPCOLACTIVELOCKED = (CGradientValueData*)(PGROUPCOLACTIVELOCKED.ptr())->getData();
|
||||
auto* const GROUPCOLINACTIVELOCKED = (CGradientValueData*)(PGROUPCOLINACTIVELOCKED.ptr())->getData();
|
||||
auto* const GROUPCOLACTIVE = sc<CGradientValueData*>((PGROUPCOLACTIVE.ptr())->getData());
|
||||
auto* const GROUPCOLINACTIVE = sc<CGradientValueData*>((PGROUPCOLINACTIVE.ptr())->getData());
|
||||
auto* const GROUPCOLACTIVELOCKED = sc<CGradientValueData*>((PGROUPCOLACTIVELOCKED.ptr())->getData());
|
||||
auto* const GROUPCOLINACTIVELOCKED = sc<CGradientValueData*>((PGROUPCOLINACTIVELOCKED.ptr())->getData());
|
||||
|
||||
const auto ASSIGNEDBOX = assignedBoxGlobal();
|
||||
|
||||
|
|
@ -295,8 +295,8 @@ CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float
|
|||
static auto PTITLEFONTWEIGHTACTIVE = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:font_weight_active");
|
||||
static auto PTITLEFONTWEIGHTINACTIVE = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:font_weight_inactive");
|
||||
|
||||
const auto FONTWEIGHTACTIVE = (CFontWeightConfigValueData*)(PTITLEFONTWEIGHTACTIVE.ptr())->getData();
|
||||
const auto FONTWEIGHTINACTIVE = (CFontWeightConfigValueData*)(PTITLEFONTWEIGHTINACTIVE.ptr())->getData();
|
||||
const auto FONTWEIGHTACTIVE = sc<CFontWeightConfigValueData*>((PTITLEFONTWEIGHTACTIVE.ptr())->getData());
|
||||
const auto FONTWEIGHTINACTIVE = sc<CFontWeightConfigValueData*>((PTITLEFONTWEIGHTINACTIVE.ptr())->getData());
|
||||
|
||||
const CHyprColor COLORACTIVE = CHyprColor(*PTEXTCOLORACTIVE);
|
||||
const CHyprColor COLORINACTIVE = *PTEXTCOLORINACTIVE == -1 ? COLORACTIVE : CHyprColor(*PTEXTCOLORINACTIVE);
|
||||
|
|
@ -333,7 +333,7 @@ static void renderGradientTo(SP<CTexture> tex, CGradientValueData* grad) {
|
|||
pattern = cairo_pattern_create_linear(0, 0, 0, bufferSize.y);
|
||||
|
||||
for (unsigned long i = 0; i < grad->m_colors.size(); i++) {
|
||||
cairo_pattern_add_color_stop_rgba(pattern, 1 - (double)(i + 1) / (grad->m_colors.size() + 1), grad->m_colors[i].r, grad->m_colors[i].g, grad->m_colors[i].b,
|
||||
cairo_pattern_add_color_stop_rgba(pattern, 1 - sc<double>(i + 1) / (grad->m_colors.size() + 1), grad->m_colors[i].r, grad->m_colors[i].g, grad->m_colors[i].b,
|
||||
grad->m_colors[i].a);
|
||||
}
|
||||
|
||||
|
|
@ -368,10 +368,10 @@ void refreshGroupBarGradients() {
|
|||
static auto PGROUPCOLINACTIVE = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.inactive");
|
||||
static auto PGROUPCOLACTIVELOCKED = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.locked_active");
|
||||
static auto PGROUPCOLINACTIVELOCKED = CConfigValue<Hyprlang::CUSTOMTYPE>("group:groupbar:col.locked_inactive");
|
||||
auto* const GROUPCOLACTIVE = (CGradientValueData*)(PGROUPCOLACTIVE.ptr())->getData();
|
||||
auto* const GROUPCOLINACTIVE = (CGradientValueData*)(PGROUPCOLINACTIVE.ptr())->getData();
|
||||
auto* const GROUPCOLACTIVELOCKED = (CGradientValueData*)(PGROUPCOLACTIVELOCKED.ptr())->getData();
|
||||
auto* const GROUPCOLINACTIVELOCKED = (CGradientValueData*)(PGROUPCOLINACTIVELOCKED.ptr())->getData();
|
||||
auto* const GROUPCOLACTIVE = sc<CGradientValueData*>((PGROUPCOLACTIVE.ptr())->getData());
|
||||
auto* const GROUPCOLINACTIVE = sc<CGradientValueData*>((PGROUPCOLINACTIVE.ptr())->getData());
|
||||
auto* const GROUPCOLACTIVELOCKED = sc<CGradientValueData*>((PGROUPCOLACTIVELOCKED.ptr())->getData());
|
||||
auto* const GROUPCOLINACTIVELOCKED = sc<CGradientValueData*>((PGROUPCOLINACTIVELOCKED.ptr())->getData());
|
||||
|
||||
g_pHyprRenderer->makeEGLCurrent();
|
||||
|
||||
|
|
|
|||
|
|
@ -234,26 +234,26 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
|
|||
} else if (LEFT) {
|
||||
pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, -stickyOffsetYT};
|
||||
pos.x -= desiredSize;
|
||||
size = {(double)desiredSize, wb.size().y + stickyOffsetYB + stickyOffsetYT};
|
||||
size = {sc<double>(desiredSize), wb.size().y + stickyOffsetYB + stickyOffsetYT};
|
||||
|
||||
if (SOLID)
|
||||
stickyOffsetXL += desiredSize;
|
||||
} else if (RIGHT) {
|
||||
pos = wb.pos() + Vector2D{wb.size().x, 0.0} - EDGEPOINT + Vector2D{stickyOffsetXR, -stickyOffsetYT};
|
||||
size = {(double)desiredSize, wb.size().y + stickyOffsetYB + stickyOffsetYT};
|
||||
size = {sc<double>(desiredSize), wb.size().y + stickyOffsetYB + stickyOffsetYT};
|
||||
|
||||
if (SOLID)
|
||||
stickyOffsetXR += desiredSize;
|
||||
} else if (TOP) {
|
||||
pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYT};
|
||||
pos.y -= desiredSize;
|
||||
size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, (double)desiredSize};
|
||||
size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, sc<double>(desiredSize)};
|
||||
|
||||
if (SOLID)
|
||||
stickyOffsetYT += desiredSize;
|
||||
} else {
|
||||
pos = wb.pos() + Vector2D{0.0, wb.size().y} - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYB};
|
||||
size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, (double)desiredSize};
|
||||
size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, sc<double>(desiredSize)};
|
||||
|
||||
if (SOLID)
|
||||
stickyOffsetYB += desiredSize;
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ float CRenderPass::oneBlurRadius() {
|
|||
// TODO: is this exact range correct?
|
||||
static auto PBLURSIZE = CConfigValue<Hyprlang::INT>("decoration:blur:size");
|
||||
static auto PBLURPASSES = CConfigValue<Hyprlang::INT>("decoration:blur:passes");
|
||||
return *PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
|
||||
return *PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, sc<int64_t>(1), sc<int64_t>(40)) * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
|
||||
}
|
||||
|
||||
void CRenderPass::removeAllOfType(const std::string& type) {
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ CBox CSurfacePassElement::getTexBox() {
|
|||
|
||||
CBox windowBox;
|
||||
if (m_data.surface && m_data.mainSurface) {
|
||||
windowBox = {(int)outputX + m_data.pos.x + m_data.localPos.x, (int)outputY + m_data.pos.y + m_data.localPos.y, m_data.w, m_data.h};
|
||||
windowBox = {sc<int>(outputX) + m_data.pos.x + m_data.localPos.x, sc<int>(outputY) + m_data.pos.y + m_data.localPos.y, m_data.w, m_data.h};
|
||||
|
||||
// however, if surface buffer w / h < box, we need to adjust them
|
||||
const auto PWINDOW = PSURFACE ? PSURFACE->getWindow() : nullptr;
|
||||
|
|
@ -191,8 +191,8 @@ CBox CSurfacePassElement::getTexBox() {
|
|||
}
|
||||
|
||||
} else { // here we clamp to 2, these might be some tiny specks
|
||||
windowBox = {(int)outputX + m_data.pos.x + m_data.localPos.x, (int)outputY + m_data.pos.y + m_data.localPos.y, std::max((float)m_data.surface->m_current.size.x, 2.F),
|
||||
std::max((float)m_data.surface->m_current.size.y, 2.F)};
|
||||
windowBox = {sc<int>(outputX) + m_data.pos.x + m_data.localPos.x, sc<int>(outputY) + m_data.pos.y + m_data.localPos.y,
|
||||
std::max(sc<float>(m_data.surface->m_current.size.x), 2.F), std::max(sc<float>(m_data.surface->m_current.size.y), 2.F)};
|
||||
if (m_data.pWindow && m_data.pWindow->m_realSize->isBeingAnimated() && m_data.surface && !m_data.mainSurface && m_data.squishOversized /* subsurface */) {
|
||||
// adjust subsurfaces to the window
|
||||
windowBox.width = (windowBox.width / m_data.pWindow->m_reportedSize.x) * m_data.pWindow->m_realSize->value().x;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue