Skip to content

Commit

Permalink
Remove json model mesh splitting to work around uniform limits (#6188)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky authored Mar 19, 2024
1 parent 45bb052 commit 3e1eb0b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 420 deletions.
2 changes: 0 additions & 2 deletions src/deprecated/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import { DepthState } from '../platform/graphics/depth-state.js';

import { PROJECTION_ORTHOGRAPHIC, PROJECTION_PERSPECTIVE, LAYERID_IMMEDIATE, LAYERID_WORLD } from '../scene/constants.js';
import { calculateTangents, createBox, createCapsule, createCone, createCylinder, createMesh, createPlane, createSphere, createTorus } from '../scene/procedural.js';
import { partitionSkin } from '../scene/skin-partition.js';
import { BasicMaterial } from '../scene/materials/basic-material.js';
import { ForwardRenderer } from '../scene/renderer/forward-renderer.js';
import { GraphNode } from '../scene/graph-node.js';
Expand Down Expand Up @@ -727,7 +726,6 @@ export const PhongMaterial = StandardMaterial;
export const LitOptions = LitShaderOptions;

export const scene = {
partitionSkin: partitionSkin,
procedural: {
calculateTangents: calculateTangents,
createMesh: createMesh,
Expand Down
6 changes: 0 additions & 6 deletions src/framework/parsers/json-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { VertexBuffer } from '../../platform/graphics/vertex-buffer.js';
import { VertexFormat } from '../../platform/graphics/vertex-format.js';
import { VertexIterator } from '../../platform/graphics/vertex-iterator.js';

import { partitionSkin } from '../../scene/skin-partition.js';
import { GraphNode } from '../../scene/graph-node.js';
import { Mesh } from '../../scene/mesh.js';
import { MeshInstance } from '../../scene/mesh-instance.js';
Expand Down Expand Up @@ -126,11 +125,6 @@ class JsonModelParser {
const skinInstances = [];
let i, j;

if (!this._device.supportsBoneTextures && modelData.skins.length > 0) {
const boneLimit = this._device.getBoneLimit();
partitionSkin(modelData, null, boneLimit);
}

for (i = 0; i < modelData.skins.length; i++) {
const skinData = modelData.skins[i];

Expand Down
6 changes: 1 addition & 5 deletions src/platform/graphics/webgl/webgl-graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -815,15 +815,11 @@ class WebglGraphicsDevice extends GraphicsDevice {
numUniforms -= 4 * 4; // Up to 4 texture transforms
this.boneLimit = Math.floor(numUniforms / 3); // each bone uses 3 uniforms

// Put a limit on the number of supported bones before skin partitioning must be performed
// Put a limit on the number of supported bones when texture skinning is not supported.
// Some GPUs have demonstrated performance issues if the number of vectors allocated to the
// skin matrix palette is left unbounded
this.boneLimit = Math.min(this.boneLimit, 128);

if (this.unmaskedRenderer === 'Mali-450 MP') {
this.boneLimit = 34;
}

this.constantTexSource = this.scope.resolve("source");

if (this.extTextureFloat) {
Expand Down
Loading

0 comments on commit 3e1eb0b

Please sign in to comment.