Fix GPU Memory Locks

This commit is contained in:
2025-06-11 22:57:57 +10:00
parent 8ae144bc65
commit 95e13ada7b
2 changed files with 24 additions and 14 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ export const settings = await ReactiveStore.getPluginStorage("RadiantLyrics", {
lyricsGlowEnabled: true, lyricsGlowEnabled: true,
spinningCoverEverywhere: false, spinningCoverEverywhere: false,
performanceMode: false, performanceMode: false,
spinningArtEnabled: true, spinningArtEnabled: false,
backgroundContrast: 120, backgroundContrast: 120,
backgroundBlur: 80, backgroundBlur: 80,
backgroundBrightness: 40, backgroundBrightness: 40,
@@ -98,7 +98,7 @@ export const Settings = () => {
desc="Disable the spinning cover art background animation" desc="Disable the spinning cover art background animation"
checked={!spinningArtEnabled} checked={!spinningArtEnabled}
onChange={(_, checked: boolean) => { onChange={(_, checked: boolean) => {
console.log("Disable Cover Spin:", checked ? "enabled" : "disabled"); console.log("Disable Cover Spin:", checked ? "disabled" : "enabled");
setSpinningArtEnabled((settings.spinningArtEnabled = !checked)); setSpinningArtEnabled((settings.spinningArtEnabled = !checked));
if ((window as any).updateRadiantLyricsGlobalBackground) { if ((window as any).updateRadiantLyricsGlobalBackground) {
(window as any).updateRadiantLyricsGlobalBackground(); (window as any).updateRadiantLyricsGlobalBackground();
+22 -12
View File
@@ -204,12 +204,13 @@ const applyGlobalSpinningBackground = (coverArtImageSrc: string): void => {
globalBackgroundImage.style.filter = `blur(${Math.min(settings.backgroundBlur, 20)}px) brightness(${settings.backgroundBrightness / 100}) contrast(${Math.min(settings.backgroundContrast, 150)}%)`; globalBackgroundImage.style.filter = `blur(${Math.min(settings.backgroundBlur, 20)}px) brightness(${settings.backgroundBrightness / 100}) contrast(${Math.min(settings.backgroundContrast, 150)}%)`;
if (settings.spinningArtEnabled) { if (settings.spinningArtEnabled) {
globalBackgroundImage.style.animation = `spinGlobal ${settings.spinSpeed}s linear infinite`; globalBackgroundImage.style.animation = `spinGlobal ${settings.spinSpeed}s linear infinite`;
globalBackgroundImage.style.willChange = 'transform';
} }
else { else {
globalBackgroundImage.style.animation = 'none'; globalBackgroundImage.style.animation = 'none';
globalBackgroundImage.style.willChange = 'auto';
} }
globalBackgroundImage.classList.remove('performance-mode-static'); globalBackgroundImage.classList.remove('performance-mode-static');
globalBackgroundImage.style.willChange = 'transform';
} else { } else {
// Normal mode // Normal mode
globalBackgroundImage.style.width = '150vw'; globalBackgroundImage.style.width = '150vw';
@@ -217,12 +218,13 @@ const applyGlobalSpinningBackground = (coverArtImageSrc: string): void => {
globalBackgroundImage.style.filter = `blur(${settings.backgroundBlur}px) brightness(${settings.backgroundBrightness / 100}) contrast(${settings.backgroundContrast}%)`; globalBackgroundImage.style.filter = `blur(${settings.backgroundBlur}px) brightness(${settings.backgroundBrightness / 100}) contrast(${settings.backgroundContrast}%)`;
if (settings.spinningArtEnabled) { if (settings.spinningArtEnabled) {
globalBackgroundImage.style.animation = `spinGlobal ${settings.spinSpeed}s linear infinite`; globalBackgroundImage.style.animation = `spinGlobal ${settings.spinSpeed}s linear infinite`;
globalBackgroundImage.style.willChange = 'transform';
} }
else { else {
globalBackgroundImage.style.animation = 'none'; globalBackgroundImage.style.animation = 'none';
globalBackgroundImage.style.willChange = 'auto';
} }
globalBackgroundImage.classList.remove('performance-mode-static'); globalBackgroundImage.classList.remove('performance-mode-static');
globalBackgroundImage.style.willChange = 'transform';
} }
} }
}; };
@@ -293,21 +295,23 @@ const updateRadiantLyricsNowPlayingBackground = function(): void {
contrast = Math.min(contrast, 150); contrast = Math.min(contrast, 150);
if (settings.spinningArtEnabled) { if (settings.spinningArtEnabled) {
imgElement.style.animation = `spin ${spinSpeed}s linear infinite`; imgElement.style.animation = `spin ${spinSpeed}s linear infinite`;
imgElement.style.willChange = 'transform';
} }
else { else {
imgElement.style.animation = 'none'; imgElement.style.animation = 'none';
imgElement.style.willChange = 'auto';
} }
imgElement.classList.remove('performance-mode-static'); imgElement.classList.remove('performance-mode-static');
imgElement.style.willChange = 'transform';
} else { } else {
if (settings.spinningArtEnabled) { if (settings.spinningArtEnabled) {
imgElement.style.animation = `spin ${spinSpeed}s linear infinite`; imgElement.style.animation = `spin ${spinSpeed}s linear infinite`;
imgElement.style.willChange = 'transform';
} }
else { else {
imgElement.style.animation = 'none'; imgElement.style.animation = 'none';
imgElement.style.willChange = 'auto';
} }
imgElement.classList.remove('performance-mode-static'); imgElement.classList.remove('performance-mode-static');
imgElement.style.willChange = 'transform';
} }
imgElement.style.filter = `blur(${blur}px) brightness(${brightness / 100}) contrast(${contrast}%)`; imgElement.style.filter = `blur(${blur}px) brightness(${brightness / 100}) contrast(${contrast}%)`;
@@ -751,21 +755,27 @@ const updateCoverArtBackground = function (method: number = 0): void {
const blur = Math.min(settings.backgroundBlur, 20); const blur = Math.min(settings.backgroundBlur, 20);
const contrast = Math.min(settings.backgroundContrast, 150); const contrast = Math.min(settings.backgroundContrast, 150);
nowPlayingBackgroundImage.style.filter = `blur(${blur}px) brightness(${settings.backgroundBrightness / 100}) contrast(${contrast}%)`; nowPlayingBackgroundImage.style.filter = `blur(${blur}px) brightness(${settings.backgroundBrightness / 100}) contrast(${contrast}%)`;
nowPlayingBackgroundImage.style.animation = settings.spinningArtEnabled if (settings.spinningArtEnabled) {
? `spin ${settings.spinSpeed}s linear infinite` nowPlayingBackgroundImage.style.animation = `spin ${settings.spinSpeed}s linear infinite`;
: 'none'; nowPlayingBackgroundImage.style.willChange = 'transform';
} else {
nowPlayingBackgroundImage.style.animation = 'none';
nowPlayingBackgroundImage.style.willChange = 'auto';
}
nowPlayingBackgroundImage.classList.remove('performance-mode-static'); nowPlayingBackgroundImage.classList.remove('performance-mode-static');
nowPlayingBackgroundImage.style.willChange = 'transform';
} else { } else {
// Normal mode // Normal mode
nowPlayingBackgroundImage.style.width = '90vw'; nowPlayingBackgroundImage.style.width = '90vw';
nowPlayingBackgroundImage.style.height = '90vh'; nowPlayingBackgroundImage.style.height = '90vh';
nowPlayingBackgroundImage.style.filter = `blur(${settings.backgroundBlur}px) brightness(${settings.backgroundBrightness / 100}) contrast(${settings.backgroundContrast}%)`; nowPlayingBackgroundImage.style.filter = `blur(${settings.backgroundBlur}px) brightness(${settings.backgroundBrightness / 100}) contrast(${settings.backgroundContrast}%)`;
nowPlayingBackgroundImage.style.animation = settings.spinningArtEnabled if (settings.spinningArtEnabled) {
? `spin ${settings.spinSpeed}s linear infinite` nowPlayingBackgroundImage.style.animation = `spin ${settings.spinSpeed}s linear infinite`;
: 'none'; nowPlayingBackgroundImage.style.willChange = 'transform';
} else {
nowPlayingBackgroundImage.style.animation = 'none';
nowPlayingBackgroundImage.style.willChange = 'auto';
}
nowPlayingBackgroundImage.classList.remove('performance-mode-static'); nowPlayingBackgroundImage.classList.remove('performance-mode-static');
nowPlayingBackgroundImage.style.willChange = 'transform';
} }
} }