plasma-arc / wgpu-state.js
p3nGu1nZz's picture
🥒 Rendering so fresh, it's zucchini crisp!
41fe030
raw
history blame
1.09 kB
export function createState(config) {
return {
webgpu: {
device: null,
pipeline: null,
vertexBuffer: null,
indexBuffer: null,
uniformBuffer: null,
texture: null,
sampler: null,
bindGroup: null,
context: null,
presentationFormat: null,
shaderCode: null,
},
matrices: {
uniformValues: new Float32Array(config.floatsInUniformBuffer),
matrix: new Float32Array(config.matrixSize),
},
glyphs: {
numGlyphs: 0,
width: 0,
height: 0,
},
canvas: document.querySelector('canvas') || document.body.appendChild(document.createElement('canvas')),
timing: {
time: 0,
fixedDeltaTime: 0,
maxFrameTime: 0,
targetFps: 0,
frameDuration: 0,
accumulator: 0,
deltaTime: 0,
currentTime: 0,
frameTime: 0,
lastTime: 0,
}
};
}