Give terrain, sky, retained UI, portal preparation, and the update/render frame pair explicit single owners. Make shader, texture, text, bindless, and GL construction prefixes checked and retryable so partial failure cannot lose or replay resource ownership. Co-authored-by: Codex <codex@openai.com>
31 lines
979 B
C#
31 lines
979 B
C#
namespace AcDream.App.Rendering;
|
|
|
|
internal static class TrackedTextureConstruction
|
|
{
|
|
public static uint Create(
|
|
GlTextureConstructionTransaction transaction,
|
|
Action<uint> initialize)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(transaction);
|
|
ArgumentNullException.ThrowIfNull(initialize);
|
|
uint texture = transaction.Allocate();
|
|
initialize(texture);
|
|
return texture;
|
|
}
|
|
|
|
public static uint Create(
|
|
GlTextureConstructionTransaction transaction,
|
|
Silk.NET.OpenGL.GL gl,
|
|
string context,
|
|
Action<uint> initialize)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(transaction);
|
|
ArgumentNullException.ThrowIfNull(gl);
|
|
ArgumentException.ThrowIfNullOrWhiteSpace(context);
|
|
ArgumentNullException.ThrowIfNull(initialize);
|
|
|
|
uint texture = transaction.Allocate();
|
|
GlResourceCommand.Execute(gl, context, () => initialize(texture));
|
|
return texture;
|
|
}
|
|
}
|