#include "../vulkan_state.h" #include "../raster_libraries.h" #include "tier1/utlbuffer.h" #include "tier1/utlvector.h" #include "tier2/ifilesystem.h" #include "vulkan/vulkan_core.h" BEGIN_BUILD_PIPELINE_LIBRARY(VertexDescription) library.flags = VK_GRAPHICS_PIPELINE_LIBRARY_VERTEX_INPUT_INTERFACE_BIT_EXT; VkPipelineVertexInputStateCreateInfo vertexInput = {}; VkPipelineInputAssemblyStateCreateInfo inputAssembly = {}; vertexInput.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; vertexInput.vertexBindingDescriptionCount = layouts.GetSize(); vertexInput.pVertexBindingDescriptions = layouts.GetData(); vertexInput.vertexAttributeDescriptionCount = attributes.GetSize(); vertexInput.pVertexAttributeDescriptions = attributes.GetData(); inputAssembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; inputAssembly.primitiveRestartEnable = VK_FALSE; inputAssembly.topology = m_eTopology; pipeline.pVertexInputState = &vertexInput; pipeline.pInputAssemblyState = &inputAssembly; END_BUILD_PIPELINE_LIBRARY() void CVkVertexDescriptionPipelineLibrary::AddLayout( int iIndex, int iStride ) { VkVertexInputBindingDescription layout = {}; layout.binding = iIndex; layout.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; layout.stride = iStride; layouts.AppendTail(layout); } void CVkVertexDescriptionPipelineLibrary::AddAttribute( int iBufferIndex, int iLocation, EVertexFormat eFormat, int iOffset ) { VkVertexInputAttributeDescription attribute = {}; attribute.binding = iBufferIndex; attribute.location = iLocation; attribute.format = VulkanGetVertexFormat(eFormat); attribute.offset = iOffset; attributes.AppendTail(attribute); } void CVkVertexDescriptionPipelineLibrary::SetTopology( ETopologyMode eTopology ) { m_eTopology = VulkanGetTopology(eTopology); }