private Format ConvertVertexFormatToVulkan(VertexBuilderFormat myFormat) { switch (myFormat) { case VertexBuilderFormat.FLOAT1: return(Format.R32Sfloat); case VertexBuilderFormat.FLOAT2: return(Format.R32G32Sfloat); case VertexBuilderFormat.FLOAT3: return(Format.R32G32B32Sfloat); case VertexBuilderFormat.FLOAT4: return(Format.R32G32B32A32Sfloat); } throw new Exception("Invalid VertexBuilder Format passed to GetOffsetSizeFromVulkanFormat!"); }
public void AddVertexAttribute(VertexBuilderFormat myFormat) { uint offset = 0; VertexInputAttributeDescription myLastItem; if (myVertexAttributes.Count != 0) { myLastItem = myVertexAttributes.Last(); offset = myLastItem.Offset + GetOffsetSizeFromVulkanFormat(myLastItem.Format); } Format VulkanFormat = ConvertVertexFormatToVulkan(myFormat); myVertexAttributes.Add(new VertexInputAttributeDescription { Format = VulkanFormat, Binding = myBinding, Location = LastLocation, Offset = offset }); LastLocation++; myLastItem = myVertexAttributes.Last(); myBindingVertex.Stride = myLastItem.Offset + GetOffsetSizeFromVulkanFormat(myLastItem.Format); }