public override int GetSourceSwizzle(int srcIndex) { D3D10OperandNumComponents componentSelection = GetOperandComponentSelection(srcIndex); if (componentSelection == D3D10OperandNumComponents.Operand1Component) { return((0 << 0) | (1 << 2) | (2 << 4) | (3 << 6)); } else if (componentSelection == D3D10OperandNumComponents.Operand4Component) { D3D10ComponentSelectionMode selectionMode = GetOperandComponentSelectionMode(srcIndex); if (selectionMode == D3D10ComponentSelectionMode.Mask) { return((0 << 0) | (1 << 2) | (2 << 4) | (3 << 6)); } else if (selectionMode == D3D10ComponentSelectionMode.Swizzle) { Span <uint> span = OperandTokens.GetSpan(srcIndex); return((int)((span[0] >> 4) & 0xFF)); } else if (selectionMode == D3D10ComponentSelectionMode.Select1) { Span <uint> span = OperandTokens.GetSpan(srcIndex); int component = (int)((span[0] >> 4) & 3); return(component * 0x55); } } throw new NotImplementedException(); }
private int GetOperandComponentSwizzle(int index, int component) { D3D10OperandNumComponents componentSelection = GetOperandComponentSelection(index); if (componentSelection == D3D10OperandNumComponents.Operand4Component) { D3D10ComponentSelectionMode selectionMode = GetOperandComponentSelectionMode(index); if (selectionMode == D3D10ComponentSelectionMode.Mask) { Span <uint> span = OperandTokens.GetSpan(index); int mask = (int)((span[0] >> 4) & 0xF); throw new NotImplementedException(); //return component; } else if (selectionMode == D3D10ComponentSelectionMode.Swizzle) { Span <uint> span = OperandTokens.GetSpan(index); int swizzle = (int)((span[0] >> 2) & 3); return((swizzle >> (2 * component)) & 3); } else if (selectionMode == D3D10ComponentSelectionMode.Select1) { throw new NotImplementedException(); } } throw new NotImplementedException(); }
public override int GetDestinationWriteMask() { int destinationParamIndex = GetDestinationParamIndex(); D3D10OperandNumComponents componentSelection = GetOperandComponentSelection(destinationParamIndex); if (componentSelection == D3D10OperandNumComponents.Operand4Component) { D3D10ComponentSelectionMode selectionMode = GetOperandComponentSelectionMode(destinationParamIndex); if (selectionMode == D3D10ComponentSelectionMode.Mask) { Span <uint> span = OperandTokens.GetSpan(destinationParamIndex); int mask = (int)((span[0] >> 4) & 0xF); return(mask); } else if (selectionMode == D3D10ComponentSelectionMode.Swizzle) { int mask = 0; int dimension = GetOperandIndexDimension(destinationParamIndex); for (int i = 0; i < dimension; i++) { int swizzle = GetOperandComponentSwizzle(destinationParamIndex, i); if (swizzle != i) { mask |= 1 << swizzle; } } return(mask); } else if (selectionMode == D3D10ComponentSelectionMode.Select1) { throw new NotImplementedException(); } } throw new NotImplementedException(); }