internal void RegisterDeviceResource(IEngineDeviceResource resource) { var currentDeviceResourceIndex = resource.GetDeviceResourceIndex(_device); currentDeviceResourceIndex.EnsureNegativeAndNotZero(nameof(currentDeviceResourceIndex)); _deviceResources.Add(resource); resource.SetDeviceResourceIndex(_device, _deviceResources.Count - 1); }
internal void DeregisterDeviceResource(IEngineDeviceResource resource) { var currentDeviceResourceIndex = resource.GetDeviceResourceIndex(_device); currentDeviceResourceIndex.EnsurePositiveOrZero(nameof(currentDeviceResourceIndex)); _deviceResources[currentDeviceResourceIndex] = null; resource.SetDeviceResourceIndex(_device, -1); _cleanupNeeded = true; }