void MyMemoryBlockObserver_TargetChanged(object sender, PropertyChangedEventArgs e)
{
// TODO fix this: should be handled somewhere above (during deserialization)!
if (Target == null)
{
MyLog.ERROR.WriteLine("Observer: could find the target MemoryBlock, so not opening this one.");
return;
}
Type type = Target.GetType().GenericTypeArguments[0];
m_kernel = MyKernelFactory.Instance.Kernel(@"Observers\ColorScaleObserver" + type.Name);
m_vectorKernel = MyKernelFactory.Instance.Kernel(MyKernelFactory.Instance.DevCount - 1, @"Observers\ColorScaleObserverSingle", "DrawVectorsKernel");
m_rgbKernel = MyKernelFactory.Instance.Kernel(MyKernelFactory.Instance.DevCount - 1, @"Observers\ColorScaleObserverSingle", "DrawRGBKernel");
m_tiledKernel = MyKernelFactory.Instance.Kernel(MyKernelFactory.Instance.DevCount - 1, @"Observers\ColorScaleObserverSingle", "ColorScaleObserverTiledSingle");
m_tiledRGBKernel = MyKernelFactory.Instance.Kernel(MyKernelFactory.Instance.DevCount - 1, @"Observers\ColorScaleObserverSingle", "DrawRGBTiledKernel");
if (!m_methodSelected)
{
Method = Target.Metadata.GetOrDefault(MemoryBlockMetadataKeys.RenderingMethod,
defaultValue: RenderingMethod.RedGreenScale);
}
if (!m_showCoordinatesSelected)
{
ShowCoordinates = Target.Metadata.GetOrDefault(MemoryBlockMetadataKeys.ShowCoordinates,
defaultValue: false);
}
if (ObserveTensors && type.Name != "Single")
{
MyLog.WARNING.WriteLine("Observing tensors, with anything other than Signles not supported, will use Single");
}
if (Method == RenderingMethod.Vector)
{
MyLog.WARNING.WriteLine("Observing tensors in Vector mode not supported");
}
}