void setupVertexDescriptions() { // Binding description vbindingDescs = new VkVertexInputBindingDescription[] { new VkVertexInputBindingDescription( binding: VERTEX_BUFFER_BIND_ID, stride: (uint)sizeof(Vertex), inputRate: VkVertexInputRate.Vertex) }; // Attribute descriptions vAttrDescs = new VkVertexInputAttributeDescription[] { // layout (location = 0) in vec3 inPos; new VkVertexInputAttributeDescription( location: 0, binding: VERTEX_BUFFER_BIND_ID, format: VkFormat.R32g32b32Sfloat, offset: 0), // layout (location = 1) in vec3 inColor; new VkVertexInputAttributeDescription( location: 1, binding: VERTEX_BUFFER_BIND_ID, format: VkFormat.R32g32b32Sfloat, offset: (uint)sizeof(Vector3)), }; vertices_inputState = VkPipelineVertexInputStateCreateInfo.Alloc(); vertices_inputState->vertexBindingDescriptions = vbindingDescs; vertices_inputState->vertexAttributeDescriptions = vAttrDescs; }
void setupVertexDescriptions() { // Binding description vBindingDescriptions = new VkVertexInputBindingDescription[1]; vBindingDescriptions[0] = new VkVertexInputBindingDescription(); vBindingDescriptions[0].binding = VERTEX_BUFFER_BIND_ID; vBindingDescriptions[0].stride = (uint)sizeof(Vertex); vBindingDescriptions[0].inputRate = VkVertexInputRate.Vertex; // Attribute descriptions // Describes memory layout and shader positions vAttrDescriptions = new VkVertexInputAttributeDescription[4]; // Location 0 : Position vAttrDescriptions[0] = new VkVertexInputAttributeDescription(); vAttrDescriptions[0].binding = VERTEX_BUFFER_BIND_ID; vAttrDescriptions[0].location = 0; vAttrDescriptions[0].format = VkFormat.R32g32b32Sfloat; vAttrDescriptions[0].offset = Vertex.PositionOffset; // Location 1 : Normal vAttrDescriptions[1] = new VkVertexInputAttributeDescription(); vAttrDescriptions[1].binding = VERTEX_BUFFER_BIND_ID; vAttrDescriptions[1].location = 1; vAttrDescriptions[1].format = VkFormat.R32g32b32Sfloat; vAttrDescriptions[1].offset = Vertex.NormalOffset; // Location 2 : Texture coordinates vAttrDescriptions[2] = new VkVertexInputAttributeDescription(); vAttrDescriptions[2].binding = VERTEX_BUFFER_BIND_ID; vAttrDescriptions[2].location = 2; vAttrDescriptions[2].format = VkFormat.R32g32Sfloat; vAttrDescriptions[2].offset = Vertex.UvOffset; // Location 3 : Color vAttrDescriptions[3] = new VkVertexInputAttributeDescription(); vAttrDescriptions[3].binding = VERTEX_BUFFER_BIND_ID; vAttrDescriptions[3].location = 3; vAttrDescriptions[3].format = VkFormat.R32g32b32Sfloat; vAttrDescriptions[3].offset = Vertex.ColorOffset; vInputStateInfo = VkPipelineVertexInputStateCreateInfo.Alloc(); vInputStateInfo->vertexBindingDescriptions = vBindingDescriptions; vInputStateInfo->vertexAttributeDescriptions = vAttrDescriptions; }
void setupVertexDescriptions() { // Binding description bindingDescs = new VkVertexInputBindingDescription[1]; bindingDescs[0].binding = VERTEX_BUFFER_BIND_ID; bindingDescs[0].stride = vertexLayout.stride(); bindingDescs[0].inputRate = VkVertexInputRate.Vertex;// VK_VERTEX_INPUT_RATE_VERTEX; // Attribute descriptions attributeDescs = VkVertexInputAttributeDescription.Alloc(4); // Location 0 : Position attributeDescs[0].binding = VERTEX_BUFFER_BIND_ID; attributeDescs[0].location = 0; attributeDescs[0].format = VkFormat.R32g32b32Sfloat;// VK_FORMAT_R32G32B32_SFLOAT, attributeDescs[0].offset = 0; // Location 1 : Texture coordinates attributeDescs[1].binding = VERTEX_BUFFER_BIND_ID; attributeDescs[1].location = 1; attributeDescs[1].format = VkFormat.R32g32Sfloat;// VK_FORMAT_R32G32_SFLOAT, attributeDescs[1].offset = sizeof(float) * 3; // Location 2 : Color attributeDescs[2].binding = VERTEX_BUFFER_BIND_ID; attributeDescs[2].location = 2; attributeDescs[2].format = VkFormat.R32g32b32Sfloat;// VK_FORMAT_R32G32B32_SFLOAT, attributeDescs[2].offset = sizeof(float) * 5; // Location 3 : Normal attributeDescs[3].binding = VERTEX_BUFFER_BIND_ID; attributeDescs[3].location = 3; attributeDescs[3].format = VkFormat.R32g32b32Sfloat;// VK_FORMAT_R32G32B32_SFLOAT, attributeDescs[3].offset = sizeof(float) * 8; inputInfo = VkPipelineVertexInputStateCreateInfo.Alloc(); inputInfo[0].vertexBindingDescriptions = bindingDescs; inputInfo[0].vertexAttributeDescriptions.count = 4; inputInfo[0].vertexAttributeDescriptions.pointer = attributeDescs; }