mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-02-12 18:20:24 +00:00
Add XNN Pack toggle switch for ONNX inference acceleration (#155)
* Initial plan * Add XNN Pack switch for ONNX inference acceleration Co-authored-by: xkeyC <39891083+xkeyC@users.noreply.github.com> * Refactor Rust ONNX session creation to reduce code duplication Co-authored-by: xkeyC <39891083+xkeyC@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: xkeyC <39891083+xkeyC@users.noreply.github.com>
This commit is contained in:
@@ -26,6 +26,7 @@ abstract class SettingsUIState with _$SettingsUIState {
|
||||
String? customGamePath,
|
||||
@Default(0) int locationCacheSize,
|
||||
@Default(false) bool isUseInternalDNS,
|
||||
@Default(true) bool isEnableOnnxXnnPack,
|
||||
}) = _SettingsUIState;
|
||||
}
|
||||
|
||||
@@ -44,6 +45,7 @@ class SettingsUIModel extends _$SettingsUIModel {
|
||||
await _loadLocationCacheSize();
|
||||
await _loadToolSiteMirrorState();
|
||||
await _loadUseInternalDNS();
|
||||
await _loadOnnxXnnPackState();
|
||||
}
|
||||
|
||||
Future<void> setGameLaunchECore(BuildContext context) async {
|
||||
@@ -227,4 +229,17 @@ class SettingsUIModel extends _$SettingsUIModel {
|
||||
userBox.get("isUseInternalDNS", defaultValue: false);
|
||||
state = state.copyWith(isUseInternalDNS: isUseInternalDNS);
|
||||
}
|
||||
|
||||
void onChangeOnnxXnnPack(bool? b) {
|
||||
final userBox = Hive.box("app_conf");
|
||||
userBox.put("isEnableOnnxXnnPack", b ?? true);
|
||||
_initState();
|
||||
}
|
||||
|
||||
Future _loadOnnxXnnPackState() async {
|
||||
final userBox = await Hive.openBox("app_conf");
|
||||
final isEnableOnnxXnnPack =
|
||||
userBox.get("isEnableOnnxXnnPack", defaultValue: true);
|
||||
state = state.copyWith(isEnableOnnxXnnPack: isEnableOnnxXnnPack);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user