UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

16 lines (13 loc) 561 B
import { BUFFERUSAGE_INDEX, BUFFERUSAGE_STORAGE, INDEXFORMAT_UINT16 } from '../constants.js'; import { WebgpuBuffer } from './webgpu-buffer.js'; class WebgpuIndexBuffer extends WebgpuBuffer { unlock(indexBuffer) { const device = indexBuffer.device; super.unlock(device, indexBuffer.storage); } constructor(indexBuffer, options){ super(BUFFERUSAGE_INDEX | (options?.storage ? BUFFERUSAGE_STORAGE : 0)), this.format = null; this.format = indexBuffer.format === INDEXFORMAT_UINT16 ? 'uint16' : 'uint32'; } } export { WebgpuIndexBuffer };