Slow Direct 2D performance
-
sábado, 3 de março de 2012 22:17
Hi.
I am a c# developer looking at writing a game for W8. I have never touched C++ before but am slowly learning.
I am trying to draw thousands of squares to the screen and animate them as a perf test, and its turning out terribly. With XNA on my phone I can do a similar thing with around 6000 squares before it starts lagging. On my core i5 with 4Gb ram, I cant even get double that. Im sure I am drawing it wrong or something
Here is my code, I would appreciate help
for (int i = 0; i < 10000; i++) { Pixel p = pixels[i]; pixels[i].YPos += 1; m_d2dContext->DrawRectangle(D2D1::RectF(p.XPos, p.YPos, p.XPos + 3, p.YPos +3),m_solidBrush.Get()); }
.
Todas as Respostas
-
segunda-feira, 5 de março de 2012 11:57
Hi ruguemat,
difficult for me to see a issue with only those lines of code. Where are your BeginDraw & EndDraw methods? Can you paste you main loop here? Direct2D is optimized to send a lot of geometry at once to the GPU - maybe you can optimize for that.
Did you already have a look here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd372260%28v=vs.85%29.aspx
- Paul
- Sugerido como Resposta Jeff SandersMicrosoft Employee, Moderator segunda-feira, 5 de março de 2012 21:12
- Marcado como Resposta Bob_BaoMVP, Moderator terça-feira, 10 de abril de 2012 03:43

