hello everyone ! i use GDI and ID3DXLine to Draw lines in the D3Dsurface ,GDI
is not GPU accelerate,why faster then ID3DXLine? is anyone know why?
hello everyone ! i use GDI and ID3DXLine to Draw lines in the D3Dsurface ,GDI
is not GPU accelerate,why faster then ID3DXLine? is anyone know why?
You don't provide details of what you're implementing or how you're measuring relative execution times.
At a guess, I'd say you're using GDI to do a lot less than the equivalent ID3DXLine is capable of. ID3DXLine provides more flexibility in line drawing (storage for line lists, application of transforms, perspective stippling, etc.). It's use can be more than just drawing 2D lines on the surface. That capability comes with the price of execution time to access parameters and manipulate data that (it appears) you don't need.
More succinctly, you may be using a hydraulic press when all you need is a nutcracker.
http://msdn.microsoft.com/en-us/library/windows/desktop/ee417756(v=vs.85).aspx
It is possible, that your GDI API is being accelerated by GPU on a modern OS.
GDI or at least GDI+ is really fast, I would assume hardware accelerated by default since at least Vista. Apparently it depends on how complicated stuff you try to do with it, but basic stuff at least. I did some experimenting 2-3 years ago with trying to replace some rectangle and line drawing from GDI+ to Direct3D9 (had to support XP) using SlimDX. Using all combinations of vertex buffers, index buffers, caching, batching and god knows what, I managed to gain like 2 fps compared to just drawing each of those primitives with one draw call each, even when using anti aliasing on the GDI+ side and not on the D3D side. GDI+ was just way better att handling the particular workload I was throwing at them which primarily consisted of lines and single-colored rectangles.
The directx line is very dependant on states (depth buffer, alpha, texturing, lighting, culling, etc..).
Did you properly disable all the states before you started using the line interface?
Now don't quote me on that, but I believe that Humus said something like "consumer level GPUs suck at line drawing". This + poor depth behavior are the reasons debugging wireframe mode has such a low FPS.