Re: Slow performance in VS2005 with Texture from Bitmap



I cross posted this to gamedev where the thread was slightly different and
got correctly called on some assumptions I'd made on this one.
http://www.gamedev.net/community/forums/topic.asp?topic_id=357621

Whilst the investigation I did was valid I didn't take into account that
running without the debugger didn't show the slowdown so its defiantly a
debugger problem - not MDX, .Net 2.0 or the code changes I found in the
bitmap class.

We'll follow up with the debugger folk to see if we can get an answer to
this. I tried disabling the MDAs since they are new debugging tools in
VS2005, but that didn't help any

--
Zman
http://www.thezbuffer.com - News and information for Managed DirectX



"ZMan" <zman@xxxxxxxxxxxxxx> wrote in message
news:%23o1R7%23f8FHA.4036@xxxxxxxxxxxxxxxxxxxxxxx
>I spent a little time looking at this. Tom indicated to me that the MDX
>code hasn't changed so it had to be a change in .Net 2.0. He also told me
>that the from bitmap code uses bitmap.GetPixel to be an generic as possible
>and deal with all formats of bitmap.
>
> Comparing the perf of GetPixel between 1.1 and 2.0 gives a 20x decrease in
> speed whcih nicely explains the MDX decrease.
>
> So comparing GetPixel in 1.1 with 2.0 with reflector the only difference
> is that 2.0 range checks X&Y before interoping into GDI. 4 comparisons
> didn't seem too harsh to me, but it compares against .Width and .Height
> which are interop functions themselves. So each call to GetPIxel has 2
> extra interop calls to GDI and 4 comparisons.
>
> So there is no easy work around other than rolling your own. You should be
> able to match the 2003 perf and still cover all the bitmap functions by
> writing your own that interops into GDI.
>
> I didn't notice any increase in speed when compiling in release mode on my
> performance test, which makes sense. In the reported cases it must have
> been a speed up in the rest of your code rather than a speed up in the
> perf of texture loading.
>
> I don't know if the DX team will be speeding this up in future releases,
> but it looks like a good area for perf increases.
>
> --
> Zman
> http://www.thezbuffer.com - News and information for Managed DirectX
>
>
>
> "Matt Wyckhouse" <MattWyckhouse@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
> message news:9382E48C-D319-4D79-826F-62BD96D30E8F@xxxxxxxxxxxxxxxx
>> Thanks for the information ZMan. It's good to know that I'm not the only
>> one
>> with this problem, but it would be nice for one of the MVPs to look into
>> this. I would like to be able to debug my app without these rediculous
>> slowdowns.
>>
>> Matt
>
>


.



Relevant Pages

  • Re: Slow performance in VS2005 with Texture from Bitmap
    ... Tom indicated to me that the MDX code ... that 2.0 range checks X&Y before interoping into GDI. ... So each call to GetPIxel has 2 extra interop ... able to match the 2003 perf and still cover all the bitmap functions by ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: GdipCreateHBITMAPFromBitmap + PixelFormat32bppARGB
    ... The Windows bitmap specification was drawn up for Windows 3.1 ... Alpha blended bitmaps were not supported. ... The documentation for AlphaBlend function implies that Windows GDI ... an alpha channel. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: The story: Painting bitmap to screen is slow
    ... The general "trick" behind great GDI+ performance is to do all drawing ... single bitmap to the screen. ... I heard Microsoft broke GDI acceleration for some operations in Vista. ... your configuration of Vista or graphics driver. ...
    (microsoft.public.dotnet.framework.drawing)
  • The story: Painting bitmap to screen is slow
    ... I've done a lot graphics programming by now and the thing that bothers me with GDI+ in .NET framework the most is slow drawing of bitmaps to screen. ... In Win32, there were two types of bitmaps, compatible and memory bitmap. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Creating a GDI+ Bitmap from an 8-bit Bitmap
    ... Ok, when I create the GDI+ bitmap from a DIB, the image looks a bit better. ... That tells me that something is still a bit off with my palette. ...
    (microsoft.public.win32.programmer.gdi)