namespace AcDream.App.Rendering.Wb;
///
/// Reports the physical outcome when a mesh-reference callback cannot provide
/// the normal strong exception guarantee. lets
/// a transactional owner reconcile its marker without guessing whether a
/// throwing backend already changed the reference count.
///
public sealed class MeshReferenceMutationException : Exception
{
public MeshReferenceMutationException(
string message,
bool mutationCommitted,
Exception innerException)
: base(message, innerException)
{
MutationCommitted = mutationCommitted;
}
public bool MutationCommitted { get; }
}
///
/// Mockable interface over so adapters that
/// drive ref-count lifecycle (e.g. LandblockSpawnAdapter, EntitySpawnAdapter)
/// can be unit-tested without a real WB pipeline behind them.
///
public interface IWbMeshAdapter
{
///
/// Acquires one logical reference. A normal exception guarantees that no
/// reference was acquired;
/// explicitly reports the exceptional backend case where it was committed.
///
void IncrementRefCount(ulong id);
///
/// Releases one logical reference under the same committed-outcome contract
/// as .
///
void DecrementRefCount(ulong id);
///
/// Pins render data whose CPU preparation is owned by a specialized
/// pipeline (for example synthetic EnvCell geometry). Unlike ordinary
/// registration, production implementations must not start a generic
/// GfxObj decode for this id.
///
void PinPreparedRenderData(ulong id) => IncrementRefCount(id);
///
/// True once the mesh has crossed the render-thread upload barrier and is
/// available to draw. The default keeps lifecycle-only test doubles
/// source-compatible; production adapters override it.
///
bool IsRenderDataReady(ulong id) => true;
}