summaryrefslogtreecommitdiff
path: root/src/gpu
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-09 18:34:20 +0100
committerskal <pascal.massimino@gmail.com>2026-02-09 18:34:20 +0100
commit26915d8c47260f90d67df8c6af1f16ba7607a3d5 (patch)
treec01f1e6bfe0cb85a27f5fc94ed01dea7aa9b969e /src/gpu
parent82fcfd2656a9f7085c54407d9c390a7d413c4b5a (diff)
feat: Implement Task #76 external library size measurement
- Use ma_backend_null for audio (100-200KB savings) - Stub platform/gpu abstractions instead of external APIs - Add DEMO_STRIP_EXTERNAL_LIBS build mode - Create stub_types.h with minimal WebGPU opaque types - Add scripts/measure_size.sh for automated measurement Results: Demo=4.4MB, External=2.0MB (69% vs 31%) handoff(Claude): Task #76 complete. Binary compiles but doesn't run (size measurement only).
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/stub_gpu.cc83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/gpu/stub_gpu.cc b/src/gpu/stub_gpu.cc
new file mode 100644
index 0000000..0b4185c
--- /dev/null
+++ b/src/gpu/stub_gpu.cc
@@ -0,0 +1,83 @@
+// Stub GPU implementation for size measurement builds.
+// All functions are no-ops. Binary compiles but does NOT run.
+// This file is only compiled when STRIP_EXTERNAL_LIBS is defined.
+
+#if defined(STRIP_EXTERNAL_LIBS)
+
+#include "gpu.h"
+#include "platform/stub_types.h"
+
+GpuBuffer gpu_create_buffer(WGPUDevice device, size_t size, uint32_t usage,
+ const void* data) {
+ (void)device;
+ (void)size;
+ (void)usage;
+ (void)data;
+ return {nullptr, 0};
+}
+
+RenderPass gpu_create_render_pass(WGPUDevice device, WGPUTextureFormat format,
+ const char* shader_code,
+ ResourceBinding* bindings, int num_bindings) {
+ (void)device;
+ (void)format;
+ (void)shader_code;
+ (void)bindings;
+ (void)num_bindings;
+ return {nullptr, nullptr, 0, 0};
+}
+
+ComputePass gpu_create_compute_pass(WGPUDevice device, const char* shader_code,
+ ResourceBinding* bindings,
+ int num_bindings) {
+ (void)device;
+ (void)shader_code;
+ (void)bindings;
+ (void)num_bindings;
+ return {nullptr, nullptr, 0, 0, 0};
+}
+
+void gpu_init(PlatformState* platform_state) {
+ (void)platform_state;
+}
+
+void gpu_draw(float audio_peak, float aspect_ratio, float time, float beat) {
+ (void)audio_peak;
+ (void)aspect_ratio;
+ (void)time;
+ (void)beat;
+}
+
+void gpu_resize(int width, int height) {
+ (void)width;
+ (void)height;
+}
+
+void gpu_shutdown() {
+}
+
+const GpuContext* gpu_get_context() {
+ static GpuContext ctx = {nullptr, nullptr, WGPUTextureFormat_BGRA8Unorm};
+ return &ctx;
+}
+
+MainSequence* gpu_get_main_sequence() {
+ return nullptr;
+}
+
+#if !defined(STRIP_ALL)
+void gpu_simulate_until(float time, float bpm) {
+ (void)time;
+ (void)bpm;
+}
+
+void gpu_add_custom_effect(Effect* effect, float start_time, float end_time,
+ int priority) {
+ (void)effect;
+ (void)start_time;
+ (void)end_time;
+ (void)priority;
+}
+#endif
+
+#endif // STRIP_EXTERNAL_LIBS