mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-17 13:59:30 -07:00
Wrote another utility method for cramming an array of resources into a bind group.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import uniforms from "/lib/gpu-uniforms.js";
|
||||
import { makePassFBO, loadTexture, loadShader, makeUniformBuffer, makePass } from "./utils.js";
|
||||
import { makePassFBO, loadTexture, loadShader, makeUniformBuffer, makeBindGroup, makePass } from "./utils.js";
|
||||
|
||||
const { mat4, vec3 } = glMatrix;
|
||||
|
||||
@@ -123,25 +123,8 @@ export default (context, getInputs) => {
|
||||
},
|
||||
});
|
||||
|
||||
computeBindGroup = device.createBindGroup({
|
||||
layout: computePipeline.getBindGroupLayout(0),
|
||||
entries: [configBuffer, timeBuffer, cellsBuffer]
|
||||
.map((resource) => (resource instanceof GPUBuffer ? { buffer: resource } : resource))
|
||||
.map((resource, binding) => ({
|
||||
binding,
|
||||
resource,
|
||||
})),
|
||||
});
|
||||
|
||||
renderBindGroup = device.createBindGroup({
|
||||
layout: renderPipeline.getBindGroupLayout(0),
|
||||
entries: [configBuffer, timeBuffer, sceneBuffer, linearSampler, msdfTexture.createView(), cellsBuffer]
|
||||
.map((resource) => (resource instanceof GPUBuffer ? { buffer: resource } : resource))
|
||||
.map((resource, binding) => ({
|
||||
binding,
|
||||
resource,
|
||||
})),
|
||||
});
|
||||
computeBindGroup = makeBindGroup(device, computePipeline, 0, [configBuffer, timeBuffer, cellsBuffer]);
|
||||
renderBindGroup = makeBindGroup(device, renderPipeline, 0, [configBuffer, timeBuffer, sceneBuffer, linearSampler, msdfTexture.createView(), cellsBuffer]);
|
||||
})();
|
||||
|
||||
const setSize = (width, height) => {
|
||||
|
||||
Reference in New Issue
Block a user