summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-03-05 22:55:56 +0100
committerskal <pascal.massimino@gmail.com>2026-03-05 22:55:56 +0100
commit34afbd6ca21d2b960573d787e6eae46fa86b200e (patch)
tree08450aeff4c67fb300428e705910265e6cd59943 /tools
parent35c9ebb0a7ce0e726f631a2b04bb26098926cfab (diff)
style: run clang-format to adhere to coding style
Diffstat (limited to 'tools')
-rw-r--r--tools/asset_packer.cc12
-rw-r--r--tools/cnn_test.cc12
-rw-r--r--tools/shadertoy/template.cc2
-rw-r--r--tools/shadertoy/template.h10
-rw-r--r--tools/spectool.cc15
5 files changed, 24 insertions, 27 deletions
diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc
index 0d48906..c982a39 100644
--- a/tools/asset_packer.cc
+++ b/tools/asset_packer.cc
@@ -80,8 +80,8 @@ static bool ParseProceduralParams(const std::string& params_str,
// Helper struct to hold all information about an asset during parsing
struct AssetBuildInfo {
std::string name;
- std::string filename; // Original filename for static assets
- std::string asset_type; // "STATIC", "PROC", "PROC_GPU", "MP3"
+ std::string filename; // Original filename for static assets
+ std::string asset_type; // "STATIC", "PROC", "PROC_GPU", "MP3"
std::string proc_func_name; // Function name string
std::vector<float> proc_params; // Parameters for procedural function
@@ -453,7 +453,8 @@ int main(int argc, char* argv[]) {
} else if (compression_type_str == "MP3") {
info.asset_type = "MP3";
} else if (compression_type_str != "NONE") {
- fprintf(stderr, "Warning: Unknown compression type '%s' for asset: %s\n",
+ fprintf(stderr,
+ "Warning: Unknown compression type '%s' for asset: %s\n",
compression_type_str.c_str(), info.name.c_str());
}
@@ -545,9 +546,8 @@ int main(int argc, char* argv[]) {
fprintf(assets_data_cc_file, " { ");
if (info.asset_type == "PROC" || info.asset_type == "PROC_GPU") {
fprintf(assets_data_cc_file, "nullptr, 0, AssetType::%s, %s, %s, %zu",
- info.asset_type.c_str(),
- info.func_name_str_name.c_str(), info.params_array_name.c_str(),
- info.proc_params.size());
+ info.asset_type.c_str(), info.func_name_str_name.c_str(),
+ info.params_array_name.c_str(), info.proc_params.size());
} else {
fprintf(assets_data_cc_file,
"%s, ASSET_SIZE_%s, AssetType::%s, nullptr, nullptr, 0",
diff --git a/tools/cnn_test.cc b/tools/cnn_test.cc
index 1262021..70f857e 100644
--- a/tools/cnn_test.cc
+++ b/tools/cnn_test.cc
@@ -200,10 +200,8 @@ static WGPUTexture load_texture(WGPUDevice device, WGPUQueue queue,
// Upload to GPU
const WGPUTexelCopyTextureInfo dst = {.texture = texture, .mipLevel = 0};
const WGPUTexelCopyBufferLayout layout = {
- .bytesPerRow = (uint32_t)(width * 4),
- .rowsPerImage = (uint32_t)(height)};
- const WGPUExtent3D size = {(uint32_t)(width),
- (uint32_t)(height), 1};
+ .bytesPerRow = (uint32_t)(width * 4), .rowsPerImage = (uint32_t)(height)};
+ const WGPUExtent3D size = {(uint32_t)(width), (uint32_t)(height), 1};
wgpuQueueWriteTexture(queue, &dst, bgra_data.data(), bgra_data.size(),
&layout, &size);
@@ -255,8 +253,7 @@ static WGPUTexture load_depth_from_alpha(WGPUDevice device, WGPUQueue queue,
const WGPUTexelCopyBufferLayout layout = {
.bytesPerRow = (uint32_t)(width * sizeof(float)),
.rowsPerImage = (uint32_t)(height)};
- const WGPUExtent3D size = {(uint32_t)(width),
- (uint32_t)(height), 1};
+ const WGPUExtent3D size = {(uint32_t)(width), (uint32_t)(height), 1};
wgpuQueueWriteTexture(queue, &dst, depth_data.data(),
depth_data.size() * sizeof(float), &layout, &size);
@@ -474,8 +471,7 @@ readback_rgba32uint_to_bgra8(WGPUDevice device, WGPUQueue queue,
dst.layout.bytesPerRow = padded_bytes_per_row;
dst.layout.rowsPerImage = height;
- WGPUExtent3D copy_size = {(uint32_t)(width),
- (uint32_t)(height), 1};
+ WGPUExtent3D copy_size = {(uint32_t)(width), (uint32_t)(height), 1};
wgpuCommandEncoderCopyTextureToBuffer(encoder, &src, &dst, &copy_size);
diff --git a/tools/shadertoy/template.cc b/tools/shadertoy/template.cc
index 81c39ba..bcaea3b 100644
--- a/tools/shadertoy/template.cc
+++ b/tools/shadertoy/template.cc
@@ -2,8 +2,8 @@
// ShaderToy effect implementation - REPLACE THIS LINE
// TODO: Update description, rename class
-#include "effects/shadertoy_effect.h"
#include "effects/shaders.h"
+#include "effects/shadertoy_effect.h"
#include "gpu/gpu.h"
#include "gpu/post_process_helper.h"
#include "util/fatal_error.h"
diff --git a/tools/shadertoy/template.h b/tools/shadertoy/template.h
index 5f105d5..c8d132a 100644
--- a/tools/shadertoy/template.h
+++ b/tools/shadertoy/template.h
@@ -11,13 +11,11 @@
class ShaderToyEffect : public Effect {
public:
// TODO: Rename class, keep same constructor signature
- ShaderToyEffect(const GpuContext& ctx,
- const std::vector<std::string>& inputs,
- const std::vector<std::string>& outputs,
- float start_time, float end_time);
+ ShaderToyEffect(const GpuContext& ctx, const std::vector<std::string>& inputs,
+ const std::vector<std::string>& outputs, float start_time,
+ float end_time);
- void render(WGPUCommandEncoder encoder,
- const UniformsSequenceParams& params,
+ void render(WGPUCommandEncoder encoder, const UniformsSequenceParams& params,
NodeRegistry& nodes) override;
private:
diff --git a/tools/spectool.cc b/tools/spectool.cc
index 93f8f9a..0728ed8 100644
--- a/tools/spectool.cc
+++ b/tools/spectool.cc
@@ -3,8 +3,8 @@
// Provides both 'analyze' and 'play' modes for spectral data.
#include "audio/audio.h"
-#include "audio/ola.h"
#include "audio/gen.h"
+#include "audio/ola.h"
#include "audio/synth.h"
#include "platform/platform.h"
#include <stdio.h>
@@ -184,7 +184,8 @@ int analyze_audio(const char* in_path, const char* out_path, bool normalize,
return 0;
}
-static void write_wav_header(FILE* f, uint32_t num_samples, uint32_t sample_rate) {
+static void write_wav_header(FILE* f, uint32_t num_samples,
+ uint32_t sample_rate) {
const uint16_t num_channels = 1;
const uint16_t bits_per_sample = 16;
const uint32_t data_size = num_samples * num_channels * (bits_per_sample / 8);
@@ -259,15 +260,17 @@ int decode_to_wav(const char* in_path, const char* out_path) {
for (uint32_t i = 0; i < out_samples; ++i) {
float s = pcm[i];
- if (s > 1.0f) s = 1.0f;
- if (s < -1.0f) s = -1.0f;
+ if (s > 1.0f)
+ s = 1.0f;
+ if (s < -1.0f)
+ s = -1.0f;
int16_t sample = (int16_t)(s * 32767.0f);
fwrite(&sample, sizeof(int16_t), 1, f_out);
}
fclose(f_out);
- printf("Decoded %d frames (%u samples) at %u Hz.\n",
- header.num_frames, out_samples, sample_rate);
+ printf("Decoded %d frames (%u samples) at %u Hz.\n", header.num_frames,
+ out_samples, sample_rate);
return 0;
}