diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-28 09:31:13 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-28 09:31:13 +0100 |
| commit | 302d883f34864bc66a5e04532ae27d7e89fd94e8 (patch) | |
| tree | 8f813865d5dc5b70ee8bf9ee4866546116859825 /src/gpu | |
| parent | f804dcb9740540b3735628ebf8c006235cc56fca (diff) | |
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.
Diffstat (limited to 'src/gpu')
| -rw-r--r-- | src/gpu/gpu.cc | 24 | ||||
| -rw-r--r-- | src/gpu/gpu.h | 6 |
2 files changed, 19 insertions, 11 deletions
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() {} diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h index 87d4b9b..028b31b 100644 --- a/src/gpu/gpu.h +++ b/src/gpu/gpu.h @@ -1,6 +1,10 @@ +// This file is part of the 64k demo project. +// It defines the public interface for the GPU rendering system. +// Coordinates WebGPU lifecycle and draw calls. + #pragma once struct GLFWwindow; void gpu_init(GLFWwindow *window); void gpu_draw(float audio_peak, float aspect_ratio); -void gpu_shutdown(); +void gpu_shutdown();
\ No newline at end of file |
