summaryrefslogtreecommitdiff
path: root/src/gpu/gpu.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-01-28 09:31:13 +0100
committerskal <pascal.massimino@gmail.com>2026-01-28 09:31:13 +0100
commit302d883f34864bc66a5e04532ae27d7e89fd94e8 (patch)
tree8f813865d5dc5b70ee8bf9ee4866546116859825 /src/gpu/gpu.cc
parentf804dcb9740540b3735628ebf8c006235cc56fca (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/gpu.cc')
-rw-r--r--src/gpu/gpu.cc24
1 files changed, 14 insertions, 10 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() {}