diff options
| author | Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> | 2025-08-07 14:32:43 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-07 14:32:43 -0400 |
| commit | 6489f2273fc246fcca25e95d913e60ea214e0d31 (patch) | |
| tree | 86f4e4f3f032ea8516a1e1965ab3ef376f83f87d /py_modules | |
| parent | dd8a192075fa89606e2d4fcb96094939735da502 (diff) | |
| parent | bb0382dd2be4a548f79d6cd48b0e87fbee3cd1a2 (diff) | |
| download | decky-lsfg-vk-6489f2273fc246fcca25e95d913e60ea214e0d31.tar.gz decky-lsfg-vk-6489f2273fc246fcca25e95d913e60ea214e0d31.zip | |
Merge pull request #127 from xXJSONDeruloXx/fp16v0.10.1
feat: groundwork for fp16 feature in lsfg-vk
Diffstat (limited to 'py_modules')
| -rw-r--r-- | py_modules/lsfg_vk/config_schema.py | 30 | ||||
| -rw-r--r-- | py_modules/lsfg_vk/config_schema_generated.py | 10 | ||||
| -rw-r--r-- | py_modules/lsfg_vk/configuration_helpers_generated.py | 2 |
3 files changed, 28 insertions, 14 deletions
diff --git a/py_modules/lsfg_vk/config_schema.py b/py_modules/lsfg_vk/config_schema.py index bbace42..33f7b3e 100644 --- a/py_modules/lsfg_vk/config_schema.py +++ b/py_modules/lsfg_vk/config_schema.py @@ -167,14 +167,20 @@ class ConfigurationManager: lines = ["version = 1"] lines.append("") - # Add global section with DLL path only (if specified) + # Add global section with global fields + lines.append("[global]") + + # Add dll field if specified if config.get("dll"): - lines.append("[global]") lines.append(f"# specify where Lossless.dll is stored") - # Generate TOML lines for TOML fields only - USE GENERATED CONSTANTS from .config_schema_generated import DLL lines.append(f'dll = "{config[DLL]}"') - lines.append("") + + # Add no_fp16 field + from .config_schema_generated import NO_FP16 + lines.append(f"# force-disable fp16 (use on older nvidia cards)") + lines.append(f"no_fp16 = {str(config[NO_FP16]).lower()}") + lines.append("") # Add game section with process name for LSFG_PROCESS approach lines.append("[[game]]") @@ -184,8 +190,8 @@ class ConfigurationManager: # Add all configuration fields to the game section for field_name, field_def in CONFIG_SCHEMA.items(): - # Skip dll field - dll goes in global section - if field_name == "dll": + # Skip global fields - they go in global section + if field_name in ("dll", "no_fp16"): continue value = config[field_name] @@ -250,10 +256,14 @@ class ConfigurationManager: elif value.startswith("'") and value.endswith("'"): value = value[1:-1] - # Handle global section (dll only) - USE GENERATED CONSTANTS - if in_global_section and key == "dll": - from .config_schema_generated import DLL - config[DLL] = value + # Handle global section (dll and no_fp16) - USE GENERATED CONSTANTS + if in_global_section: + if key == "dll": + from .config_schema_generated import DLL + config[DLL] = value + elif key == "no_fp16": + from .config_schema_generated import NO_FP16 + config[NO_FP16] = value.lower() in ('true', '1', 'yes', 'on') # Handle game section elif in_game_section: diff --git a/py_modules/lsfg_vk/config_schema_generated.py b/py_modules/lsfg_vk/config_schema_generated.py index 50d2a4f..4e701ac 100644 --- a/py_modules/lsfg_vk/config_schema_generated.py +++ b/py_modules/lsfg_vk/config_schema_generated.py @@ -14,6 +14,7 @@ from shared_config import CONFIG_SCHEMA_DEF, ConfigFieldType # Field name constants for type-safe access DLL = "dll" +NO_FP16 = "no_fp16" MULTIPLIER = "multiplier" FLOW_SCALE = "flow_scale" PERFORMANCE_MODE = "performance_mode" @@ -31,6 +32,7 @@ ENABLE_WSI = "enable_wsi" class ConfigurationData(TypedDict): """Type-safe configuration data structure - AUTO-GENERATED""" dll: str + no_fp16: bool multiplier: int flow_scale: float performance_mode: bool @@ -108,9 +110,10 @@ def get_script_generation_logic(): def get_function_parameters() -> str: """Return function signature parameters""" return """dll: str = "/games/Lossless Scaling/Lossless.dll", + no_fp16: bool = False, multiplier: int = 1, flow_scale: float = 0.8, - performance_mode: bool = True, + performance_mode: bool = False, hdr_mode: bool = False, experimental_present_mode: str = "fifo", dxvk_frame_rate: int = 0, @@ -126,6 +129,7 @@ def create_config_dict(**kwargs) -> ConfigurationData: """Create configuration dictionary from keyword arguments""" return cast(ConfigurationData, { "dll": kwargs.get("dll"), + "no_fp16": kwargs.get("no_fp16"), "multiplier": kwargs.get("multiplier"), "flow_scale": kwargs.get("flow_scale"), "performance_mode": kwargs.get("performance_mode"), @@ -142,6 +146,6 @@ def create_config_dict(**kwargs) -> ConfigurationData: # Field lists for dynamic operations -TOML_FIELDS = ['dll', 'multiplier', 'flow_scale', 'performance_mode', 'hdr_mode', 'experimental_present_mode'] +TOML_FIELDS = ['dll', 'no_fp16', 'multiplier', 'flow_scale', 'performance_mode', 'hdr_mode', 'experimental_present_mode'] SCRIPT_FIELDS = ['dxvk_frame_rate', 'enable_wow64', 'disable_steamdeck_mode', 'mangohud_workaround', 'disable_vkbasalt', 'force_enable_vkbasalt', 'enable_wsi'] -ALL_FIELDS = ['dll', 'multiplier', 'flow_scale', 'performance_mode', 'hdr_mode', 'experimental_present_mode', 'dxvk_frame_rate', 'enable_wow64', 'disable_steamdeck_mode', 'mangohud_workaround', 'disable_vkbasalt', 'force_enable_vkbasalt', 'enable_wsi'] +ALL_FIELDS = ['dll', 'no_fp16', 'multiplier', 'flow_scale', 'performance_mode', 'hdr_mode', 'experimental_present_mode', 'dxvk_frame_rate', 'enable_wow64', 'disable_steamdeck_mode', 'mangohud_workaround', 'disable_vkbasalt', 'force_enable_vkbasalt', 'enable_wsi'] diff --git a/py_modules/lsfg_vk/configuration_helpers_generated.py b/py_modules/lsfg_vk/configuration_helpers_generated.py index b34865a..f8edd97 100644 --- a/py_modules/lsfg_vk/configuration_helpers_generated.py +++ b/py_modules/lsfg_vk/configuration_helpers_generated.py @@ -9,7 +9,7 @@ from .config_schema_generated import ConfigurationData, ALL_FIELDS def log_configuration_update(logger, config: ConfigurationData) -> None: """Log configuration update with all field values""" - logger.info(f"Updated lsfg TOML configuration: dll={config['dll']}, multiplier={config['multiplier']}, flow_scale={config['flow_scale']}, performance_mode={config['performance_mode']}, hdr_mode={config['hdr_mode']}, experimental_present_mode={config['experimental_present_mode']}, dxvk_frame_rate={config['dxvk_frame_rate']}, enable_wow64={config['enable_wow64']}, disable_steamdeck_mode={config['disable_steamdeck_mode']}, mangohud_workaround={config['mangohud_workaround']}, disable_vkbasalt={config['disable_vkbasalt']}, force_enable_vkbasalt={config['force_enable_vkbasalt']}, enable_wsi={config['enable_wsi']}") + logger.info(f"Updated lsfg TOML configuration: dll={config['dll']}, no_fp16={config['no_fp16']}, multiplier={config['multiplier']}, flow_scale={config['flow_scale']}, performance_mode={config['performance_mode']}, hdr_mode={config['hdr_mode']}, experimental_present_mode={config['experimental_present_mode']}, dxvk_frame_rate={config['dxvk_frame_rate']}, enable_wow64={config['enable_wow64']}, disable_steamdeck_mode={config['disable_steamdeck_mode']}, mangohud_workaround={config['mangohud_workaround']}, disable_vkbasalt={config['disable_vkbasalt']}, force_enable_vkbasalt={config['force_enable_vkbasalt']}, enable_wsi={config['enable_wsi']}") def get_config_field_names() -> list[str]: |
