internal unsafe void __MarshalFrom(ref __Native @ref)
 {
     Data = new byte[@ref.Length];
     if (@ref.Length > 0)
     {
         UnsafeUtilities.Read(@ref.Bytecode, Data);
     }
 }
        /// <summary>
        /// Initializes this instance from the specified buffer.
        /// </summary>
        /// <param name="bufferSize">Size of the buffer.</param>
        /// <param name="bufferPointer">The buffer pointer.</param>
        private void Init(int bufferSize, IntPtr bufferPointer)
        {
            _bufferSize = bufferSize;

            // By default, copy as-is previous data
            if (_bufferSize > 0 && bufferPointer != IntPtr.Zero)
            {
                _buffer = new byte[bufferSize];

                UnsafeUtilities.Read(bufferPointer, _buffer, _bufferSize);
            }
        }
Exemple #3
0
    internal unsafe void __MarshalFrom(ref __Native @ref)
    {
        Parameters = new RootParameter1[@ref.NumParameters];
        if (@ref.NumParameters > 0)
        {
            UnsafeUtilities.Read(@ref.PParameters, Parameters);
        }

        StaticSamplers = new StaticSamplerDescription[@ref.NumStaticSamplers];
        if (@ref.NumStaticSamplers > 0)
        {
            UnsafeUtilities.Read(@ref.PStaticSamplers, StaticSamplers);
        }

        Flags = @ref.Flags;
    }
        internal unsafe void __MarshalFrom(ref __Native @ref)
        {
            Categories = new MessageCategory[@ref.NumCategories];
            if (@ref.NumCategories > 0)
            {
                UnsafeUtilities.Read(@ref.PCategoryList, Categories);
            }

            Severities = new MessageSeverity[@ref.NumSeverities];
            if (@ref.NumSeverities > 0)
            {
                UnsafeUtilities.Read(@ref.PSeverityList, Severities);
            }

            Ids = new MessageId[@ref.NumIDs];
            if (@ref.NumIDs > 0)
            {
                UnsafeUtilities.Read(@ref.PIDList, Ids);
            }
        }
Exemple #5
0
    internal unsafe void __MarshalFrom(ref __Native @ref)
    {
        Type             = @ref.Type;
        Flags            = @ref.Flags;
        DescriptorsCount = @ref.NumDescs;
        Layout           = @ref.DescsLayout;

        if (@ref.NumDescs > 0)
        {
            if (@ref.Type == RaytracingAccelerationStructureType.TopLevel)
            {
                InstanceDescriptions = Unsafe.Read <ulong>(@ref.Union.pGeometryDescs.ToPointer());
            }
            else
            {
                GeometryDescriptions = new RaytracingGeometryDescription[@ref.NumDescs];
                UnsafeUtilities.Read(@ref.Union.pGeometryDescs, GeometryDescriptions);
            }
        }
    }
        internal unsafe void __MarshalFrom(ref __Native @ref)
        {
            FontFace = (@ref.FontFace == IntPtr.Zero) ? null : new IDWriteFontFace(@ref.FontFace);
            if (FontFace != null)
            {
                FontFace.AddRef();
            }

            FontSize   = @ref.FontEmSize;
            GlyphCount = @ref.GlyphCount;
            GlyphCount = @ref.GlyphCount;
            if (@ref.GlyphIndices != IntPtr.Zero)
            {
                Indices = new ushort[GlyphCount];
                if (GlyphCount > 0)
                {
                    UnsafeUtilities.Read(@ref.GlyphIndices, Indices, GlyphCount);
                }
            }

            if (@ref.GlyphAdvances != IntPtr.Zero)
            {
                Advances = new float[GlyphCount];
                if (GlyphCount > 0)
                {
                    UnsafeUtilities.Read(@ref.GlyphAdvances, Advances, GlyphCount);
                }
            }

            if (@ref.GlyphOffsets != IntPtr.Zero)
            {
                Offsets = new GlyphOffset[GlyphCount];
                if (GlyphCount > 0)
                {
                    UnsafeUtilities.Read(@ref.GlyphOffsets, Offsets, GlyphCount);
                }
            }

            IsSideways = @ref.IsSideways;
            BidiLevel  = @ref.BidiLevel;
        }
Exemple #7
0
 public ShaderBytecode(IntPtr bytecode, PointerSize length)
 {
     Data = new byte[length];
     UnsafeUtilities.Read(bytecode, Data);
 }