Skip to content
systemcoding.dev

Snippets

Short posts that solve one thing: the code, the output we got, and why it works.

GPU

List platforms with clGetPlatformIDs

Call clGetPlatformIDs twice, once for the count and once for the handles, then print each platform name with clGetPlatformInfo in OpenCL 3.0 C.

1 min read
GPU

Compile a shader to SPIR-V with glslc

Compile a GLSL shader to SPIR-V with glslc from the Vulkan SDK, letting the file extension pick the stage and setting the target environment.

1 min read
GPU

Declare a CUDA kernel with __global__

Mark a function __global__ in CUDA 12 so the host launches it and the device runs it, returning void, and see which qualifiers may call which.

1 min read
GPU

Enable vsync with glfwSwapInterval

Enable vsync with glfwSwapInterval(1) so the buffer swap waits for the display refresh and the loop does not run flat out in GLFW 3.4.

1 min read
Media

Decode on the GPU with -hwaccel cuda

Decode H.264 on an NVIDIA GPU with ffmpeg -hwaccel cuda, which uses NVDEC but copies frames back to system memory unless you also set an output format.

1 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.