Skip to content

Commit e9e6e32

Browse files
committed
fix(core): add texture_packing into webgl backend runtime
1 parent 88c5098 commit e9e6e32

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/paddlejs-core/src/transform/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
import { GLOBALS } from '../globals';
31
import TexturePacking from './texturePacking';
42
import FormatInputsX from './formatInputsX';
53
import type Transformer from './transformer';
@@ -16,14 +14,10 @@ const actions: TransformerAction = {
1614
new SplitOp()
1715
],
1816
transforms: [
19-
new FormatInputsX()
17+
new FormatInputsX(),
18+
new TexturePacking()
2019
],
2120
postTransforms: []
2221
};
2322

24-
// wegbl backend单独处理, 在第一个transform后面添加texturePacking
25-
if (GLOBALS.backend === 'webgl') {
26-
actions.transforms.splice(1, 0, new TexturePacking());
27-
}
28-
2923
export default actions;

packages/paddlejs-core/src/transform/texturePacking.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/**
22
* @file texture_packing
33
*/
4+
5+
import { GLOBALS } from '../globals';
46
import OpExecutor from '../opFactory/opExecutor';
57
import Transformer from './transformer';
68

@@ -107,6 +109,10 @@ export default class TexturePacking extends Transformer {
107109
}
108110

109111
transform(...args: any) {
112+
// wegbl backend 单独处理
113+
if (GLOBALS.backend !== 'webgl') {
114+
return;
115+
}
110116
const [originOp, vars, opsMap] = args;
111117

112118
if (!(packedOpConditions[originOp.type] && packedOpConditions[originOp.type](originOp, vars))) {

0 commit comments

Comments
 (0)