npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gl-compute

v0.3.1

Published

WebGL Compute Framework

Downloads

14

Readme

gl-compute

WebGL Compute Framework

A compute framework on top of WebGL. Based on some #stack.gl modules. This framework will allow to create custom kernels for each stage of a algorithm intended to run in parallel on the GPU. Stages are defined given the need in a phase of a algorithm of the results of a previous phase. Additionally the full algorithm may then be looped over, providing the last phase results to the first according to your needs. The objective is to have a featured, easy to understand and use framework, following parallel processing conventions is not necessarily the aim of this project (though they may appear here and there). You may also have interest in existing projects that served as inspiration: webclgl / webgl-matrix-demo / three.js - gpgpu flocking.

DEMO


Install

  • npm install gl-compute

  • var glCompute = require('gl-compute') as a module for your projects

  • browserify node_modules/gl-compute/demo/js/index.js -o node_modules/gl-compute/demo/js/bundle.js

as a Demo to try out


Features

  • Plug-in to any project: just tell gl-compute which object contains your data and it's location (objects' attribute)
  • Multiple Data sources: provide a configurable amount of inputs to each phase of your algorithm
  • Input data update: ability to set input data as dirty
  • Automatic uniform glsl code generation: link inputs via gl-compute config and code the kernels not bothering with uniform declaration (reduces code management)
  • Configurable outputs: similarly to inputs plug-in interface
  • Update inplace: output data may be directly written to source input object
  • Output callback: configure your custom function once output data has been written

Todo

  • Improve default Render stage, show all inputs + outputs, dynamically accommodate multiple shapes
  • Improve internal interface, setting inputs / outputs, integrate demo stageSetup() function, variable name consistency
  • Improve usage workflow, still too cumbersome (between testing a shader, verifying available inputs and their naming, and glsl debugging)
  • Provide a more thorough guide on how to use
  • Provide some canned shaders for common pre and post processing tasks (ie. input data 1 component > output data 4 components > output reduction to 1 component)
  • If maturing enough, link up to #stack.gl compute feature requests

Usage

Stage Setup Options

Stages must be fed to gl-compute in the order of computations, a render stage (optional) provided lastly. The computation cycle will pass the results of one stage to the next according to given name (see bellow). The last computation stage will pass it's results back to the first stage as needed (looped algorithms). (Logically, first stage data will be empty in the first pass, no data available from last stage).

var data = {	dataA: inputA, dataAOut: emptyFloats,
		dataB: inputB, dataBOut: emptyFloats,
		dataC: inputC, dataCOut: emptyFloats,
		dataD: inputD, dataDOut: emptyFloats,
		dataROut: emptyUInts
}

Example callback function
var callback = function() { console.log( this.output.object[this.output.location] ) }

var options = {
	type			: Stage Type - 'COMPUTE' (for the actual computations) or
								   'RENDER' (optional for visualization purposes only)

	draw			: Draw Flag - to activate/deactivate this stage on demand
	
	shape			: Stage Shape - These are the dimensions of this stages' output

	shaderSources	: Shader Sources - to use in this stage
					  (create them and don't worry about uniform declaration
					   check uniforms option bellow)

	uniforms		: Stage Inputs - Data input to be fed to gl-compute
	
	{ uniformName :
		{ type: 'sampler2D', object: object, location: string, shape: array, flip: boolean }
		
		These will be made into texture uniforms and fragment shader source
		will be generated and added correspondingly
		  
		Each named property here becomes the uniform name to be made available in the shader
		Both the sampler2D uniform and a ivec2 containing the shape of the input is generated
								  
		GLSL naming conventions apply
		  
		The code generation includes a header and comments for your reference
		(ie. Stage Name and generation/compilation loop)
		Use your browser's shader editor to check the complete GLSL code being compiled

	output			: Stage Output - definitions of the target object where data will be saved
	
		{ write: boolean, object: object, location: string, onUpdated: function }
		
			Write Output Flag - This is where the most performance impact occurs,
			use sparingly when intermediate results are required

			Object Reference
			Attribute name where the data buffer lies
			callback to a function when new data has been writen
}

Inititalise Stages - Provide options as an object, stages will be named here	
compute.preInit( { nameOfStage1: stageOptions1,
				   nameOfStage2: stageOptions2,
				   renderStage: stageRender } )