GitXplorerGitXplorer
b

webgpu_fundamentals_c

public
6 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
e2b7e630cfa9ed9f96aa67af712044e95d526f75

removed compile_commands.json since clangd seems to be able to find it in the build folder now

bbobajeff committed a year ago
Unverified
0d2fa07b8fa4e3bf06fca395847967d784d70783

fix formatting

bbobajeff committed a year ago
Unverified
7c83280f8719db7eafb73c255a45721869608d6c

update readme

bbobajeff committed a year ago
Unverified
0594f73fe8a9631ad03ceab45e84a15850153c19

and script to test all the binaries

bbobajeff committed a year ago
Unverified
a325b977f294cd708439e1c3b189305a2bd168d5

lock glfw at revision 73948e6c0f15b1053cf74b7c4e6b04fd36e97e29

bbobajeff committed a year ago
Unverified
e6384876c97e7c5bd1a19f9bea8d3aef81380ba6

fixed ffmpeg example

bbobajeff committed a year ago

README

The README file for this repository.

webgpu fundamentals c

Note: I'm freezing the wgpu version at v0.17.0.2 because the webgpu native API is still very much in flux and it's alot of work to update all of the examples for breaking changes.

following along

The examples in basics and 3d_math folder are following the guide found here: https://webgpufundamentals.org/

Since things change (and likely changed while working on this) the guide from this revision should be the similar to what I was following.

Unlike the guide I did not use any GUI library (too complicated). Instead I built demos that, to my understanding, demonstrated what the GUI was showing.

correctness

Also, at this time I have not verified if my results match the guides since none of my browsers support webgpu on my hardware yet. I would not be surprised if at least a few of them are off somehow.

works on my machine...

The code has been tested on Kubuntu 23.04, Linux Mint 21.1 and Linux Mint 21.3. I hope it works on other machines though 😁.

building

get the source

git clone git@github.com:bobajeff/webgpu_fundamentals_c.git

get the dependecies

  • wgpu-native v0.17.0.2 (required) -
  • ffmpeg (optional - only one example uses it)
    • get the ffmpeg libraries for your system. For ubuntu based systems the command is: sudo apt-get install pkg-config libavdevice-dev libavfilter-dev libavformat-dev

build the project

In source directory run:

cmake -B build
cmake --build build

running examples

Run the executables found in their respective build subdirectories or run the test_build.sh script

commentary

I had a lot of joy playing with this. It seems that porting from javascript to c is not such a bad idea. I had a much better time than doing something very similar in porting some C++ to C. I mostly just wanted to learn the API but It was good to get my hands wet with GPU GL programming and familiarize myself with 3d graphics concepts again.

Thanks to webgpufundamentals.org for providing a easy to follow guide and helping to explain how these things work.