Return to search

Performance comparison of WebGPU and WebGL in the Godot game engine

Background. For rendering graphics on the web, WebGL has been the standard API to employ over the years. A new technology, WebGPU, has been set to release in 2023 and utilizes many of the novel rendering approaches and features common for the native modern graphics APIs, such as Vulkan. Currently, very limited research exists regarding WebGPU:s rasterization capabilities. In particular, no research exists pertaining to its capabilities when used as a rendering backend in game engines.Objectives. This paper aims to investigate performance differences between WebGL and WebGPU. This is done in the context of the game engine Godot, and the measured performance is that of the CPU and GPU frame time. The tests consist of six games for analyzing real-world cases and a number of synthetic test cases that target specific parts of the rendering pipeline. To perform the comparisons a WebGPU backend Rasterizer was implemented with the intended scope of being ableto render basic 2D games.Method. The existing WebGL Rasterizer in Godot was deconstructed to match the scope of the intended rendering functionality. The WebGPU Rasterizer was then implemented in its image and the performance of the implementations was measured in different scopes. These scopes include the frame time on the GPU and CPU and some essential rendering functions on the CPU side. Lastly, the means were calculated, and a t-test was performed to validate the significance of the difference between Rasterizers.Results. The results show that WebGPU performs better than WebGL when used as a rendering backend in Godot, for both the games tests and the synthetic tests. The comparisons clearly show that WebGPU performs faster in mean CPU and GPU frame time. This held true also for 95% lowest frame time. The results varied for the cases of the mean 1% high frame time, with WebGPU generally performing better. The results for the essential rendering functions saw WebGL performing consistently better.Conclusions. In conclusion, WebGPU outperformed WebGL. In most of the tests conducted, substantially and with high statistical significance. In order to better realize the performance benefits of WebGPU in the environment of game engines the implementation could be further expanded on in order to support more advanced games and 3D scenes. Still, the findings of this thesis show WebGPU as a strong contender to WebGL for web rendering. / Bakgrund. För att rendera grafik på webben har WebGL varit det vanliga API:et att använda under åren. En ny teknik, WebGPU, är planerad att släppas 2023 och använder många av de nya renderingstekniker- och funktioner som är vanliga för moderna grafik-API:er, som Vulkan. För närvarande finns mycket begränsad forskning om WebGPU:s rasteriseringsförmåga. I synnerhet finns ingen forskning gällande dess användning som renderingsbackend i spelmotorer.Syfte. Detta arbete syftar till att undersöka prestandaskillnader mellan WebGL och WebGPU. Det görs i sammanhanget av spelmotorn Godot, och den uppmätta prestandan är bildtid på CPU:n respektive GPU:n. Testerna består av sex spel för att analysera mer verkliga sammanhang samt ett antal syntetiska testfall som riktar sig mot specifika delar av renderingspipelinen. För att utföra jämförelserna implementerades en WebGPU rasteriserare med den begränsade förmågan att kunna rendera grundläggande 2D-spel.Metod. Den befintliga WebGL-rasteriseraren i Godot demonterades för att matcha omfattningen av den avsedda funktionaliteten. WebGPU-rasteriseraren implementerades sedan i dess avbild och prestandan för implementationerna mättes i de olika testen. Mätningarna inkluderar bildtiden på GPU och CPU samt några viktiga renderingsfunktioner på CPU-sidan. Slutligen beräknades medelvärden och ett t-test för att validera signifikansen av skillnaden mellan rasteriserarna.Resultat. Resultaten visar att WebGPU presterar bättre än WebGL när den används som renderingsbackend i Godot, både för speltesterna och de syntetiska testerna. Jämförelserna visar tydligt att WebGPU presterar genomsnittligt bättre. Detta gällde även för de 95% lägsta bildtiderna. Resultaten varierade mer för fallen med den genomsnittliga 1% höga bildtiden. Resultaten för de specifika renderingsfunktionerna visade dock att WebGL konsekvent presterade bättre.Slutsatser. Sammanfattningsvis överträffade WebGPU WebGL. I de flesta genomförda tester avsevärt och med hög statistisk signifikans. För att bättre inse prestandafördelarna med WebGPU i spelmotormiljö kan implementeringen utökas ytterligare för att stödja mer avancerade spel och 3D-scener. Ändå visar resultaten i denna avhandling att WebGPU är ett bra alternativ till WebGL för webbrendering.

Identiferoai:union.ndltd.org:UPSALLA1/oai:DiVA.org:bth-24706
Date January 2023
CreatorsFransson, Emil, Hermansson, Jonatan
PublisherBlekinge Tekniska Högskola, Fakulteten för datavetenskaper
Source SetsDiVA Archive at Upsalla University
LanguageEnglish
Detected LanguageEnglish
TypeStudent thesis, info:eu-repo/semantics/bachelorThesis, text
Formatapplication/pdf
Rightsinfo:eu-repo/semantics/openAccess

Page generated in 0.0023 seconds