p3nGu1nZz commited on
Commit
57af44f
1 Parent(s): c3695de
Files changed (1) hide show
  1. index.html +26 -6
index.html CHANGED
@@ -165,12 +165,16 @@
165
 
166
  const { vertexData, numGlyphs, width, height } = generateGlyphVerticesForText(
167
  'Hello\nworld!\nText in\nWebGPU!', [
168
- [1, 1, 0, 1], [0, 1, 1, 1], [1, 0, 1, 1], [1, 0, 0, 1], [0, .5, 1, 1],
 
 
 
 
169
  ]);
170
  device.queue.writeBuffer(vertexBuffer, 0, vertexData);
171
 
172
  const pipeline = device.createRenderPipeline({
173
- label: 'textured quad pipeline',
174
  layout: 'auto',
175
  vertex: {
176
  module,
@@ -179,9 +183,9 @@
179
  {
180
  arrayStride: vertexSize,
181
  attributes: [
182
- { shaderLocation: 0, offset: 0, format: 'float32x2' }, // position
183
- { shaderLocation: 1, offset: 8, format: 'float32x2' }, // texcoord
184
- { shaderLocation: 2, offset: 16, format: 'float32x4' } // color
185
  ],
186
  },
187
  ],
@@ -189,7 +193,23 @@
189
  fragment: {
190
  module,
191
  entryPoint: 'fs',
192
- targets: [{ format: presentationFormat }],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  },
194
  });
195
 
 
165
 
166
  const { vertexData, numGlyphs, width, height } = generateGlyphVerticesForText(
167
  'Hello\nworld!\nText in\nWebGPU!', [
168
+ [1, 1, 0, 1],
169
+ [0, 1, 1, 1],
170
+ [1, 0, 1, 1],
171
+ [1, 0, 0, 1],
172
+ [0, .5, 1, 1],
173
  ]);
174
  device.queue.writeBuffer(vertexBuffer, 0, vertexData);
175
 
176
  const pipeline = device.createRenderPipeline({
177
+ label: 'hardcoded textured quad pipeline',
178
  layout: 'auto',
179
  vertex: {
180
  module,
 
183
  {
184
  arrayStride: vertexSize,
185
  attributes: [
186
+ { shaderLocation: 0, offset: 0, format: 'float32x2' }, // position
187
+ { shaderLocation: 1, offset: 8, format: 'float32x2' }, // texcoord
188
+ { shaderLocation: 2, offset: 16, format: 'float32x4' }, // color
189
  ],
190
  },
191
  ],
 
193
  fragment: {
194
  module,
195
  entryPoint: 'fs',
196
+ targets: [
197
+ {
198
+ format: presentationFormat,
199
+ blend: {
200
+ color: {
201
+ srcFactor: 'one',
202
+ dstFactor: 'one-minus-src-alpha',
203
+ operation: 'add',
204
+ },
205
+ alpha: {
206
+ srcFactor: 'one',
207
+ dstFactor: 'one-minus-src-alpha',
208
+ operation: 'add',
209
+ },
210
+ },
211
+ },
212
+ ],
213
  },
214
  });
215