API / geotoolkit3d / util / benchmark / GPUBenchmark / GPUBenchmark
benchmark.GPUBenchmark.GPUBenchmark
Utility class to benchmark GPU.
This GPUBenchmark class provides the following GPU benchmark information:
- GPU information:
General information about current browser, including GPU name and WebGL information. - Graphic Performance Score:
A score indicates the raw power of the GPU. The higher the score is, the better the GPU is.
Usually, an mid-low-end integrated graphics card like Intel UHD Graphics 630 can reach about 460 score, a mid-end dedicated graphics card like NVIDIA GeForce GTX 1050 Ti can reach about 2200 score, and a high-end dedicated graphics card like NVIDIA GeForce RTX 3080 can reach about 20400 score. - Estimated GPU memory:
To determine the available GPU shared memory (both VRAM and shared RAM memory), this utility allocate GPU memory until the WebGL context drops (in a controlled manner).
This allow us to get an estimation of the available memory.
Because of web browser limitations, it is currently not possible to measure the exact VRAM capacity, and not possible either to distinguish the GPU VRAM from shared memory. Please note that after estimating GPU memory, it is necessary for the user to reload the page or even close the tab and reload to allow further WebGL context creation. Currently only supported on Windows Chrome and Mac Chrome due to the limitation of devices and browsers.
Constructors
Methods
Methods
▸ getClassName(): string
string
▸ Static formatBytes(bytes): string
Helper function to format bytes
| Name | Type | Description |
|---|---|---|
bytes | number | number of bytes |
string
formatted result
▸ Static getClassName(): string
string
▸ Static getGPUInfo(): Promise<GPUInfo>
Get GPU information
Promise<GPUInfo>
GPUBenchmark.GPUInfo
▸ Static isMemoryEstimateSupported(): boolean
Check if GPUBenchmark.startMemoryEstimate is supported by current device.
boolean
true if supported, otherwise false
▸ Static isScoreSupported(): boolean
Check if GPUBenchmark.startScoreBenchmark is supported by current device.
boolean
true if supported, otherwise false
▸ Static startMemoryEstimate(container?): Promise<Result>
Start GPU memory estimation
This method will try to allocate as many textures as possible until the WebGL loses context.
The result is the number of bytes allocated. This result can provide a general idea of the GPU memory but not an exact number. The GPU memory estimation includes the GPU memory usage from both dedicated GPU memory and shared GPU memory.
Please be aware that this method will cause a page crash due to the GPU being out of memory, it has a chance that the WebGL context can be restored but not guaranteed.
Use it very carefully.
| Name | Type | Description |
|---|---|---|
Optional container | HTMLElement | If the container is not provided, it will do the offscreen rendering, otherwise it will render the benchmark scene on the given canvas. |
Promise<Result>
▸ Static startScoreBenchmark(container?): Promise<number>
Start benchmarking GPU
A score that indicates the raw power of GPU will be returned after the benchmarking test.
| Name | Type | Description |
|---|---|---|
Optional container | HTMLElement | If the container is not provided, it will do the offscreen rendering, otherwise it will render the benchmark scene on the given canvas. |
Promise<number>