In fact, I take into account only gl.RGBA format with 8-bit framebuffer. But if you have float textures in your own custom material perhaps it may lead to an error or not to measure the drawing time. Also this code not asynchronous and often lead to bottleneck on CPU before you hit GPU limit. I need to think about it again, just was happy that itās work on most of examples.
When I measured time with EXT_disjoint_timer_query I often have 20% of load free on gpu, because OS also use it. But with cpu timers things become not so precise and show sometime 0% left in requestAnimationFrame loop. Anyway it is good rough estimation and it works even on mobile phones which is amazing I think.
Interesting. I take it this will force the GPU to execute all previous drawing commands, so that the pixels (pixel) delivered are correct. But how do you avoid impacting the performance you are trying to measure?
You can off gpu tracking, just press on it. And all will be perfect I suppose.
Yes it will be cool, I want to figure out how to sync GPU with CPU with less impact on overall performance. I am tried: EXT_disjount_timer_query, gl.finish(), gl.getPixels(). For now I am stoped on getError() + getParameter(). Work smoothly for me.
Thanks for the explanation, this makes more sense.
I have figured out how to test and see if itās working correctly.
(very simple - disable the custom shader material and see if it impacts the performance)
Gpu use hovers around 60% without the custom shader, and 65% with it, at full screen, thereās other stuff in three.js going on. So, even if it doesnāt give absolute accuracy, itās easy to make comparison tests.
Btw, the new version doesnt seem to work, I just updated it, hereās a screen comparison of them both running the same:
Sorry, I canāt find the discussion on github. Where is it?
If first version worked for you than you are able to get super precise result from EXT_disjoint_timer_query! Some guys earlier says that itās not working. Obviously we need an extension for extension.
You forcing me to return on gl.readPixels, but actually there was a bug in asynchronous code. I used setTimeout(f, 0) without Promise, so it was macrotask. But macrotask can thrown over rAF in chrome, here a events priority in different browsers:
I tried it in Chrome now, and it seems to give reasonable results. I donāt understand what the Count is, except in the instancing example, other than something that kills performance when increased.
I am not a fan of the icons. I donāt find them intuitive. The first looks like a microchip, and the second looks like a passive component like a resistor or something. The letters āCā and āGā are obvious choices, but they will perhaps look too similar on that scale? Any other options that have been considered? How about a triangle for the GPU, and something else for the CPU?
Weird, itās not working for me, and I noticed you changed the example code to set it up, so im not even sure im implementing it the right way.
Plus: bench.newFrame() - isnāt a function, and I donāt even know what to pass it as the argument ānowā
I drew this svg icons in Inskape by hands and was inspired by this pack. Simple C/G letters will be smaller than svg in bundle.
Examples was copypasted from official Three.js repo for testing purposes, variable ācountā changing number of GPU draw calls. I need to keep references to original authors.
@Cotterzz thank you for your patience, it was a typo in the documentation and some garbage in minified file included from vscode.
Ok, I got it.
itās not newFrame, its nextFrame, (And I think you donāt need to pass it a now variable)
Itās working, but gpu seems to be stuck at 100%, most of the time, which i donāt think is correct, the bar indicator isnāt very accurate, so I donāt really know.
I can explain why I am choose this explicit API with nextFrame:
time from rAF callback more precise than performance.now() here proof and after that we can make signal filtering for chart.
with this explicit function we can make a tool for measuring outside of the rAF
Also if you will find a way how to measure with readPixel and it will be working with Framebuffers and Float textures I will merge this poll request on github.