summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-28 02:39:04 +0100
committerskal <pascal.massimino@gmail.com>2026-02-28 02:39:04 +0100
commit472c2258dbeca000a454ea1781f09df63477563e (patch)
tree98ac75c3824f19f4a598a807b3cb6aa13e8cb0c3 /src
parent1c5a9fb7b8c704a59ec58894adf46d73d1615072 (diff)
replace wgsl type: vec4<f32> -> vec4f ..
Diffstat (limited to 'src')
-rw-r--r--src/effects/peak_meter_effect.cc18
-rw-r--r--src/tests/gpu/test_noise_functions.cc22
-rw-r--r--src/tests/gpu/test_post_process_helper.cc18
-rw-r--r--src/tests/gpu/test_shader_composer.cc2
4 files changed, 30 insertions, 30 deletions
diff --git a/src/effects/peak_meter_effect.cc b/src/effects/peak_meter_effect.cc
index 27adba4..2a7b7f9 100644
--- a/src/effects/peak_meter_effect.cc
+++ b/src/effects/peak_meter_effect.cc
@@ -14,8 +14,8 @@ PeakMeter::PeakMeter(const GpuContext& ctx,
const char* shader_main = R"(
struct VertexOutput {
- @builtin(position) position: vec4<f32>,
- @location(0) uv: vec2<f32>,
+ @builtin(position) position: vec4f,
+ @location(0) uv: vec2f,
};
@group(0) @binding(0) var inputSampler: sampler;
@@ -25,18 +25,18 @@ PeakMeter::PeakMeter(const GpuContext& ctx,
@vertex
fn vs_main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {
var output: VertexOutput;
- var pos = array<vec2<f32>, 3>(
- vec2<f32>(-1.0, -1.0),
- vec2<f32>(3.0, -1.0),
- vec2<f32>(-1.0, 3.0)
+ var pos = array<vec2f, 3>(
+ vec2f(-1.0, -1.0),
+ vec2f(3.0, -1.0),
+ vec2f(-1.0, 3.0)
);
- output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
+ output.position = vec4f(pos[vertexIndex], 0.0, 1.0);
output.uv = pos[vertexIndex] * 0.5 + 0.5;
return output;
}
@fragment
- fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
+ fn fs_main(input: VertexOutput) -> @location(0) vec4f {
let bar_y_min = 0.005;
let bar_y_max = 0.015;
let bar_x_min = 0.015;
@@ -47,7 +47,7 @@ PeakMeter::PeakMeter(const GpuContext& ctx,
if (in_bar_y && in_bar_x) {
let uv_x = (input.uv.x - bar_x_min) / (bar_x_max - bar_x_min);
let factor = step(uv_x, uniforms.audio_intensity);
- return mix(vec4<f32>(0.0, 0.0, 0.0, 1.0), vec4<f32>(1.0, 0.0, 0.0, 1.0), factor);
+ return mix(vec4f(0.0, 0.0, 0.0, 1.0), vec4f(1.0, 0.0, 0.0, 1.0), factor);
}
return textureSample(inputTexture, inputSampler, input.uv);
diff --git a/src/tests/gpu/test_noise_functions.cc b/src/tests/gpu/test_noise_functions.cc
index d96a982..3c6cc52 100644
--- a/src/tests/gpu/test_noise_functions.cc
+++ b/src/tests/gpu/test_noise_functions.cc
@@ -21,16 +21,16 @@ static bool test_noise_shader_loading() {
// Check for key function signatures
const char* expected_funcs[] = {
"fn hash_1f(x: f32) -> f32",
- "fn hash_2f(p: vec2<f32>) -> f32",
- "fn hash_3f(p: vec3<f32>) -> f32",
- "fn hash_2f_2f(p: vec2<f32>) -> vec2<f32>",
- "fn hash_3f_3f(p: vec3<f32>) -> vec3<f32>",
+ "fn hash_2f(p: vec2f) -> f32",
+ "fn hash_3f(p: vec3f) -> f32",
+ "fn hash_2f_2f(p: vec2f) -> vec2f",
+ "fn hash_3f_3f(p: vec3f) -> vec3f",
"fn hash_1u(p: u32) -> f32",
- "fn noise_2d(p: vec2<f32>) -> f32",
- "fn noise_3d(p: vec3<f32>) -> f32",
- "fn gyroid(p: vec3<f32>) -> f32",
- "fn fbm_2d(p: vec2<f32>, octaves: i32) -> f32",
- "fn fbm_3d(p: vec3<f32>, octaves: i32) -> f32",
+ "fn noise_2d(p: vec2f) -> f32",
+ "fn noise_3d(p: vec3f) -> f32",
+ "fn gyroid(p: vec3f) -> f32",
+ "fn fbm_2d(p: vec2f, octaves: i32) -> f32",
+ "fn fbm_3d(p: vec3f, octaves: i32) -> f32",
};
int func_count = sizeof(expected_funcs) / sizeof(expected_funcs[0]);
@@ -63,11 +63,11 @@ static bool test_noise_composition() {
#include "math/noise"
@fragment
- fn fs_main(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
+ fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
let h = hash_2f(uv);
let n = noise_2d(uv * 4.0);
let fbm = fbm_2d(uv * 2.0, 3);
- return vec4<f32>(fbm, fbm, fbm, 1.0);
+ return vec4f(fbm, fbm, fbm, 1.0);
}
)";
diff --git a/src/tests/gpu/test_post_process_helper.cc b/src/tests/gpu/test_post_process_helper.cc
index 80d7ad4..df0a6ab 100644
--- a/src/tests/gpu/test_post_process_helper.cc
+++ b/src/tests/gpu/test_post_process_helper.cc
@@ -24,20 +24,20 @@ extern void pp_update_bind_group(WGPUDevice device, WGPURenderPipeline pipeline,
// Minimal valid post-process shader for testing
static const char* test_shader = R"(
@vertex
-fn vs_main(@builtin(vertex_index) vid: u32) -> @builtin(position) vec4<f32> {
+fn vs_main(@builtin(vertex_index) vid: u32) -> @builtin(position) vec4f {
let x = f32((vid & 1u) << 1u) - 1.0;
let y = f32((vid & 2u) >> 0u) - 1.0;
- return vec4<f32>(x, y, 0.0, 1.0);
+ return vec4f(x, y, 0.0, 1.0);
}
@group(0) @binding(0) var input_sampler: sampler;
@group(0) @binding(1) var input_texture: texture_2d<f32>;
-@group(0) @binding(2) var<uniform> uniforms: vec4<f32>;
-@group(0) @binding(3) var<uniform> effect_params: vec4<f32>; // Dummy for testing
+@group(0) @binding(2) var<uniform> uniforms: vec4f;
+@group(0) @binding(3) var<uniform> effect_params: vec4f; // Dummy for testing
@fragment
-fn fs_main(@builtin(position) pos: vec4<f32>) -> @location(0) vec4<f32> {
- let uv = pos.xy / vec2<f32>(256.0, 256.0);
+fn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f {
+ let uv = pos.xy / vec2f(256.0, 256.0);
return textureSample(input_texture, input_sampler, uv);
}
)";
@@ -75,7 +75,7 @@ static void test_bind_group_creation(WebGPUTestFixture& fixture) {
fixture.device(), 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
assert(uniforms.buffer != nullptr && "Uniform buffer should be created");
- // Dummy effect params buffer for testing (matches vec4<f32>)
+ // Dummy effect params buffer for testing (matches vec4f)
GpuBuffer dummy_effect_params_buffer = gpu_create_buffer(
fixture.device(), 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
@@ -112,7 +112,7 @@ static void test_bind_group_update(WebGPUTestFixture& fixture) {
GpuBuffer uniforms = gpu_create_buffer(
fixture.device(), 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
- // Dummy effect params buffer for testing (matches vec4<f32>)
+ // Dummy effect params buffer for testing (matches vec4f)
GpuBuffer dummy_effect_params_buffer = gpu_create_buffer(
fixture.device(), 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
@@ -161,7 +161,7 @@ static void test_full_setup(WebGPUTestFixture& fixture) {
GpuBuffer uniforms = gpu_create_buffer(
fixture.device(), 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
- // Dummy effect params buffer for testing (matches vec4<f32>)
+ // Dummy effect params buffer for testing (matches vec4f)
GpuBuffer dummy_effect_params_buffer = gpu_create_buffer(
fixture.device(), 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
diff --git a/src/tests/gpu/test_shader_composer.cc b/src/tests/gpu/test_shader_composer.cc
index a23d6fa..4002863 100644
--- a/src/tests/gpu/test_shader_composer.cc
+++ b/src/tests/gpu/test_shader_composer.cc
@@ -109,7 +109,7 @@ void test_renderer_composition() {
auto& sc = ShaderComposer::Get();
sc.RegisterSnippet("common_uniforms",
- "struct GlobalUniforms { view_proj: mat4x4<f32> };");
+ "struct GlobalUniforms { view_proj: mat4x4f };");
sc.RegisterSnippet("math/sdf_shapes", "fn sdSphere() {}");
sc.RegisterSnippet("render/scene_query",
"#include \"math/sdf_shapes\"\nfn map_scene() {}");