// 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 #include 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, uint32_t 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);