Skip to content

Instantly share code, notes, and snippets.

@robertleeplummerjr
Created March 26, 2019 17:16
Show Gist options
  • Save robertleeplummerjr/b97f94db6f94d05d596d2cdc8d8ba297 to your computer and use it in GitHub Desktop.
Save robertleeplummerjr/b97f94db6f94d05d596d2cdc8d8ba297 to your computer and use it in GitHub Desktop.
let chunkSize = 15;
let inputWidth = 25;
let image.dims = {
w: 1920,
h: 1080
}
const myFunc = gpu.createKernel(
function(imageTexture, offsetY, offsetX) {
return imageTexture[this.thread.y + offsetY][this.thread.x + offsetX];
},
{ output: [inputWidth, inputWidth] }
);
const chunks = [];
const imageTexture = new GPU.Texture(); // pseudo code, needs some inputs values
for (let yChunk = 0; yChunk < yChunks; yChunk++) {
for (let xChunk = 0; xChunk < xChunks; xChunk++) {
chunks.push({
yChunk,
xChunk,
networkOutput: network.run(
myFunc(
imageTexture,
yChunk * inputWidth,
xChunk * inputWidth
)
).toArray()
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment