Skip to content

Commit 2407a84

Browse files
[Editor] Fixed player backends using the wrong dotnet version;
[Android] Fixed builds crashing due to failing to load shaders; [Core] Fix TypeCacheGenerator clearing type caches when it shouldn't; [Rendering] Cleanup;
1 parent 76b8f88 commit 2407a84

File tree

11 files changed

+15
-57
lines changed

11 files changed

+15
-57
lines changed

Engine/Core/Rendering/Animation/SkinnedMeshRenderSystem.cs

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void Process((Entity, Transform, IComponent)[] entities, Camera activeCam
100100

101101
var useAnimator = animator != null && animator.evaluator != null;
102102

103-
Matrix4x4[] boneMatrices = null;
103+
Matrix4x4[] boneMatrices;
104104

105105
if (useAnimator)
106106
{
@@ -226,6 +226,7 @@ public void Submit()
226226
Material lastMaterial = null;
227227
int lastMeshAsset = 0;
228228
SkinnedMeshAnimator lastAnimator = null;
229+
MaterialLighting lastLighting = MaterialLighting.Unlit;
229230

230231
bgfx.discard((byte)bgfx.DiscardFlags.All);
231232

@@ -234,61 +235,25 @@ public void Submit()
234235
var renderer = pair.renderer;
235236
var mesh = renderer.mesh;
236237
var meshAsset = mesh.meshAsset;
237-
var meshAssetMesh = meshAsset.meshes[mesh.meshAssetIndex];
238238
var animator = renderer.animator.Content;
239239

240240
for (var j = 0; j < renderer.mesh.submeshes.Count; j++)
241241
{
242242
var assetGuid = meshAsset.Guid.GetHashCode();
243243

244-
var useAnimator = animator != null && animator.evaluator != null;
245-
246-
Matrix4x4[] boneMatrices = null;
247-
248-
if (useAnimator)
249-
{
250-
boneMatrices = animator.cachedBoneMatrices;
251-
}
252-
else
253-
{
254-
cachedBoneMatrices.TryGetValue(assetGuid, out boneMatrices);
255-
}
256-
257-
if(boneMatrices == null)
258-
{
259-
continue;
260-
}
261-
262-
var bones = meshAssetMesh.bones[j];
263-
264-
/*
265-
if (bones.Length > MaxBones)
266-
{
267-
Log.Warning($"Skipping skinned mesh render for {meshAssetMesh.name}: " +
268-
$"Bone count of {bones.Length} exceeds limit of {MaxBones}, try setting split large meshes in the import settings!");
269-
270-
continue;
271-
}
272-
*/
273-
274244
var material = renderer.materials[j];
275245

276-
#if STAPLE_USE_EXPERIMENTAL_OPTIMIZATIONS
277-
var needsChange = assetGuid != lastMeshAsset ||
278-
material.Guid != (lastMaterial?.Guid ?? "") ||
279-
lastAnimator != animator;
280-
#else
281246
var needsChange = assetGuid != lastMeshAsset ||
282247
material.Guid != (lastMaterial?.Guid ?? "") ||
283248
lastAnimator != animator ||
284-
renderer.lighting != MaterialLighting.Unlit;
285-
#endif
249+
lastLighting != renderer.lighting;
286250

287251
if (needsChange)
288252
{
289253
lastMeshAsset = assetGuid;
290254
lastMaterial = material;
291255
lastAnimator = animator;
256+
lastLighting = renderer.lighting;
292257

293258
bgfx.discard((byte)bgfx.DiscardFlags.All);
294259

@@ -329,10 +294,7 @@ public void Submit()
329294
bgfx.DiscardFlags.IndexBuffer |
330295
bgfx.DiscardFlags.Transform;
331296

332-
if(renderer.stagingBoneMatrixBuffer != null)
333-
{
334-
renderer.stagingBoneMatrixBuffer.SetBufferActive(15, Access.Read);
335-
}
297+
renderer.stagingBoneMatrixBuffer?.SetBufferActive(15, Access.Read);
336298

337299
bgfx.submit(pair.viewID, program, 0, (byte)flags);
338300
}

Engine/Core/Rendering/Mesh/MeshRenderSystem.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,25 +205,23 @@ public void Submit()
205205
bgfx.StateFlags.DepthTestLequal;
206206

207207
Material lastMaterial = null;
208+
MaterialLighting lastLighting = MaterialLighting.Unlit;
208209

209210
foreach(var pair in renderers.Contents)
210211
{
211212
void DrawMesh(int index)
212213
{
213214
var material = pair.renderer.materials[index];
214215

215-
#if STAPLE_USE_EXPERIMENTAL_OPTIMIZATIONS
216-
var needsChange = lastMaterial?.Guid.GetHashCode() != material?.Guid?.GetHashCode();
217-
#else
218216
var needsChange = lastMaterial?.Guid.GetHashCode() != material?.Guid?.GetHashCode() ||
219-
pair.renderer.lighting != MaterialLighting.Unlit;
220-
#endif
217+
lastLighting != pair.renderer.lighting;
221218

222219
if (needsChange)
223220
{
224221
bgfx.discard((byte)bgfx.DiscardFlags.All);
225222

226223
lastMaterial = material;
224+
lastLighting = pair.renderer.lighting;
227225

228226
material.DisableShaderKeyword(Shader.SkinningKeyword);
229227

Engine/Core/StapleCore.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
88

99
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('macOS'))">$(TargetFrameworks);net9.0-ios</TargetFrameworks>
10-
<DefineConstants>$(DefineConstants);STAPLE_USE_EXPERIMENTAL_OPTIMIZATIONS</DefineConstants>
1110
</PropertyGroup>
1211

1312
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">

Engine/Editor/Backends/AndroidBuildProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public class PlayerActivity : StapleActivity
114114
{
115115
protected override void OnCreate(Bundle? savedInstanceState)
116116
{
117-
TypeCacheRegistration.RegisterAll();
117+
StapleCodeGeneration.TypeCacheRegistration.RegisterAll();
118118
119119
base.OnCreate(savedInstanceState);
120120
}

Engine/TypeRegistration/TypeCacheRegistrationGenerator.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public static class TypeCacheRegistration
6161
{{
6262
public static void RegisterAll()
6363
{{
64-
Staple.Internal.TypeCache.Clear();
6564
";
6665

6766
var types = new HashSet<string>();

Staging/Player Backends/Android/PlayerBackend.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"redistOutput": "lib/arm64-v8a",
55
"dataDir": "Assets",
66
"platformRuntime": "android-arm64",
7-
"framework": "net8.0-android",
7+
"framework": "net9.0-android",
88
"publish": false,
99
"dataDirIsOutput": false,
1010
"renderers": [

Staging/Player Backends/Linux/PlayerBackend.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"redistOutput": ".",
55
"dataDir": "Data",
66
"platformRuntime": "linux-x64",
7-
"framework": "net8.0",
7+
"framework": "net9.0",
88
"publish": true,
99
"dataDirIsOutput": true,
1010
"renderers": [

Staging/Player Backends/MacOSX/PlayerBackend.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"redistOutput": ".",
55
"dataDir": "Data",
66
"platformRuntime": "osx-arm64",
7-
"framework": "net8.0",
7+
"framework": "net9.0",
88
"publish": true,
99
"dataDirIsOutput": true,
1010
"renderers": [

Staging/Player Backends/Windows/PlayerBackend.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"redistOutput": ".",
55
"dataDir": "Data",
66
"platformRuntime": "win-x64",
7-
"framework": "net8.0",
7+
"framework": "net9.0",
88
"publish": true,
99
"dataDirIsOutput": true,
1010
"appIconExtension": "ico",

Staging/Player Backends/iOS/PlayerBackend.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"redistOutput": ".",
55
"dataDir": ".",
66
"platformRuntime": "ios-arm64",
7-
"framework": "net8.0-ios",
7+
"framework": "net9.0-ios",
88
"publish": false,
99
"dataDirIsOutput": false,
1010
"renderers": [

0 commit comments

Comments
 (0)