summaryrefslogtreecommitdiff
path: root/src/gpu/gpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gpu.h')
-rw-r--r--src/gpu/gpu.h38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h
index 062b822..8814cbc 100644
--- a/src/gpu/gpu.h
+++ b/src/gpu/gpu.h
@@ -16,9 +16,13 @@
#include <webgpu/wgpu.h>
-static inline const char *str_view(const char *str) { return str; }
+static inline const char* str_view(const char* str) {
+ return str;
+}
-static inline const char *label_view(const char *str) { return str; }
+static inline const char* label_view(const char* str) {
+ return str;
+}
#define WGPUSType_ShaderSourceWGSL WGPUSType_ShaderModuleWGSLDescriptor
@@ -40,17 +44,19 @@ using WGPUShaderSourceWGSL = WGPUShaderModuleWGSLDescriptor;
#include <wgpu.h>
-static inline WGPUStringView str_view(const char *str) {
- if (!str) return {nullptr, 0};
+static inline WGPUStringView str_view(const char* str) {
+ if (!str)
+ return {nullptr, 0};
return {str, strlen(str)};
}
-static inline WGPUStringView label_view(const char *str) {
+static inline WGPUStringView label_view(const char* str) {
-#ifndef STRIP_ALL
+#if !defined(STRIP_ALL)
- if (!str) return {nullptr, 0};
+ if (!str)
+ return {nullptr, 0};
return {str, strlen(str)};
@@ -60,10 +66,10 @@ static inline WGPUStringView label_view(const char *str) {
return {nullptr, 0};
-#endif
+#endif /* !defined(STRIP_ALL) */
}
-#endif
+#endif /* defined(DEMO_CROSS_COMPILE_WIN32) */
struct GLFWwindow;
@@ -90,11 +96,11 @@ struct RenderPass {
uint32_t instance_count;
};
-void gpu_init(GLFWwindow *window, int width, int height);
+void gpu_init(GLFWwindow* window, int width, int height);
void gpu_draw(float audio_peak, float aspect_ratio, float time, float beat);
-#ifndef STRIP_ALL
+#if !defined(STRIP_ALL)
void gpu_simulate_until(float time);
-#endif
+#endif /* !defined(STRIP_ALL) */
void gpu_shutdown();
// Helper functions (exposed for internal/future use)
@@ -105,12 +111,12 @@ struct ResourceBinding {
};
GpuBuffer gpu_create_buffer(WGPUDevice device, size_t size, uint32_t usage,
- const void *data = nullptr);
-ComputePass gpu_create_compute_pass(WGPUDevice device, const char *shader_code,
- ResourceBinding *bindings,
+ const void* data = nullptr);
+ComputePass gpu_create_compute_pass(WGPUDevice device, const char* shader_code,
+ ResourceBinding* bindings,
int num_bindings);
RenderPass
gpu_create_render_pass(WGPUDevice device,
WGPUTextureFormat format, // Needed for render pipeline
- const char *shader_code, ResourceBinding *bindings,
+ const char* shader_code, ResourceBinding* bindings,
int num_bindings);