Skip to content

Commit

Permalink
fix: disable sprite batch tag (#2261)
Browse files Browse the repository at this point in the history
  • Loading branch information
cptbtptpbcptdtptp authored Jul 24, 2024
1 parent 4e3f5a9 commit 5f9709c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions packages/core/src/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ export class Engine extends EventDispatcher {
/* @internal */
_shaderProgramPools: ShaderProgramPool[] = [];
/** @internal */
_canSpriteBatch: boolean = true;
/** @internal */
_fontMap: Record<string, Font> = {};
/** @internal @todo: temporary solution */
_macroCollection: ShaderMacroCollection = new ShaderMacroCollection();
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/RenderPipeline/BatchUtils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { SpriteMask, SpriteMaskInteraction, SpriteRenderer } from "../2d";
import { ShaderTagKey } from "../shader";
import { SubRenderElement } from "./SubRenderElement";

/**
* @internal
*/
export class BatchUtils {
protected static _disableBatchTag: ShaderTagKey = ShaderTagKey.getByName("spriteDisableBatching");

static canBatchSprite(elementA: SubRenderElement, elementB: SubRenderElement): boolean {
if (elementB.shaderPasses[0].getTagValue(BatchUtils._disableBatchTag) === true) {
return false;
}
if (elementA.subChunk.chunk !== elementB.subChunk.chunk) {
return false;
}
Expand Down

0 comments on commit 5f9709c

Please sign in to comment.