DirectX - page 8

 
Реter Konow:

Yesterday I made an example of a tumbler with cells redrawing independently of the whole window canvas:https://www.mql5.com/ru/forum/333652/page4

It shows, that separate redrawing of cells holds load in limits of 20% (on video more because of video recording), ALWAYS if cells are redrawn ALL the time and at 40 fps. Normal tumbler dynamics with this approach will load 5-10% roughly.

The load is high only if redrawing large area (~500*500 px) at high rate without pauses (~40+ fps). Any delay or reduction in redrawing area will reduce load many times over.

In your example the glass is quite truncated of course, also in depth. It's funny, but apparently rendering of a stack has to be done on all cores with OpenCL, in addition, since the calculation is broken down into separate cells, but here I am a theorist.

 
Aleksey Vyazmikin:

In your example the beaker is quite truncated of course, including depth. It's funny, but apparently the drawing of the beaker should be calculated on all cores with OpenCL, in addition, since the calculation is divided into separate cells, but here I am a theorist.

Ok, I will make a beaker with more cells and check again.

 
Реter Konow:

OK, I'll make a beaker with more cells and check again.

Just don't make it static, make it dynamic.

 
Rafil Nurmukhametov:

The processor loads well, in the previous picture you can see an open position, the frame around the price is magenta colour, there the position is in deficit, in the picture below the position is in surplus

My feeling is that such an image should not be formed more than 1-3 milliseconds. If it takes longer than that, there must be a bug somewhere.
 
Rafil Nurmukhametov:

Just don't make it static, make it dynamic.

What do you mean by "dynamic"? So that not all cells change values at the same time? I don't get it.

 
Nikolai Semko:
As far as I'm concerned, such an image should not form more than 1-3 milliseconds. If longer than that, there's something wrong somewhere.

Now you've raised the bar for perfection... Why don't you lower it to 6-8 milliseconds?

 
Реter Konow:

What do you mean by "dynamic"? So that not all cells change values at the same time? I don't get it.

So that the current price moves across the cells and not in the middle like in mt5

 
Rafil Nurmukhametov:

to make the current price move across the cells, not in the middle as in the mt5 cup

That is, without centralisation. Well, for futures instruments this is what you really need. Ok. (This is just a mockup to test the load).

 
Rafil Nurmukhametov:

Now you've raised the bar for perfection... Can you lower it to 6-8 milliseconds?

is too much. Even 3 is too much. 6-8 at 30 fps is 20-30% of CPU time.
You need to use ArrayCopy as much as possible where possible. Transparency should also be used to the minimum only where needed.
You can run it through profiling and see where the maximum CPU leaks.
Peter is of course right, you should redraw locally where there were changes but not redraw the whole canvas every time.
And using DX in general can relieve your CPU very much
 

OK, made the glass in the editor. Took me two hours. That's a lot of fuss. You can speed up the process by a factor of four by adding tools.

Tested it.

The result: less than 20% of load with constant change in all cells ask and bid, and one cell price, at 40 frames per second. (The load rises by 5-7 percent when recording is enabled).


I repeat my opinion - in real conditions the load would be 5 - 10 percent depending on market activity.

Files:
GUI_Expert.ex5  600 kb