Skip to content

Instantly share code, notes, and snippets.

@jt0dd
Created September 3, 2018 13:39
Show Gist options
  • Select an option

  • Save jt0dd/62bf241758ffc75365b402e1d2ee1c31 to your computer and use it in GitHub Desktop.

Select an option

Save jt0dd/62bf241758ffc75365b402e1d2ee1c31 to your computer and use it in GitHub Desktop.
const gpu1 = new GPU();
const createTexture = gpu1.createKernel(function() {
return 55;
}).setOutput([4, 100, 100]).setOutputToTexture(true);
console.time('texture');
const texture1 = createTexture();
const texture2 = createTexture();
const texture3 = createTexture();
const useTexture = gpu1.createKernel(function() {
var index = 0;
return this.constants.textures[index][0];
}, {
constants : {
textures : [texture1, texture2, texture3]
}
}).setOutput([4, 100, 100]);
const result = useTexture();
console.timeEnd('texture');
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment