| 14 | } |
| 15 | |
| 16 | export class StreamCompactIDs |
| 17 | { |
| 18 | #device: GPUDevice; |
| 19 | |
| 20 | // Should be at least 64 so that we process elements |
| 21 | // in 256b blocks with each WG. This will ensure that our |
| 22 | // dynamic offsets meet the 256b alignment requirement |
| 23 | readonly WORKGROUP_SIZE: number = 64; |
| 24 | |
| 25 | readonly #maxDispatchSize: number; |
| 26 | |
| 27 | #computePipeline: GPUComputePipeline; |
| 28 | |
| 29 | private constructor(device: GPUDevice) |
| 30 | { |
| 31 | this.#device = device; |
| 32 | |
| 33 | this.#maxDispatchSize = device.limits.maxComputeWorkgroupsPerDimension; |
| 34 | } |
| 35 | |
| 36 | static async create(device: GPUDevice) |
| 37 | { |
| 38 | let self = new StreamCompactIDs(device); |
| 39 | |
| 40 | let paramsBGLayout = device.createBindGroupLayout({ |
| 41 | entries: [ |
| 42 | { |
| 43 | binding: 0, |
| 44 | visibility: GPUShaderStage.COMPUTE, |
| 45 | buffer: { |
| 46 | type: "storage", |
| 47 | hasDynamicOffset: true, |
| 48 | } |
| 49 | }, |
| 50 | { |
| 51 | binding: 1, |
| 52 | visibility: GPUShaderStage.COMPUTE, |
| 53 | buffer: { |
| 54 | type: "storage", |
| 55 | hasDynamicOffset: true, |
| 56 | } |
| 57 | }, |
| 58 | { |
| 59 | binding: 2, |
| 60 | visibility: GPUShaderStage.COMPUTE, |
| 61 | buffer: { |
| 62 | type: "storage", |
| 63 | } |
| 64 | }, |
| 65 | ], |
| 66 | }); |
| 67 | |
| 68 | let pushConstantsBGLayout = device.createBindGroupLayout({ |
| 69 | entries: [ |
| 70 | { |
| 71 | binding: 0, |
| 72 | visibility: GPUShaderStage.COMPUTE, |
| 73 | buffer: {type: "uniform", hasDynamicOffset: true} |
nothing calls this directly
no outgoing calls
no test coverage detected