From 302d883f34864bc66a5e04532ae27d7e89fd94e8 Mon Sep 17 00:00:00 2001 From: skal Date: Wed, 28 Jan 2026 09:31:13 +0100 Subject: style: Add 3-line descriptive headers to all source files This commit applies a new project-wide rule that every source file must begin with a concise 3-line comment header describing its purpose. - Updated CONTRIBUTING.md with the new rule. - Applied headers to all .cc and .h files in src/ and tools/. - Fixed various minor compilation errors and missing includes discovered during the header update process. --- src/gpu/gpu.cc | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/gpu/gpu.cc') diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc index b87c47f..f32f049 100644 --- a/src/gpu/gpu.cc +++ b/src/gpu/gpu.cc @@ -1,3 +1,7 @@ +// This file is part of the 64k demo project. +// It implements the WebGPU rendering pipeline and shader management. +// Driven by audio peaks for synchronized visual effects. + #include "gpu.h" #include "platform.h" @@ -144,9 +148,10 @@ void gpu_init(GLFWwindow *window) { adapter_opts.compatibleSurface = g_surface; adapter_opts.powerPreference = WGPUPowerPreference_HighPerformance; - wgpuInstanceRequestAdapter(g_instance, &adapter_opts, - {nullptr, WGPUCallbackMode_WaitAnyOnly, - handle_request_adapter, &g_adapter, nullptr}); + wgpuInstanceRequestAdapter( + g_instance, &adapter_opts, + {nullptr, WGPUCallbackMode_WaitAnyOnly, handle_request_adapter, &g_adapter, + nullptr}); while (!g_adapter) { wgpuInstanceWaitAny(g_instance, 0, nullptr, 0); @@ -158,9 +163,10 @@ void gpu_init(GLFWwindow *window) { device_desc.uncapturedErrorCallbackInfo.callback = handle_device_error; #endif - wgpuAdapterRequestDevice(g_adapter, &device_desc, - {nullptr, WGPUCallbackMode_WaitAnyOnly, - handle_request_device, &g_device, nullptr}); + wgpuAdapterRequestDevice( + g_adapter, &device_desc, + {nullptr, WGPUCallbackMode_WaitAnyOnly, handle_request_device, &g_device, + nullptr}); while (!g_device) { wgpuInstanceWaitAny(g_instance, 0, nullptr, 0); @@ -265,8 +271,7 @@ void gpu_draw(float audio_peak, float aspect_ratio) { WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal) return; - WGPUTextureView view = - wgpuTextureCreateView(surface_texture.texture, nullptr); + WGPUTextureView view = wgpuTextureCreateView(surface_texture.texture, nullptr); struct { float audio_peak; @@ -312,5 +317,4 @@ void gpu_draw(float audio_peak, float aspect_ratio) { wgpuTextureRelease(surface_texture.texture); } -void gpu_shutdown() { -} \ No newline at end of file +void gpu_shutdown() {} -- cgit v1.2.3