/// <summary> /// Registers a sync action to happen for this handle, and an interim flush action on the tracking handle. /// </summary> /// <param name="context">The GPU context to register a sync action on</param> private void RegisterSync(GpuContext context) { if (!_syncActionRegistered) { _modifiedSync = context.SyncNumber; context.RegisterSyncAction(SyncAction, true); _syncActionRegistered = true; } if (Interlocked.Exchange(ref _actionRegistered, 1) == 0) { _group.RegisterAction(this); } }
/// <summary> /// Registers a sync action to happen for this handle, and an interim flush action on the tracking handle. /// </summary> /// <param name="context">The GPU context to register a sync action on</param> private void RegisterSync(GpuContext context) { if (!_syncActionRegistered) { _modifiedSync = context.SyncNumber; context.RegisterSyncAction(SyncAction, true); _syncActionRegistered = true; } if (!_actionRegistered) { _group.RegisterAction(this); _actionRegistered = true; } }
/// <summary> /// Perform a copy from the provided handle to this one, or perform a deferred copy if none is provided. /// </summary> /// <param name="fromHandle">The handle to copy from. If not provided, this method will copy from and clear the deferred copy instead</param> /// <returns>True if the copy was performed, false otherwise</returns> public bool Copy(TextureGroupHandle fromHandle = null) { bool result = false; if (fromHandle == null) { fromHandle = DeferredCopy; if (fromHandle != null && fromHandle._bindCount == 0) { // Repeat the copy in future if the bind count is greater than 0. DeferredCopy = null; } } if (fromHandle != null) { // If the copy texture is dirty, do not copy. Its data no longer matters, and this handle should also be dirty. if (!fromHandle.CheckDirty()) { Texture from = fromHandle._group.Storage; Texture to = _group.Storage; if (from.ScaleFactor != to.ScaleFactor) { to.PropagateScale(from); } from.HostTexture.CopyTo( to.HostTexture, fromHandle._firstLayer, _firstLayer, fromHandle._firstLevel, _firstLevel); Modified = true; _group.RegisterAction(this); result = true; } } return(result); }