diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-31 00:47:55 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-31 00:47:55 +0100 |
| commit | 91f557d8777d6185ed47927318973d515f8dcbee (patch) | |
| tree | 72c6280d8ed98bc19109bc447893da41af0bcecf /src/gpu/gpu.h | |
| parent | 8e199322ea4cb51d81c29d84120e4b142f7241b5 (diff) | |
Implement procedural audio generation, spectral effects, and WebGPU particle system
Diffstat (limited to 'src/gpu/gpu.h')
| -rw-r--r-- | src/gpu/gpu.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h index 00f5450..58b0307 100644 --- a/src/gpu/gpu.h +++ b/src/gpu/gpu.h @@ -3,8 +3,49 @@ // Coordinates WebGPU lifecycle and draw calls. #pragma once + +#include <webgpu.h> + struct GLFWwindow; +// Basic wrapper for WebGPU buffers +struct GpuBuffer { + WGPUBuffer buffer; + size_t size; +}; + +// Encapsulates a compute operation +struct ComputePass { + WGPUComputePipeline pipeline; + WGPUBindGroup bind_group; + uint32_t workgroup_size_x; + uint32_t workgroup_size_y; + uint32_t workgroup_size_z; +}; + +// Encapsulates a render operation +struct RenderPass { + WGPURenderPipeline pipeline; + WGPUBindGroup bind_group; + uint32_t vertex_count; + uint32_t instance_count; +}; + void gpu_init(GLFWwindow *window); void gpu_draw(float audio_peak, float aspect_ratio, float time); void gpu_shutdown(); + +// Helper functions (exposed for internal/future use) +struct ResourceBinding { + GpuBuffer buffer; + WGPUBufferBindingType type; // e.g., WGPUBufferBindingType_Uniform, + // WGPUBufferBindingType_Storage +}; + +GpuBuffer gpu_create_buffer(size_t size, WGPUBufferUsage usage, + const void *data = nullptr); +ComputePass gpu_create_compute_pass(const char *shader_code, + ResourceBinding *bindings, + int num_bindings); +RenderPass gpu_create_render_pass(const char *shader_code, + ResourceBinding *bindings, int num_bindings); |
