Class CurvedSpacetimeVulkanModuleConfig
- All Implemented Interfaces:
ModuleConfig
config/curved-spacetime-vulkan-module.config.
Two keys: validation turns the Vulkan validation layers on, which is expensive but reports API misuse the
driver would otherwise ignore; preferredDeviceName names a GPU to use in preference to the automatic choice,
which matters on machines with more than one. preferredDeviceName is genuinely optional and absent by
default, so unlike other keys its absence does not mark the configuration dirty. In a future version
preferredDeviceName will be added as a comment if no such comment is there and the option is absent.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a configuration that reports load problems to the given logger. -
Method Summary
Modifier and TypeMethodDescriptionReturns the GPU to prefer over the automatic choice.booleanisDirty()Returns whether this configuration differs from what is on disk.load()Reads the configuration from disk, substituting defaults for anything missing.voidsave()Writes the configuration to disk and clears the dirty flag.booleanReturns whether the Vulkan validation layers should be enabled.
-
Constructor Details
-
CurvedSpacetimeVulkanModuleConfig
Creates a configuration that reports load problems to the given logger.- Parameters:
logger- the logger to warn through when a key is missing or invalid
-
-
Method Details
-
load
Reads the configuration from disk, substituting defaults for anything missing.- Specified by:
loadin interfaceModuleConfig- Returns:
- this configuration, so that construction and loading compose
- Throws:
IOException- if the file exists but cannot be read
-
save
Writes the configuration to disk and clears the dirty flag.preferredDeviceNameis omitted when unset, rather than written empty.- Specified by:
savein interfaceModuleConfig- Throws:
IOException- if the file cannot be written
-
isDirty
public boolean isDirty()Returns whether this configuration differs from what is on disk.Loading having substituted a default for
validationis the usual cause;save()clears it. Note that an absentpreferredDeviceNamedoes not count, since that key is genuinely optional.- Specified by:
isDirtyin interfaceModuleConfig- Returns:
trueif the file does not match this configuration and should be rewritten
-
validation
public boolean validation()Returns whether the Vulkan validation layers should be enabled.- Returns:
trueif validation was requested
-
getPreferredDeviceName
Returns the GPU to prefer over the automatic choice.- Returns:
- the preferred device name, or
nullto select automatically
-