Running into a peculiar issue. I just ported a substantial Direct2D project from MS API Code Pack to SharpDX. Part of the functionality involves copying very large bitmaps from memory (several times). The code is rather simple... The source of the bitmap is always System.Drawing.Bitmap and the destination is a BitmapRenderTarget. The code below works correctly, BUT... Each successive call to CopyFromMemory() is slower than the previous (serious performance degradation). This is strange... especially since SharpDX is almost always twice as fast as MS API Code Pack for all other CPU timings I have done.. CopyFromMemory() appears to be an exception to this rule.
I've reviewed the code in your library and see no issues. Any ideas?
The source code logic is basically the following lines.
Running into a peculiar issue. I just ported a substantial Direct2D project from MS API Code Pack to SharpDX. Part of the functionality involves copying very large bitmaps from memory (several times). The code is rather simple... The source of the bitmap is always System.Drawing.Bitmap and the destination is a BitmapRenderTarget. The code below works correctly, BUT... Each successive call to CopyFromMemory() is slower than the previous (serious performance degradation). This is strange... especially since SharpDX is almost always twice as fast as MS API Code Pack for all other CPU timings I have done.. CopyFromMemory() appears to be an exception to this rule.
I've reviewed the code in your library and see no issues. Any ideas? The source code logic is basically the following lines.
using Drawing = System.Drawing; ... Drawing.Imaging.BitmapData SourceBitmapData = SourceBitmap.LockBits(new Drawing.Rectangle(0, 0, SourceBitmap.Width, SourceBitmap.Height), Drawing.Imaging.ImageLockMode.ReadOnly, Drawing.Imaging.PixelFormat.Format32bppPArgb); BitmapRenderTarget_SurfaceV[DestinationSurfaceID]).Bitmap.CopyFromMemory(SourceBitmapData.Scan0, SourceBitmapData.Stride); SourceBitmap.UnlockBits(SourceBitmapData);