mobile support tweaks
This commit is contained in:
@@ -88,6 +88,32 @@ var _pinch_dist: float = 0.0
|
||||
var _dbg_events: int = 0
|
||||
var _dbg_last_pos: Vector2 = Vector2.ZERO
|
||||
|
||||
# Cached real GPU name. RenderingServer.get_video_adapter_name() returns the browser's
|
||||
# privacy-masked "WebKit WebGL" on the web; the true chip (Adreno/Mali/…) — which decides
|
||||
# whether an invisible skinned mesh is a known mobile-driver bug — is only reachable via
|
||||
# the WEBGL_debug_renderer_info extension on Godot's own canvas context. "" = not yet probed.
|
||||
var _gpu_unmasked: String = ""
|
||||
|
||||
|
||||
func _unmasked_gpu() -> String:
|
||||
if _gpu_unmasked != "":
|
||||
return _gpu_unmasked
|
||||
_gpu_unmasked = "n/a"
|
||||
if OS.has_feature("web"):
|
||||
var js := """(function(){try{
|
||||
var c=document.getElementById('canvas');
|
||||
var gl=c?c.getContext('webgl2'):null;
|
||||
if(!gl){var t=document.createElement('canvas');gl=t.getContext('webgl2')||t.getContext('webgl');}
|
||||
if(!gl)return 'no-gl';
|
||||
var e=gl.getExtension('WEBGL_debug_renderer_info');
|
||||
if(!e)return 'masked';
|
||||
return String(gl.getParameter(e.UNMASKED_RENDERER_WEBGL));
|
||||
}catch(err){return 'err';}})()"""
|
||||
var r: Variant = JavaScriptBridge.eval(js, true)
|
||||
if r is String and (r as String) != "":
|
||||
_gpu_unmasked = r
|
||||
return _gpu_unmasked
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
layer = 10 # below the HUD (11) so the game-over screen always draws on top
|
||||
@@ -406,6 +432,7 @@ func _draw_debug() -> void:
|
||||
var mats := get_tree().get_nodes_in_group(&"matador")
|
||||
var lines := [
|
||||
"GPU: %s" % RenderingServer.get_video_adapter_name(),
|
||||
"chip: %s" % _unmasked_gpu(),
|
||||
"API: %s" % RenderingServer.get_video_adapter_api_version(),
|
||||
"method=%s web=%s touch_ui=%s" % [
|
||||
ProjectSettings.get_setting("rendering/renderer/rendering_method", "?"),
|
||||
|
||||
Reference in New Issue
Block a user