コード例 #1
0
        public void UsageAfterDispose(Device device, Type bufferType)
        {
            using TransferTexture3D <float> buffer = device.Get().AllocateTransferTexture3D <float>(bufferType, 32, 32, 16);

            buffer.Dispose();

            _ = buffer.View;
        }
コード例 #2
0
    public void UsageAfterDispose(Device device, Type textureType)
    {
        using TransferTexture3D <float> texture = device.Get().AllocateTransferTexture3D <float>(textureType, 32, 32, 16);

        texture.Dispose();

        _ = texture.View;
    }
コード例 #3
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;
        }

        TransferTexture3D <float> texture = gpu.AllocateTransferTexture3D <float>(textureType, 32, 32, 16);

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