Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 3c6e377

Browse files
author
Yuncong Zhang
authored
Merge pull request #247 from UnityTech/allocator2
GC optimization on renderer
2 parents 2998ee1 + e0994be commit 3c6e377

File tree

119 files changed

+7659
-1785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+7659
-1785
lines changed

Runtime/editor/rasterizer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ bool _drawToSurface(LayerTree layerTree) {
7676
this._fireNextFrameCallbackIfPresent();
7777
return true;
7878
}
79-
8079
return false;
8180
}
8281
}

Runtime/flow.meta

Lines changed: 0 additions & 3 deletions
This file was deleted.

Runtime/flow/compositor_context.cs.meta

Lines changed: 0 additions & 3 deletions
This file was deleted.

Runtime/rendering/view.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ public override void applyPaintTransform(RenderObject child, Matrix3 transform)
116116

117117
public void compositeFrame() {
118118
var builder = new SceneBuilder();
119-
this.layer.buildScene(builder);
120-
using (var scene = builder.build()) {
119+
using (var scene = this.layer.buildScene(builder)) {
121120
Window.instance.render(scene);
122121
}
123122

Runtime/ui/compositing.cs.meta

Lines changed: 0 additions & 3 deletions
This file was deleted.

Runtime/ui/matrix.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,8 +1438,22 @@ public static bool ScalarsAreFinite(float[] array, int count) {
14381438
return prod == 0; // if prod is NaN, this check will return false
14391439
}
14401440

1441+
static byte[] _scalar_as_2s_compliment_vars = new byte[4];
1442+
1443+
1444+
static unsafe int GetBytesToInt32(float value) {
1445+
var intVal = *(int*) &value;
1446+
fixed (byte* b = _scalar_as_2s_compliment_vars) {
1447+
*((int*) b) = intVal;
1448+
}
1449+
1450+
fixed (byte* pbyte = &_scalar_as_2s_compliment_vars[0]) {
1451+
return *((int*) pbyte);
1452+
}
1453+
}
1454+
14411455
public static int ScalarAs2sCompliment(float x) {
1442-
var result = BitConverter.ToInt32(BitConverter.GetBytes(x), 0);
1456+
var result = GetBytesToInt32(x);
14431457
if (result < 0) {
14441458
result &= 0x7FFFFFFF;
14451459
result = -result;

Runtime/ui/painting/canvas_clip.cs.meta

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)