From a109983c194c45ad85f0e481232bc605c7cfd85b Mon Sep 17 00:00:00 2001 From: skal Date: Fri, 13 Feb 2026 08:34:24 +0100 Subject: Remediation: Implement shared common/shaders/ directory Eliminates 36 duplicate shader files across workspaces. Structure: - common/shaders/{math,render,compute}/ - Shared utilities (20 files) - workspaces/*/shaders/ - Workspace-specific only Changes: - Created common/shaders/ with math, render, compute subdirectories - Moved 20 common shaders from workspaces to common/ - Removed duplicates from test workspace - Updated assets.txt: ../../common/shaders/ references - Enhanced asset_packer.cc: filesystem path normalization for ../ resolution Implementation: Option 1 from SHADER_REUSE_INVESTIGATION.md - Single source of truth for common code - Workspace references via relative paths - Path normalization in asset packer handoff(Claude): Common shader directory implemented --- workspaces/main/shaders/compute/gen_perlin.wgsl | 44 ------------------------- 1 file changed, 44 deletions(-) delete mode 100644 workspaces/main/shaders/compute/gen_perlin.wgsl (limited to 'workspaces/main/shaders/compute/gen_perlin.wgsl') diff --git a/workspaces/main/shaders/compute/gen_perlin.wgsl b/workspaces/main/shaders/compute/gen_perlin.wgsl deleted file mode 100644 index 73816d6..0000000 --- a/workspaces/main/shaders/compute/gen_perlin.wgsl +++ /dev/null @@ -1,44 +0,0 @@ -// GPU procedural Perlin noise texture generator. -// Fractional Brownian Motion using value noise. - -#include "math/noise" - -struct PerlinParams { - width: u32, - height: u32, - seed: f32, - frequency: f32, - amplitude: f32, - amplitude_decay: f32, - octaves: u32, - _pad0: f32, // Padding for alignment -} - -@group(0) @binding(0) var output_tex: texture_storage_2d; -@group(0) @binding(1) var params: PerlinParams; - -@compute @workgroup_size(8, 8, 1) -fn main(@builtin(global_invocation_id) id: vec3) { - if (id.x >= params.width || id.y >= params.height) { return; } - - let uv = vec2(f32(id.x) / f32(params.width), - f32(id.y) / f32(params.height)); - - var value = 0.0; - var amplitude = params.amplitude; - var frequency = params.frequency; - var total_amp = 0.0; - - for (var o: u32 = 0u; o < params.octaves; o++) { - let p = uv * frequency + params.seed; - value += noise_2d(p) * amplitude; - total_amp += amplitude; - frequency *= 2.0; - amplitude *= params.amplitude_decay; - } - - value /= total_amp; - let clamped = clamp(value, 0.0, 1.0); - - textureStore(output_tex, id.xy, vec4(clamped, clamped, clamped, 1.0)); -} -- cgit v1.2.3