public void UsageAfterDispose(Device device, Type bufferType)
        {
            using TransferTexture2D <float> texture = device.Get().AllocateTransferTexture2D <float>(bufferType, 32, 32);

            texture.Dispose();

            _ = texture.View;
        }
Exemple #2
0
    public void DisposeAfterDevice(Device device, Type textureType)
    {
        GraphicsDevice?gpu = device switch
        {
            Device.Discrete => GraphicsDevice.QueryDevices(info => info.IsHardwareAccelerated).FirstOrDefault(),
            Device.Warp => GraphicsDevice.QueryDevices(info => !info.IsHardwareAccelerated).First(),
            _ => throw new ArgumentException(nameof(device))
        };

        if (gpu is null)
        {
            Assert.Inconclusive();

            return;
        }

        TransferTexture2D <float> texture = gpu.AllocateTransferTexture2D <float>(textureType, 32, 32);

        gpu.Dispose();
        texture.Dispose();
    }