mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
22 lines
433 B
JavaScript
22 lines
433 B
JavaScript
const gpu = new GPU();
|
|
const createTexture = gpu
|
|
.createKernel(function() {
|
|
return 255;
|
|
})
|
|
.setOutput([512])
|
|
.setOutputToTexture(true);
|
|
const texture = createTexture();
|
|
console.log(texture);
|
|
const useTexture = gpu
|
|
.createKernel(
|
|
function() {
|
|
return this.constants.texture[this.thread.x];
|
|
},
|
|
{
|
|
constants: { texture }
|
|
}
|
|
)
|
|
.setOutput([512]);
|
|
const proof = useTexture();
|
|
console.log(proof);
|