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 --- common/shaders/passthrough.wgsl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 common/shaders/passthrough.wgsl (limited to 'common/shaders/passthrough.wgsl') diff --git a/common/shaders/passthrough.wgsl b/common/shaders/passthrough.wgsl new file mode 100644 index 0000000..266e231 --- /dev/null +++ b/common/shaders/passthrough.wgsl @@ -0,0 +1,18 @@ +@group(0) @binding(0) var smplr: sampler; +@group(0) @binding(1) var txt: texture_2d; + +#include "common_uniforms" +@group(0) @binding(2) var uniforms: CommonUniforms; + +@vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4 { + var pos = array, 3>( + vec2(-1, -1), + vec2(3, -1), + vec2(-1, 3) + ); + return vec4(pos[i], 0.0, 1.0); +} + +@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { + return textureSample(txt, smplr, p.xy / uniforms.resolution); +} -- cgit v1.2.3