3D engine that AI agents drive
Read a single instance's flat values from uniforms and add the changes note (part of #388)
Nguyen Xuan Anf62d61ba1abb
diff --git a/changes/388.md b/changes/388.mdnew file mode 100644index 00000000..bc393ccb--- /dev/null+++ b/changes/388.md@@ -0,0 +1 @@+- Draw meshes faster when they carry no vertex colours or draw one instance per batch (issue #388): the shaders no longer pass the vertex tint and sky visibility between stages, and a renderer whose batches each hold a single instance reads that instance's colour, surface, emission and box matrix from uniforms instead of varyings. The large-mesh sphere draw of about 1.05 million sub-pixel triangles drops from 1.64-1.66 ms to about 0.38 ms at 1080p on an RTX 3060.diff --git a/src/renderer.js b/src/renderer.jsindex 3c9670ee..6a30be86 100644--- a/src/renderer.js+++ b/src/renderer.js@@ -2075,7 +2075,7 @@ export class Renderer67 {this.context.uniform1f(this.uniforms.lightMapScale, batch.mapState[15]);}}- if (textured && !this.benchmark && !this.shaderFeatures.has('instanced')) this.setSingleInstanceUniforms(batch.instanceData);+ if (textured && !this.benchmark && this.shaderFeatures?.has('instanced') === false)this.setSingleInstanceUniforms(batch.instanceData);if (selection && !selection.isEverything) {this.drawSelectedLevels(batch, selection, levelSet);return;