From e4aadd83ffe0d0ff33d8ca058c192decbb25974b Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 31 Jan 2026 14:08:00 +0100 Subject: update state in .md files --- src/gpu/gpu.cc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/gpu') diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc index 40be1d2..b1f3f14 100644 --- a/src/gpu/gpu.cc +++ b/src/gpu/gpu.cc @@ -26,8 +26,12 @@ // Type Shims using WGPUStringView = const char *; -static const char *str_view(const char *str) { return str; } -static const char *label_view(const char *str) { return str; } +static const char *str_view(const char *str) { + return str; +} +static const char *label_view(const char *str) { + return str; +} // Renamed Types/Enums #define WGPUSType_ShaderSourceWGSL WGPUSType_ShaderModuleWGSLDescriptor @@ -48,8 +52,7 @@ static void wgpuInstanceWaitAny(WGPUInstance instance, size_t, void *, } // Uncaptured Error Callback Helper -static void set_error_callback(WGPUDevice device, - WGPUErrorCallback callback) { +static void set_error_callback(WGPUDevice device, WGPUErrorCallback callback) { wgpuDeviceSetUncapturedErrorCallback(device, callback, nullptr); } @@ -75,11 +78,11 @@ static WGPUStringView str_view(const char *str) { return {str, strlen(str)}; } -static void set_error_callback(WGPUDevice device, - WGPUErrorCallback callback) { - // Handled in descriptor for new API, mostly. - // But we can also set it here if needed, or define a no-op if descriptor handles it. - // For new API, we set it in WGPUDeviceDescriptor.uncapturedErrorCallbackInfo. +static void set_error_callback(WGPUDevice device, WGPUErrorCallback callback) { + // Handled in descriptor for new API, mostly. + // But we can also set it here if needed, or define a no-op if descriptor + // handles it. For new API, we set it in + // WGPUDeviceDescriptor.uncapturedErrorCallbackInfo. } #endif @@ -109,8 +112,7 @@ struct Particle { // --- Helper Functions --- -GpuBuffer gpu_create_buffer(size_t size, uint32_t usage, - const void *data) { +GpuBuffer gpu_create_buffer(size_t size, uint32_t usage, const void *data) { WGPUBufferDescriptor desc = {}; desc.label = label_view("GpuBuffer"); desc.usage = (WGPUBufferUsage)usage; // Cast for C++ strictness with enums @@ -317,7 +319,6 @@ static void handle_request_device(WGPURequestDeviceStatus status, // ... (Shaders omitted for brevity, they are unchanged) ... - const char *main_shader_wgsl = R"( struct Uniforms { audio_peak : f32, @@ -568,12 +569,11 @@ void gpu_init(GLFWwindow *window) { initial_particles[i].color[3] = 1.0f; } - g_particle_buffer = - gpu_create_buffer(sizeof(Particle) * NUM_PARTICLES, - (WGPUBufferUsage)(WGPUBufferUsage_Storage | - WGPUBufferUsage_CopyDst | - WGPUBufferUsage_Vertex), - initial_particles.data()); + g_particle_buffer = gpu_create_buffer( + sizeof(Particle) * NUM_PARTICLES, + (WGPUBufferUsage)(WGPUBufferUsage_Storage | WGPUBufferUsage_CopyDst | + WGPUBufferUsage_Vertex), + initial_particles.data()); // Initialize Particle Compute Pass ResourceBinding compute_bindings[] = { -- cgit v1.2.3