-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Major refactor (breaking changes) #29
Conversation
e2082b0
to
a17ddd0
Compare
Excellent! Thank you for putting so much effort into this! I'll have a good look over the weekend and get back to you. |
Thanks! I am wondering if we shouldn't use the raw And I am considering switching to the following benchmark, which seems to allow for higher fpses on lower powered devices: https://gfxbench.com/result.jsp?benchmark=gfx50&test=756&text-filter=&order=median&ff-lmobile=true&ff-smobile=true&os-Android_gl=true&os-Android_vulkan=true&os-iOS_gl=true&os-iOS_metal=true&os-Linux_gl=true&os-OS_X_gl=true&os-OS_X_metal=true&os-Windows_dx=true&os-Windows_dx12=true&os-Windows_gl=true&os-Windows_vulkan=true&pu-dGPU=true&pu-iGPU=true&pu-GPU=true&arch-ARM=true&arch-unknown=true&arch-x86=true&base=device |
@TimvanScherpenzeel (Maybe wait with adding commits to this branch – I am still changing things and don't want to deal with too many merges quite yet.) |
I think that would be a possible solution but we have to be careful that the resolutions the tests have been rendered on are consistent. In the test you mentioned the GTX 1660 TI reports higher framerates than the RTX 2080 TI very likely due to the resolution. |
Good point – on desktop machines we could filter by '1920x1080' resolutions. But not sure what to do with mobile – we could perhaps even match up screen size to the device? hm |
I think on desktop devices it makes sense to filter or come up with some formula to describe fps per pixel (this could raise issues with pixel density). I wouldn't worry about screen size difference on mobile as I presume they tested on the physical phone and not an external screen so the fps in that sense is "real". |
GTX 1660 TI -> 723.1 / (1195 x 768) = 0,000787896617852 Sorting by the lowest would then yield the highest relative performance. We might run into some floating point error issues at some point but generally this would work I think |
A GPU could be used in phones of different screen resolutions. For example the A12 bionic is used in these devices:
|
How about the data structure I just pushed: 6056a32#diff-2e61470ff9838f404e727964eb374441 the fourth element in the array is an array of [screenWidth, screenHeight, fps, deviceName] (device name is not included in desktop data, because it is the same as the GPU name) We could use this to both match the performance impact of large displays on desktop as well as better match specific mobile devices. |
Great! I think that would work well 👍 What would the |
I'll create a new ticket once this is merged, |
- have deobfuscateAppleGpu return multiple possible renderers - improve isIPad detection and use it to improve filtering of apple devices - rename mobile -> isMobile - add tests for screen size dependent results - improve test output
I think functionality wise things are nearly done with the refactor. I spent some time today looking into the deobfuscation of the apple gpu's. I refactored I did some brief tests on browserstack and it looks like the library is now able to pinpoint most individual apple devices thanks to the combination of GPU detection, screen size comparisons and filtering based on whether the device is an ipad or not. On the android side of things we are also able to pinpoint devices more accurately, but it seems the benchmark data is a little out of date on that side right now. Perhaps there are more benchmark results out there somewhere we could use. The amd version is now 2.98kb gzipped. |
I also clarified the api a bit by moving overridable parameters together: type GetGPUTierParameters = {
glContext?: WebGLRenderingContext | WebGL2RenderingContext;
failIfMajorPerformanceCaveat?: boolean;
mobileTiers?: number[];
desktopTiers?: number[];
benchmarksUrl?: string;
override?: {
renderer?: string;
isIPad?: boolean;
isMobile?: boolean;
screen?: { width: number; height: number };
loadBenchmarks?: (file: string) => Promise<ModelEntry[] | undefined>;
};
} |
Great! I noticed there are quite of few linting errors, would you like me to directly fix it on your branch? |
Looks good, I like the idea. |
I have about 15 commits on stand-by fixing all lint errors and improving the readability. Please let me know if I can push this to your branch. Regarding the Notes for me:
Overall I am really happy with all the new additions (especially the more accurate reporting and that the work of #26 is included in here). Thank you for all the effort so far 👍 ! |
Yes, go ahead. How about we merge the pull request into the development branch and you take it from there? After checking with TSLint I was wondering about some of the rules:
Another option would be to skip eslint altogether and opt for a combination of prettier & typescript to cover most code quality cases...
Good point! |
Sounds good! I'll merge it into development. |
I spent some time looking into improving detect-gpu:
device-ua
dependency with plain jstier
,mobile
(boolean),type
(BENCHMARK
|BLACKLISTED
|WEBGL_UNSUPPORTED
|FALLBACK
), andmodel
(the renderer string it matched – handy for tests).Instead of looking at the changed files, it probably makes sense to look at my repo instead: https://github.com/puckey/detect-gpu
Open for feedback on this – I realise it is a lot in one go.