Skip to content

Commit b2c29fd

Browse files
Update Effect.cs
1 parent f6712c3 commit b2c29fd

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • sources/engine/Stride.Graphics/Effects

sources/engine/Stride.Graphics/Effects/Effect.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
6+
using System.Runtime.InteropServices;
67
using Stride.Core;
78
using Stride.Core.Mathematics;
89
using Stride.Core.Serialization;
910
using Stride.Core.Serialization.Contents;
1011
using Stride.Core.Storage;
1112
using Stride.Rendering;
1213
using Stride.Shaders;
13-
using Stride.Shaders.Compiler;
1414

1515
namespace Stride.Graphics
1616
{
@@ -104,12 +104,14 @@ private void Initialize()
104104

105105
private static void PrepareReflection(EffectReflection reflection)
106106
{
107+
var resourceBindingsSpan = CollectionsMarshal.AsSpan(reflection.ResourceBindings);
108+
107109
// prepare resource bindings used internally
108110
for (int i = 0; i < reflection.ResourceBindings.Count; i++)
109111
{
110112
// it is fine if multiple threads do this at the same time (same result)
111113
// we use ref to avoid reassigning to the list (which cause a Collection modified during enumeration exception)
112-
UpdateResourceBindingKey(ref reflection.ResourceBindings.Items[i]);
114+
UpdateResourceBindingKey(ref resourceBindingsSpan[i]);
113115
}
114116
foreach (var constantBuffer in reflection.ConstantBuffers)
115117
{

0 commit comments

Comments
 (0)