private void Parse(uint value) { RegisterNumber = (value & 0x7FF); RegisterType = (RegisterType)(((value >> 28) & 0x7) | ((value >> 8) & 0x18)); IsRelativeAddressMode = (value & (1 << 13)) != 0; MinPrecision = ((value >> 12) & 0XC); SwizzleComponents = ((value >> 16) & 0xFF); SourceModifier = (SourceModifier)((value >> 24) & 0xF); }
public void SetSourceModifier(int index, SourceModifier modType, int customNum) { if (index >= this.textureBlends.Count) { this.textureBlends.Add(new TextureBlend()); } this.textureBlends[index].SourceModifier = modType; this.textureBlends[index].CustomNum = customNum; }
public bool GetSourceModifier(int index, out SourceModifier sourceMod, out int customNum) { sourceMod = SourceModifier.Invalid; customNum = 0; if (index < this.textureBlends.Count) { sourceMod = this.textureBlends[index].SourceModifier; customNum = this.textureBlends[index].CustomNum; } return(sourceMod != SourceModifier.Invalid); }
static string ApplyModifier(SourceModifier modifier, string value) { switch (modifier) { case SourceModifier.None: return(value); case SourceModifier.Negate: return($"-{value}"); case SourceModifier.Bias: return($"{value}_bias"); case SourceModifier.BiasAndNegate: return($"-{value}_bias"); case SourceModifier.Sign: return($"{value}_bx2"); case SourceModifier.SignAndNegate: return($"-{value}_bx2"); case SourceModifier.Complement: throw new NotImplementedException(); case SourceModifier.X2: return($"{value}_x2"); case SourceModifier.X2AndNegate: return($"-{value}_x2"); case SourceModifier.DivideByZ: return($"{value}_dz"); case SourceModifier.DivideByW: return($"{value}_dw"); case SourceModifier.Abs: return($"{value}_abs"); case SourceModifier.AbsAndNegate: return($"-{value}_abs"); case SourceModifier.Not: throw new NotImplementedException(); default: throw new NotImplementedException(); } }
private HlslTreeNode[] GetInputs(Instruction instruction, int componentIndex) { if (instruction is D3D9Instruction d3D9Instruction) { int numInputs = GetNumInputs(d3D9Instruction.Opcode); var inputs = new HlslTreeNode[numInputs]; for (int i = 0; i < numInputs; i++) { int inputParameterIndex = i; if (d3D9Instruction.Opcode != Opcode.TexKill) { inputParameterIndex++; } RegisterComponentKey inputKey = GetParamRegisterComponentKey(instruction, inputParameterIndex, componentIndex); HlslTreeNode input = _activeOutputs[inputKey]; SourceModifier modifier = d3D9Instruction.GetSourceModifier(inputParameterIndex); input = ApplyModifier(input, modifier); inputs[i] = input; } return(inputs); } else if (instruction is D3D10Instruction d3D10Instruction) { int numInputs = GetNumInputs(d3D10Instruction.Opcode); var inputs = new HlslTreeNode[numInputs]; for (int i = 0; i < numInputs; i++) { int inputParameterIndex = i + 1; var operandType = d3D10Instruction.GetOperandType(inputParameterIndex); if (operandType == OperandType.Immediate32) { inputs[i] = new ConstantNode(d3D10Instruction.GetParamSingle(inputParameterIndex, componentIndex)); } else { var inputKey = GetParamRegisterComponentKey(instruction, inputParameterIndex, componentIndex); HlslTreeNode input = _activeOutputs[inputKey]; // TODO: //SourceModifier modifier = d3D10Instruction.GetSourceModifier(inputParameterIndex); //input = ApplyModifier(input, modifier); inputs[i] = input; } } return(inputs); } throw new NotImplementedException(); }
private static HlslTreeNode ApplyModifier(HlslTreeNode input, SourceModifier modifier) { switch (modifier) { case SourceModifier.Abs: return(new AbsoluteOperation(input)); case SourceModifier.Negate: return(new NegateOperation(input)); case SourceModifier.AbsAndNegate: return(new NegateOperation(new AbsoluteOperation(input))); case SourceModifier.None: return(input); default: throw new NotImplementedException(); } }
public TextureBlend(BlendMode blendMode, SourceModifier sourceModifier, int customNum) { this.BlendMode = blendMode; this.SourceModifier = sourceModifier; this.CustomNum = customNum; }
public TextureBlend( BlendMode blendMode, SourceModifier sourceModifier, int customNum ) { this.BlendMode = blendMode; this.SourceModifier = sourceModifier; this.CustomNum = customNum; }
public bool GetSourceModifier( int index, out SourceModifier sourceMod, out int customNum ) { sourceMod = SourceModifier.Invalid; customNum = 0; if ( index < this.textureBlends.Count ) { sourceMod = this.textureBlends[ index ].SourceModifier; customNum = this.textureBlends[ index ].CustomNum; } return ( sourceMod != SourceModifier.Invalid ); }
public void SetSourceModifier( int index, SourceModifier modType, int customNum ) { if ( index >= this.textureBlends.Count ) { this.textureBlends.Add( new TextureBlend() ); } this.textureBlends[ index ].SourceModifier = modType; this.textureBlends[ index ].CustomNum = customNum; }
/// <summary> /// Die Auswahl wurde verändert. /// </summary> /// <param name="sender">Wird ignoriert.</param> /// <param name="e">Wird ignoriert.</param> private void lstSources_SelectedIndexChanged( object sender, EventArgs e ) { // Block for changes m_Running = false; // Disable all selAudio.Enabled = false; selAudioType.Enabled = false; selAudioPID.Enabled = false; cmdAddAudio.Enabled = false; cmdDelAudio.Enabled = false; txAudioLanguage.Enabled = false; // Reset all txName.Text = null; txProvider.Text = null; selType.SelectedIndex = 0; ckEncrypted.CheckState = CheckState.Indeterminate; ckService.CheckState = CheckState.Indeterminate; selVideoPID.Value = selVideoPID.Maximum; selTextPID.Value = selTextPID.Maximum; ckEPG.CheckState = CheckState.Checked; selVideo.SelectedIndex = 0; ckAudio.CheckState = CheckState.Indeterminate; selAudio.Items.Clear(); selAudioType.SelectedItem = null; selAudioPID.Value = selAudioPID.Maximum; txAudioLanguage.Text = null; // Disable grpData.Enabled = false; // Process the selected item foreach (ListViewItem item in lstSources.SelectedItems) { // Attach to source SourceIdentifier source = (SourceIdentifier) item.Tag; // Enable grpData.Enabled = item.Checked; // Check mode if (item.Checked) { // Load modifier SourceModifier modifier; if (!m_Modifiers.TryGetValue( source, out modifier )) modifier = m_PlugIn.Profile.GetFilter( source ).Clone(); else if (null == modifier) modifier = new SourceModifier { Network = source.Network, TransportStream = source.TransportStream, Service = source.Service }; // Remember m_Modifiers[source] = modifier; // Load all if (!string.IsNullOrEmpty( modifier.Name )) txName.Text = modifier.Name; if (!string.IsNullOrEmpty( modifier.Provider )) txProvider.Text = modifier.Provider; if (modifier.IsEncrypted.HasValue) ckEncrypted.CheckState = modifier.IsEncrypted.Value ? CheckState.Checked : CheckState.Unchecked; if (modifier.IsService.HasValue) ckService.CheckState = modifier.IsService.Value ? CheckState.Checked : CheckState.Unchecked; if (modifier.SourceType.HasValue) selType.SelectedIndex = 1 + (int) modifier.SourceType.Value; if (modifier.VideoType.HasValue) selVideo.SelectedIndex = 1 + (int) modifier.VideoType.Value; if (modifier.VideoStream.HasValue) selVideoPID.Value = modifier.VideoStream.Value; if (modifier.TextStream.HasValue) selTextPID.Value = modifier.TextStream.Value; ckEPG.Checked = !modifier.DisableProgramGuide; // Audio if (null != modifier.AudioStreams) { // Enable flag ckAudio.CheckState = (modifier.AudioStreams.Length > 0) ? CheckState.Checked : CheckState.Unchecked; // Load all foreach (AudioInformation audio in modifier.AudioStreams) selAudio.Items.Add( new AudioItem( audio ) ); } } else { // Wipe out settings m_Modifiers[source] = null; } // Done break; } // Back m_Running = true; }
/// <summary> /// Die Auswahl wurde verändert. /// </summary> /// <param name="sender">Wird ignoriert.</param> /// <param name="e">Wird ignoriert.</param> private void lstSources_SelectedIndexChanged(object sender, EventArgs e) { // Block for changes m_Running = false; // Disable all selAudio.Enabled = false; selAudioType.Enabled = false; selAudioPID.Enabled = false; cmdAddAudio.Enabled = false; cmdDelAudio.Enabled = false; txAudioLanguage.Enabled = false; // Reset all txName.Text = null; txProvider.Text = null; selType.SelectedIndex = 0; ckEncrypted.CheckState = CheckState.Indeterminate; ckService.CheckState = CheckState.Indeterminate; selVideoPID.Value = selVideoPID.Maximum; selTextPID.Value = selTextPID.Maximum; ckEPG.CheckState = CheckState.Checked; selVideo.SelectedIndex = 0; ckAudio.CheckState = CheckState.Indeterminate; selAudio.Items.Clear(); selAudioType.SelectedItem = null; selAudioPID.Value = selAudioPID.Maximum; txAudioLanguage.Text = null; // Disable grpData.Enabled = false; // Process the selected item foreach (ListViewItem item in lstSources.SelectedItems) { // Attach to source SourceIdentifier source = (SourceIdentifier)item.Tag; // Enable grpData.Enabled = item.Checked; // Check mode if (item.Checked) { // Load modifier SourceModifier modifier; if (!m_Modifiers.TryGetValue(source, out modifier)) { modifier = m_PlugIn.Profile.GetFilter(source).Clone(); } else if (null == modifier) { modifier = new SourceModifier { Network = source.Network, TransportStream = source.TransportStream, Service = source.Service } } ; // Remember m_Modifiers[source] = modifier; // Load all if (!string.IsNullOrEmpty(modifier.Name)) { txName.Text = modifier.Name; } if (!string.IsNullOrEmpty(modifier.Provider)) { txProvider.Text = modifier.Provider; } if (modifier.IsEncrypted.HasValue) { ckEncrypted.CheckState = modifier.IsEncrypted.Value ? CheckState.Checked : CheckState.Unchecked; } if (modifier.IsService.HasValue) { ckService.CheckState = modifier.IsService.Value ? CheckState.Checked : CheckState.Unchecked; } if (modifier.SourceType.HasValue) { selType.SelectedIndex = 1 + (int)modifier.SourceType.Value; } if (modifier.VideoType.HasValue) { selVideo.SelectedIndex = 1 + (int)modifier.VideoType.Value; } if (modifier.VideoStream.HasValue) { selVideoPID.Value = modifier.VideoStream.Value; } if (modifier.TextStream.HasValue) { selTextPID.Value = modifier.TextStream.Value; } ckEPG.Checked = !modifier.DisableProgramGuide; // Audio if (null != modifier.AudioStreams) { // Enable flag ckAudio.CheckState = (modifier.AudioStreams.Length > 0) ? CheckState.Checked : CheckState.Unchecked; // Load all foreach (AudioInformation audio in modifier.AudioStreams) { selAudio.Items.Add(new AudioItem(audio)); } } } else { // Wipe out settings m_Modifiers[source] = null; } // Done break; } // Back m_Running = true; }