p3nGu1nZz commited on
Commit
80dd0f2
·
1 Parent(s): 0870851

✨ Moved vertexSize to state for better management

Browse files
Files changed (2) hide show
  1. index.js +1 -3
  2. wgpu-state.js +1 -0
index.js CHANGED
@@ -30,9 +30,7 @@ async function InitializeCanvas(state) {
30
  }
31
 
32
  async function InitializeResources(state) {
33
- const vertexSize = config.floatsPerVertex * 4;
34
-
35
- state.webgpu.pipeline = await createPipeline(state.webgpu.device, state.webgpu.presentationFormat, vertexSize, state.webgpu.shaderCode);
36
 
37
  const glyphCanvas = generateGlyphTextureAtlas(CANVAS, CTX, config);
38
  document.body.appendChild(glyphCanvas);
 
30
  }
31
 
32
  async function InitializeResources(state) {
33
+ state.webgpu.pipeline = await createPipeline(state.webgpu.device, state.webgpu.presentationFormat, state.webgpu.vertexSize, state.webgpu.shaderCode);
 
 
34
 
35
  const glyphCanvas = generateGlyphTextureAtlas(CANVAS, CTX, config);
36
  document.body.appendChild(glyphCanvas);
wgpu-state.js CHANGED
@@ -15,6 +15,7 @@ export function createState(config) {
15
  sampler: null,
16
  bindGroup: null,
17
  shaderCode: null,
 
18
  },
19
  matrices: {
20
  uniformValues: new Float32Array(config.floatsInUniformBuffer),
 
15
  sampler: null,
16
  bindGroup: null,
17
  shaderCode: null,
18
+ vertexSize: config.floatsPerVertex * 4,
19
  },
20
  matrices: {
21
  uniformValues: new Float32Array(config.floatsInUniformBuffer),