Skip to content

Commit

Permalink
Fix babylon native sprites (#12819)
Browse files Browse the repository at this point in the history
* fix native sprites

* Babylon Native Sprites
  • Loading branch information
sebavan committed Aug 1, 2022
1 parent 266c693 commit 722457d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/dev/core/src/Engines/engineFeatures.ts
Expand Up @@ -66,6 +66,9 @@ export interface EngineFeatures {
/** Indicates that the engine supports render passes */
supportRenderPasses: boolean;

/** Indicates that the engine supports sprite instancing */
supportSpriteInstancing: boolean;

/** @hidden */
_collectUbosUpdatedInFrame: boolean;
}
1 change: 1 addition & 0 deletions packages/dev/core/src/Engines/nativeEngine.ts
Expand Up @@ -927,6 +927,7 @@ export class NativeEngine extends Engine {
needShaderCodeInlining: true,
needToAlwaysBindUniformBuffers: false,
supportRenderPasses: true,
supportSpriteInstancing: false,
_collectUbosUpdatedInFrame: false,
};

Expand Down
1 change: 1 addition & 0 deletions packages/dev/core/src/Engines/nullEngine.ts
Expand Up @@ -178,6 +178,7 @@ export class NullEngine extends Engine {
needShaderCodeInlining: false,
needToAlwaysBindUniformBuffers: false,
supportRenderPasses: true,
supportSpriteInstancing: false,
_collectUbosUpdatedInFrame: false,
};

Expand Down
1 change: 1 addition & 0 deletions packages/dev/core/src/Engines/thinEngine.ts
Expand Up @@ -1399,6 +1399,7 @@ export class ThinEngine {
needShaderCodeInlining: false,
needToAlwaysBindUniformBuffers: false,
supportRenderPasses: false,
supportSpriteInstancing: true,
_collectUbosUpdatedInFrame: false,
};
}
Expand Down
1 change: 1 addition & 0 deletions packages/dev/core/src/Engines/webgpuEngine.ts
Expand Up @@ -838,6 +838,7 @@ export class WebGPUEngine extends Engine {
needShaderCodeInlining: true,
needToAlwaysBindUniformBuffers: true,
supportRenderPasses: true,
supportSpriteInstancing: true,
_collectUbosUpdatedInFrame: false,
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/core/src/Sprites/spriteRenderer.ts
Expand Up @@ -102,7 +102,7 @@ export class SpriteRenderer {
this._epsilon = epsilon;

this._engine = engine;
this._useInstancing = engine.getCaps().instancedArrays;
this._useInstancing = engine.getCaps().instancedArrays && engine._features.supportSpriteInstancing;
this._useVAO = engine.getCaps().vertexArrayObject && !engine.disableVertexArrayObjects;
this._scene = scene;
this._drawWrapperBase = new DrawWrapper(engine);
Expand Down

0 comments on commit 722457d

Please sign in to comment.