Re:Deno v1.8 – support for WebGPU, private modules, Intl, an...
by flohofwoe on Wednesday March 03, 2021 @07:28AM
(#26327486)
WebGPU is the common cross-section of the modern 3D APIs (Metal, D3D12 and Vulkan). In general, and somewhat simplified, those APIs move all the expensive render-pipeline-configuration out of the render loop and into the initialization phase. So your code is much more "front-loaded" than GL, but once everything's initialized, the actual rendering is much less code and has much less overhead because most render-state has been pre-compiled into immutable objects. OpenGL on the other hand is a highly dynamic state machine where flipping a single "switch" can lead to expensive reconfiguration of the render pipeline during rendering.
Re:Deno v1.8 – support for WebGPU, private modules, Intl, an...
by skocznymroczny on Wednesday March 03, 2021 @05:32AM
(#26326735)
I've been using wgpu for quite some time (in D, through wgpu-native bindings). What exactly do you find it horrifying? It's much closer to DX12/Vulkan than OpenGL. The main difference is that it introduces the concept of a render pipeline, encapsulating all render state from shaders used, shader input layouts, vertex layouts, depth/stencil states, color attachments, which can be pre-created and then bound with a single API call. It's a big improvement over OpenGL which required you to track the state yourself or pre-emptively restore most of the state to avoid side effects between calls.
Re:Deno v1.8 – support for WebGPU, private modules, Intl, an...
by singularity2001 on Wednesday March 03, 2021 @06:44AM
(#26327173)
132 lines for hello world (helloTriangle), just so much boiler plate.
I cannot pin it down but there must be a better way, this looks like the server world before the invention of ruby on rails.
Also magical values in string format:
primitiveTopology: 'triangle-list', const swapChainFormat = 'bgra8unorm'; ...
Re:Deno v1.8 – support for WebGPU, private modules, Intl, an...
by flohofwoe on Wednesday March 03, 2021 @07:31AM
(#26327511)
Have you seen a Vulkan "Hello Triangle" in comparison? That's a least a thousand lines of code, and that's with taking shortcuts :)
132 lines isn't really that much for a triangle in any 3D API, except 90's style OpenGL 1.x (which was a nice and convenient API, but also very inefficient).
I'm sure there will be plenty of high-level Javascript libraries built on top of WebGPU which will cater to different philosophies and use cases, and those will also allow a Hello Triangle with fewer lines of code (but also will involve compromises at flexibility or performance).
Re:Deno v1.8 – support for WebGPU, private modules, Intl, an...
by skocznymroczny on Wednesday March 03, 2021 @06:48AM
(#26327207)
Does Javascript have enums? I've seen these stringly typed enums often in JS APIs.
to me both look similarly horrifying:
http://austin-eng.com/webgpu-samples/samples/rotatingCube?wg...