Exemplo n.º 1
0
        private void InitializeVertexDescriptor(MgPipelineVertexInputStateCreateInfo vertexInput)
        {
            {
                var noOfBindings = vertexInput.VertexBindingDescriptions.Length;
                Layouts = new AmtGraphicsPipelineVertexLayoutBinding[noOfBindings];
                for (var i = 0; i < noOfBindings; ++i)
                {
                    var binding = vertexInput.VertexBindingDescriptions[i];
                    Layouts[i] = new AmtGraphicsPipelineVertexLayoutBinding
                    {
                        Index        = (nint)i,
                        StepFunction = TranslateStepFunction(binding.InputRate),
                        Stride       = (nuint)binding.Stride,
                    };
                }
            }

            {
                var noOfAttributes = vertexInput.VertexAttributeDescriptions.Length;
                Attributes = new AmtGraphicsPipelineVertexAttribute[noOfAttributes];
                for (var i = 0; i < noOfAttributes; ++i)
                {
                    var attribute = vertexInput.VertexAttributeDescriptions[i];

                    Attributes[i] = new AmtGraphicsPipelineVertexAttribute
                    {
                        Index       = (nint)i,
                        Offset      = attribute.Offset,
                        BufferIndex = (nuint)attribute.Binding,
                        Format      = AmtFormatExtensions.GetVertexFormat(attribute.Format),
                    };
                }
            }
        }