windows - How much improvement can I expect with SharpDX over heavily optimized GDI code in C#/WinForms? -


i've been working on c#/gdi graphical app couple years. i've spent lot of time optimizing drawing code. drawing screen invalidating picturebox control 10 times second, , leveraging subsequent onpaint event occurs when windows triggers it. onpaint event gives me access graphics object via painteventargs param.

per frame: draw hundreds of lines, hundreds of rectangles, , call graphics.drawstring() method hundreds of times well.

i started putting sharpdx project in hopes draw more 2d elements, , draw faster screen. set 2 test projects draw same 2d elements on screen using gdi , using sharpdx. used c# stopwatch object detect how long taking draw 2d elements. far, have not noticed speed improvement when drawing sharpdx. both gdi , sharpdx average 20millis per draw.

how of speed improvement should expect using sharpdx? , portion of rasterization supposed make faster gdi?

i worked on windows forms app "rendering system" pluggable, , wrote 2 rendering systems: 1 in gdi+, , 1 in managed directx (a .net wrapper around directx, similar sharpdx). because doing lot of drawing of images @ arbitrary scales, managed directx blew gdi+ out of water our use case. drawing code used 1-pixel-wide lines fast in managed directx. thick lines slower single-pixel lines, because rendered triangle strips (which can drawn gpu) coordinates had calculated cpu, , geometry complicated segment joints (which rounded, if remember right). fortunately, in our application didn't need draw curves, have approximated small line segments (for single-pixel widths) , triangles (for thicker).

it's things cpu-based approximation , triangulation slow direct3d app down. 3d games use pre-calculated meshes , make use of vertex buffers on gpu avoid moving data , forth cpu gpu. don't have data comparing speeds between gdi+ , directx, these things consider.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -