UNPKG

wgsl-plus

Version:

A WGSL preprocessor, prettifier, minifier, obfuscator, and compiler with C-style macros, conditional compilation, file linking, and multi-format output for WebGPU shaders.

25 lines (24 loc) 841 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Function to generate all swizzle combinations function generateSwizzles() { const components = ["x", "y", "z", "w", "r", "g", "b", "a"]; const swizzles = new Set(); // Generate swizzles of length 1 to 4 for (let length = 1; length <= 4; length++) { generateCombinations(components, length, "", swizzles); } return swizzles; } // Helper function to generate combinations recursively function generateCombinations(components, length, prefix, result) { if (prefix.length === length) { result.add(prefix); return; } for (const component of components) { generateCombinations(components, length, prefix + component, result); } } const swizzles = generateSwizzles(); exports.default = swizzles;