Developing disable gpu on adreno

This commit is contained in:
Oleg Korshul
2025-08-21 21:52:07 +03:00
parent c79988faf6
commit fcd2ec3283
4 changed files with 40 additions and 7 deletions

View File

@ -65,7 +65,8 @@ var AscBrowser = {
isAndroidNativeApp : false,
safariVersion : 17004001,
isTelegramWebView : false,
maxTouchPoints : 0
maxTouchPoints : 0,
willReadFrequently : false
};
// user agent lower case
@ -270,6 +271,40 @@ var UI = {
}
};
if (AscBrowser.isChrome)
{
try
{
let canvas = document.createElement("canvas");
let ctxGL = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
if (ctxGL)
{
let debugInfo = ctxGL.getExtension('WEBGL_debug_renderer_info');
if (debugInfo)
{
let renderer = ctxGL.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
if (renderer)
{
renderer = renderer.toLowerCase();
if (-1 !== renderer.indexOf("qualcomm") && -1 !== renderer.indexOf("adreno"))
AscBrowser.willReadFrequently = true;
}
}
}
}
catch (e)
{
}
}
AscBrowser.getContext2D = function(canvas)
{
if (AscBrowser.willReadFrequently)
return canvas.getContext('2d', { willReadFrequently: true });
return canvas.getContext('2d');
};
//--------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].AscBrowser = AscBrowser;

View File

@ -274,7 +274,7 @@
this.TempImage = document.createElement("canvas");
this.TempImage.width = w;
this.TempImage.height = h;
var ctxD = this.TempImage.getContext("2d");
var ctxD = AscCommon.AscBrowser.getContext2D(this.TempImage);
var pixDst = null;
if (this.m_oCanvas != null)
@ -375,7 +375,7 @@
this.m_oCanvas.width = (width == 0) ? 1 : width;
this.m_oCanvas.height = (height == 0) ? 1 : height;
this.m_oContext = this.m_oCanvas.getContext('2d');
this.m_oContext = AscCommon.AscBrowser.getContext2D(this.m_oCanvas);
this.m_oContext.globalCompositeOperation = "source-in";
}
};

View File

@ -6679,7 +6679,7 @@ function CSlideDrawer()
this.CachedCanvas.width = _need_pix_width + 100;
this.CachedCanvas.height = _need_pix_height + 100;
this.CachedCanvasCtx = this.CachedCanvas.getContext('2d');
this.CachedCanvasCtx = AscCommon.AscBrowser.getContext2D(this.CachedCanvas);
}
else
{

View File

@ -2497,9 +2497,7 @@
if (null == canvas)
return;
var context = canvas.getContext("2d");
var context = AscCommon.AscBrowser.getContext2D(canvas);
var _width = canvas.width;
var _height = canvas.height;