Preamble
Alright so ... I know this question may cover several topics, but I'm completely new to DirectX as well as Multithreading and the Stackoverflow+MSDN articles I read up until now have not helped me at all. Hence I'm very thankful for every comment that pushes me in the right direction.
Premise
I started a few weeks ago by writing a Direct2D
renderer which draws some matrix I put into it and draws it in a single window (Which works great, by the way).
I was trying to speed up my computations and got the tip to use openMP
. When using the pragma statement, my progrman uses 3 threads instead of one - which is good I guess. But I do not notice any speedup. However that's not the whorst part. The drawing call takes up a lot more time than my computation of the matrix. And I have no idea how I could speed that up.
Question
Please tell me what I should look out for or how I could speed up/multithread my drawing call.
Note: I'm using STL, Windows and DirectX headers but no .NET, MFC/ATL or similar library.
Code sample
vector<dot> set computeMatrix(ushort x, ushort y)
{
// init set
#pragma omp parallel for
for(i=0; i<y; ++i)
for(j=0; j<x; ++j)
//do some computation
return set;
}
dot
is a D2D1 ellipse object.
void draw(vector<dot> set)
{
pRenderTarget->BeginDraw();
pRenderTarget->SetTransform(D2D1::Matrix3x2F::Identity());
#pragma omp parallel for
for(auto coord: set)
{
// set the pBrush
pRenderTarget->FillEllipse(dot, pBrush);
}
pRenderTarget->EndDraw();
}