Skip to main content

Following the wgpu tutorial

· 2 min read

Ramping up on the custom rendering engine by going through the excellent Learn Wgpu tutorial. There's not much to say that's insightful here, but I find it's nice to create "early days" blog posts and images to highlight progress over time.

alt text

I read a comment along the lines of "wgpu has so much boilerplate"

Though pedantic, I'd argue wgpu has a lot of configuration. I tend to consider boilerplate code common text that must be repeated to properly structure or specify another piece of non-common configuration or otherwise unique code. (Note: my personal definition is very different from AWS' definition which portrays "boilerplate" as a positive). By "must be repeated", I'm alluding to the kind of code that cannot be encapsulated easily into a reusable function, library, or other standard language primitive -- let's ignore macros certainly blur that line and just run with this hand-wavy definition!

In the context of creating many different wgpu programs, I can see how repeating the exact same configuration would constitue a good deal of "boilerplate code." However, that commonality could be easily wrapped into a reusable library, which -- if we're willing to run with my definition of boilerplate code! -- means it is not boilerplate code as the code does not have the quality that it "must be" repeated.

In the context of a single program, wgpu strikes me simply as a very low-level library with detailed, highly structured configuration.