function generateUniformsFromContext(context, variables) {
  /** @type {Object<string,import("../../webgl/Helper").UniformValue>} */
  const uniforms = {};

  // define one uniform per variable
  for (const varName in context.variables) {
    const variable = context.variables[varName];
    const uniformName = uniformNameForVariable(variable.name);

    uniforms[uniformName] = () => {
      const value = variables[variable.name];
      if (typeof value === 'number') {
        return value;
      }
      if (typeof value === 'boolean') {
        return value ? 1 : 0;
      }
      if (variable.type === ColorType) {
        const color = [...asArray(value || '#eee')];
        color[0] /= 255;
        color[1] /= 255;
        color[2] /= 255;
        color[3] ??= 1;
        return color;
      }
      if (typeof value === 'string') {
        return getStringNumberEquivalent(value);
      }
      return value;
    };
  }

  return uniforms;
}
Generates a set of uniforms from variables collected in a compilation context,
to be fed to a WebGLHelper instance
@param {import("../../expr/gpu.js").CompilationContext} context Compilation context
@param {import('../../style/flat.js').StyleVariables} [variables] Style variables.
@return {Object<string,import("../../webgl/Helper").UniformValue>} Uniforms