Add parallel shader compiling
This commit is contained in:
parent
a6efbc02b9
commit
39a6ee9a20
17 changed files with 209 additions and 77 deletions
|
|
@ -36,6 +36,8 @@ export class WebGl2Renderer implements IRenderer {
|
|||
private lightingPass: RenderingPass;
|
||||
private autoscaler: FpsAutoscaler;
|
||||
|
||||
private initializePromise: Promise<[void, void]> = null;
|
||||
|
||||
private matrices: {
|
||||
distanceScreenToWorld?: mat2d;
|
||||
worldToDistanceUV?: mat2d;
|
||||
|
|
@ -63,6 +65,11 @@ export class WebGl2Renderer implements IRenderer {
|
|||
this.lightingFrameBuffer
|
||||
);
|
||||
|
||||
this.initializePromise = Promise.all([
|
||||
this.distancePass.initialize(),
|
||||
this.lightingPass.initialize(),
|
||||
]);
|
||||
|
||||
this.autoscaler = new FpsAutoscaler([
|
||||
this.lightingFrameBuffer,
|
||||
this.distanceFieldFrameBuffer,
|
||||
|
|
@ -75,6 +82,10 @@ export class WebGl2Renderer implements IRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
public async initialize(): Promise<void> {
|
||||
await this.initializePromise;
|
||||
}
|
||||
|
||||
public drawShape(shape: IDrawable) {
|
||||
this.distancePass.addDrawable(shape);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue