run on main thread primitive effect loading/disposal

This commit is contained in:
Dreitone committed 2026-02-22 19:23:29 -06:00
1 parent 4e6d144509
commit 0eb787c7ab
1 file changed
+17 -12
@@ -180,23 +180,28 @@ public static class SanePrimitiveRenderer
public static void Initialize()
{
if (_graphicsDevice == null)
throw new ArgumentNullException(nameof(_graphicsDevice));
_effect?.Dispose();
_effect = new BasicEffect(_graphicsDevice)
Main.RunOnMainThread(() =>
{
VertexColorEnabled = true,
TextureEnabled = true,
LightingEnabled = false,
FogEnabled = false,
Texture = TextureAssets.Logo.Value
};
if (_graphicsDevice == null)
throw new ArgumentNullException(nameof(_graphicsDevice));
_effect?.Dispose();
_effect = new BasicEffect(_graphicsDevice)
{
VertexColorEnabled = true,
TextureEnabled = true,
LightingEnabled = false,
FogEnabled = false,
Texture = TextureAssets.Logo.Value
};
});
}
public static void Dispose()
{
_effect?.Dispose();
Main.RunOnMainThread(() =>
_effect?.Dispose()
);
}
/// <summary>