internal unsafe void MarshalTo(Interop.PipelineColorBlendStateCreateInfo *pointer) { pointer->SType = StructureType.PipelineColorBlendStateCreateInfo; pointer->Next = null; //Attachments if (this.Attachments != null) { pointer->Attachments = (PipelineColorBlendAttachmentState *)Interop.HeapUtil.Allocate <PipelineColorBlendAttachmentState>(this.Attachments.Length).ToPointer(); for (int index = 0; index < this.Attachments.Length; index++) { pointer->Attachments[index] = this.Attachments[index]; } } else { pointer->Attachments = null; } Validate.CheckLength(this.BlendConstants, 4, "BlendConstants"); MemUtil.WriteToPtr((IntPtr)(pointer->BlendConstants), this.BlendConstants, 0, 4); pointer->AttachmentCount = (uint)(this.Attachments?.Length ?? 0); pointer->Flags = this.Flags; pointer->LogicOpEnable = this.LogicOpEnable; pointer->LogicOp = this.LogicOp; }
internal unsafe void MarshalTo(Interop.DebugMarkerMarkerInfo *pointer) { pointer->SType = StructureType.DebugMarkerMarkerInfo; pointer->Next = null; pointer->MarkerName = Interop.HeapUtil.MarshalTo(this.MarkerName); Validate.CheckLength(this.Color, 4, "Color"); MemUtil.WriteToPtr((IntPtr)(pointer->Color), this.Color, 0, 4); }
internal unsafe void MarshalTo(Interop.ImageBlit *pointer) { Validate.CheckLength(this.SourceOffsets, 2, "SourceOffsets"); MemUtil.WriteToPtr((IntPtr)(&pointer->SourceOffsets), this.SourceOffsets, 0, 2); Validate.CheckLength(this.DestinationOffsets, 2, "DestinationOffsets"); MemUtil.WriteToPtr((IntPtr)(&pointer->DestinationOffsets), this.DestinationOffsets, 0, 2); pointer->SourceSubresource = this.SourceSubresource; pointer->DestinationSubresource = this.DestinationSubresource; }
private void CreateIndexBuffer() { ulong bufferSize = MemUtil.SizeOf <ushort>() * (uint)this.indices.Length; Buffer stagingBuffer; DeviceMemory stagingBufferMemory; this.CreateBuffer(bufferSize, BufferUsageFlags.TransferSource, MemoryPropertyFlags.HostVisible | MemoryPropertyFlags.HostCoherent, out stagingBuffer, out stagingBufferMemory); IntPtr memoryBuffer = IntPtr.Zero; stagingBufferMemory.MapMemory(0, bufferSize, MemoryMapFlags.None, ref memoryBuffer); MemUtil.WriteToPtr(memoryBuffer, indices, 0, indices.Length); stagingBufferMemory.UnmapMemory(); this.CreateBuffer(bufferSize, BufferUsageFlags.TransferDestination | BufferUsageFlags.IndexBuffer, MemoryPropertyFlags.DeviceLocal, out this.indexBuffer, out this.indexBufferMemory); this.CopyBuffer(stagingBuffer, this.indexBuffer, bufferSize); stagingBuffer.Dispose(); this.device.FreeMemory(stagingBufferMemory); }