Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientFenceMessage"/>.
        /// </summary>
        /// <param name="flags">The fence flags.</param>
        /// <param name="payload">The fence payload (limited to 64 bytes).</param>
        public ClientFenceMessage(FenceFlags flags, byte[] payload)
        {
            Flags   = flags; // Enum is not checked to allow extended flag bits.
            Payload = payload ?? throw new ArgumentNullException(nameof(payload));

            if (payload.Length > 64)
            {
                throw new ArgumentException("Payload length must not exceed 64 bytes.", nameof(payload));
            }
        }
Exemplo n.º 2
0
    public Result CreateFence <T>(ulong initialValue, FenceFlags flags, out T?fence) where T : ID3D11Fence
    {
        Result result = CreateFence(initialValue, flags, typeof(T).GUID, out IntPtr nativePtr);

        if (result.Success)
        {
            fence = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }

        fence = default;
        return(result);
    }
Exemplo n.º 3
0
 public ID3D11Fence CreateFence(long initialValue, FenceFlags flags = FenceFlags.None)
 {
     return(CreateFence(initialValue, flags, typeof(ID3D11Fence).GUID));
 }
Exemplo n.º 4
0
 /// <summary>
 ///   Constructs a new <see cref = "T:SharpDX.Direct3D11.Fence" />
 /// </summary>
 /// <param name = "device">The device with which to associate the state object.</param>
 /// <param name="initialValue">The initial value for the fence.</param>
 /// <param name="flags">A combination of FenceFlags values that are combined by using a bitwise OR operation. The resulting value specifies options for the fence.</param>
 /// <returns>The newly created object.</returns>
 public Fence(Device5 device, long initialValue, FenceFlags flags)
     : base(IntPtr.Zero)
 {
     device.CreateFence(initialValue, flags, Utilities.GetGuidFromType(typeof(Fence)), this);
 }
Exemplo n.º 5
0
 public ID3D11Fence CreateFence(ulong initialValue, FenceFlags flags = FenceFlags.None)
 {
     CreateFence(initialValue, flags, typeof(ID3D11Fence).GUID, out IntPtr nativePtr).CheckError();
     return(new ID3D11Fence(nativePtr));
 }
Exemplo n.º 6
0
 public T CreateFence <T>(ulong initialValue, FenceFlags flags = FenceFlags.None) where T : ID3D11Fence
 {
     CreateFence(initialValue, flags, typeof(T).GUID, out IntPtr nativePtr).CheckError();
     return(MarshallingHelpers.FromPointer <T>(nativePtr));
 }