mirror of
https://github.com/wagesj45/butterflow-ui.git
synced 2024-12-22 01:02:43 -06:00
Added Force CPU option
Added an option to force CPU usage in case no compatible OpenCL devices were found.
This commit is contained in:
parent
2d366141a9
commit
2c8f51a453
16 changed files with 56 additions and 20 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<Product Id="*" Name="butterflow-ui" Language="1033" Version="1.0.4" Manufacturer="butterflow-ui @ github" UpgradeCode="bba9d512-377a-467e-920a-cbcf36ffc072">
|
||||
<Product Id="*" Name="butterflow-ui" Language="1033" Version="1.0.5" Manufacturer="butterflow-ui @ github" UpgradeCode="bba9d512-377a-467e-920a-cbcf36ffc072">
|
||||
<Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
|
||||
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<value>en-US</value>
|
||||
</setting>
|
||||
<setting name="Device" serializeAs="String">
|
||||
<value>0</value>
|
||||
<value>-1</value>
|
||||
</setting>
|
||||
</butterflow_ui.Properties.Settings>
|
||||
</userSettings>
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace butterflow_ui
|
|||
|
||||
/// <summary> Gets or sets the list of devices available for butterflow processing. </summary>
|
||||
/// <value> The devices available for butterflow processing. </value>
|
||||
public Dictionary<int, string> Devices { get; private set; } = new Dictionary<int, string>();
|
||||
public Dictionary<int, string> Devices { get; private set; } = new Dictionary<int, string>() { { 0, Localization.Localization.ForceCPU } };
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -256,7 +256,8 @@ namespace butterflow_ui
|
|||
var deviceID = match.Groups["DeviceID"].Value;
|
||||
var deviceName = match.Groups["DeviceName"].Value.Trim();
|
||||
|
||||
this.interpreter.Interpret(deviceID);
|
||||
//Add 1 to the index count. This accounts for the 0 index of the "Force CPU" option in the options window.
|
||||
this.interpreter.Interpret(string.Concat(deviceID,"+1"));
|
||||
|
||||
if (!this.Devices.ContainsKey(this.interpreter.Int))
|
||||
{
|
||||
|
|
|
@ -402,6 +402,15 @@ namespace butterflow_ui.Localization {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Force CPU.
|
||||
/// </summary>
|
||||
public static string ForceCPU {
|
||||
get {
|
||||
return ResourceManager.GetString("ForceCPU", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Height.
|
||||
/// </summary>
|
||||
|
|
|
@ -393,4 +393,7 @@
|
|||
<data name="DeviceLabel" xml:space="preserve">
|
||||
<value>جهاز الحوسبة</value>
|
||||
</data>
|
||||
<data name="ForceCPU" xml:space="preserve">
|
||||
<value>قوة وحدة المعالجة المركزية</value>
|
||||
</data>
|
||||
</root>
|
|
@ -393,4 +393,7 @@
|
|||
<data name="DeviceLabel" xml:space="preserve">
|
||||
<value>Dispositivo de computación</value>
|
||||
</data>
|
||||
<data name="ForceCPU" xml:space="preserve">
|
||||
<value>Unidad de procesamiento central de fuerza</value>
|
||||
</data>
|
||||
</root>
|
|
@ -393,4 +393,7 @@
|
|||
<data name="DeviceLabel" xml:space="preserve">
|
||||
<value>コンピューティングデバイス</value>
|
||||
</data>
|
||||
<data name="ForceCPU" xml:space="preserve">
|
||||
<value>中央処理装置を強制する</value>
|
||||
</data>
|
||||
</root>
|
|
@ -393,4 +393,7 @@
|
|||
<data name="DeviceLabel" xml:space="preserve">
|
||||
<value>Computing Device</value>
|
||||
</data>
|
||||
<data name="ForceCPU" xml:space="preserve">
|
||||
<value>Force CPU</value>
|
||||
</data>
|
||||
</root>
|
|
@ -393,4 +393,7 @@
|
|||
<data name="DeviceLabel" xml:space="preserve">
|
||||
<value>Вычислительное устройство</value>
|
||||
</data>
|
||||
<data name="ForceCPU" xml:space="preserve">
|
||||
<value>Force CPU</value>
|
||||
</data>
|
||||
</root>
|
|
@ -393,4 +393,7 @@
|
|||
<data name="DeviceLabel" xml:space="preserve">
|
||||
<value>计算设备</value>
|
||||
</data>
|
||||
<data name="ForceCPU" xml:space="preserve">
|
||||
<value>部队中央处理股</value>
|
||||
</data>
|
||||
</root>
|
|
@ -312,7 +312,7 @@
|
|||
<Canvas x:Name="canvas" Grid.Row="1" Grid.RowSpan="3" Visibility="{Binding OptionsConfiguration.MultipleFiles, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<TextBlock TextAlignment="Center" VerticalAlignment="Center" Width="{Binding ActualWidth, ElementName=canvas}" Height="{Binding ActualHeight, ElementName=canvas}" TextWrapping="WrapWithOverflow" Text="{x:Static loc:Localization.MultipleFilesPreviewWarningLabel}" />
|
||||
</Canvas>
|
||||
<gu:MediaElementWrapper Grid.Row="1" Name="mediaPreview" Stretch="Uniform" ScrubbingEnabled="True" MediaOpened="mediaPreview_MediaOpened" MediaEnded="mediaPreview_MediaEnded" Visibility="{Binding OptionsConfiguration.MultipleFiles, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource InverseBoolVisibilityConverter}}" />
|
||||
<gu:MediaElementWrapper Grid.Row="1" Name="mediaPreview" Stretch="Uniform" ScrubbingEnabled="True" MediaEnded="mediaPreview_MediaEnded" Visibility="{Binding OptionsConfiguration.MultipleFiles, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource InverseBoolVisibilityConverter}}" />
|
||||
<Grid Grid.Row="2" Visibility="{Binding OptionsConfiguration.MultipleFiles, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource InverseBoolVisibilityConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
|
|
@ -258,15 +258,6 @@ namespace butterflow_ui
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by mediaPreview for media opened events. </summary>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Routed event information. </param>
|
||||
private void mediaPreview_MediaOpened(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//this.OptionsConfiguration.Width = this.mediaPreview.NaturalVideoWidth.ToString();
|
||||
//this.OptionsConfiguration.Height = this.mediaPreview.NaturalVideoHeight.ToString();
|
||||
}
|
||||
|
||||
/// <summary> Event handler. Called by mediaPreview for media ended events. </summary>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Routed event information. </param>
|
||||
|
@ -442,7 +433,11 @@ namespace butterflow_ui
|
|||
{
|
||||
var optionsWindow = new OptionsWindow();
|
||||
|
||||
optionsWindow.Show();
|
||||
optionsWindow.ShowDialog();
|
||||
|
||||
//Force an update on the command line arguments in case the user changed something in the
|
||||
//Options window that necessitates it, such as the compute device.
|
||||
this.OptionsConfiguration.ForceUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -467,11 +467,20 @@ namespace butterflow_ui
|
|||
|
||||
#region Methods
|
||||
|
||||
/// <summary> Subregion property changed. </summary>
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Property changed event information. </param>
|
||||
private void SubregionPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged("CommandLineOutput");
|
||||
}
|
||||
|
||||
/// <summary> Force the object's properties to report as updated. </summary>
|
||||
public void ForceUpdate()
|
||||
{
|
||||
OnPropertyChanged();
|
||||
}
|
||||
|
||||
/// <summary> Converts this object to a <seealso cref="OptionsConfigurationFile"/>. </summary>
|
||||
/// <returns> This object as an OptionsConfigurationFile. </returns>
|
||||
public OptionsConfigurationFile ToFile()
|
||||
|
@ -532,7 +541,11 @@ namespace butterflow_ui
|
|||
stringBuilder.AppendFormat("-vs {0}:{1} ", this.Width, this.Height);
|
||||
}
|
||||
|
||||
if(Settings.Default.Device != 0)
|
||||
if(Settings.Default.Device == 0)
|
||||
{
|
||||
stringBuilder.Append("-sw ");
|
||||
}
|
||||
if(Settings.Default.Device > 0)
|
||||
{
|
||||
stringBuilder.AppendFormat("-device {0} ", Settings.Default.Device);
|
||||
}
|
||||
|
|
|
@ -51,5 +51,5 @@ using System.Windows;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.4.*")]
|
||||
[assembly: AssemblyVersion("1.0.5.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
4
butterflow-ui/Properties/Settings.Designer.cs
generated
4
butterflow-ui/Properties/Settings.Designer.cs
generated
|
@ -12,7 +12,7 @@ namespace butterflow_ui.Properties {
|
|||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
||||
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
@ -37,7 +37,7 @@ namespace butterflow_ui.Properties {
|
|||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("-1")]
|
||||
public int Device {
|
||||
get {
|
||||
return ((int)(this["Device"]));
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<Value Profile="(Default)">en-US</Value>
|
||||
</Setting>
|
||||
<Setting Name="Device" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
<Value Profile="(Default)">-1</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
Loading…
Reference in a new issue