MCPcopy Index your code
hub / github.com/processing/p5.js / _getVertexLayout

Method _getVertexLayout

src/webgpu/p5.RendererWebGPU.js:1248–1278  ·  view source on GitHub ↗
(shader)

Source from the content-addressed store, hash-verified

1246 _applyColorBlend() {}
1247
1248 _getVertexLayout(shader) {
1249 const layouts = [];
1250
1251 for (const attrName in shader.attributes) {
1252 const attr = shader.attributes[attrName];
1253 if (!attr || attr.location === -1) continue;
1254 // Get the vertex buffer info associated with this attribute
1255 const renderBuffer =
1256 this.buffers[shader.shaderType].find(buf => buf.attr === attrName) ||
1257 this.buffers.user.find(buf => buf.attr === attrName);
1258 if (!renderBuffer) continue;
1259
1260 const { size } = renderBuffer;
1261 // Convert from the number of floats (e.g. 3) to a recognized WebGPU
1262 // format (e.g. "float32x3")
1263 const format = this._getFormatFromSize(size);
1264
1265 layouts.push({
1266 arrayStride: size * 4,
1267 stepMode: 'vertex',
1268 attributes: [
1269 {
1270 shaderLocation: attr.location,
1271 offset: 0,
1272 format,
1273 },
1274 ],
1275 });
1276 }
1277 return layouts;
1278 }
1279
1280 _getVertexBuffers(shader) {
1281 if (!shader._vertexBuffers) {

Callers 1

_initShaderMethod · 0.95

Calls 2

_getFormatFromSizeMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected