finished it
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
#include "materialsystem/imaterialsystem.h"
|
#include "materialsystem/imaterialsystem.h"
|
||||||
#include "tier0/platform.h"
|
#include "tier0/platform.h"
|
||||||
#include "tier1/utlvector.h"
|
#include "tier1/utlvector.h"
|
||||||
#include "vulkan/vulkan_core.h"
|
|
||||||
|
|
||||||
|
|
||||||
DECLARE_VULKAN_COMMAND(ClearColor)
|
DECLARE_VULKAN_COMMAND(ClearColor)
|
||||||
|
|||||||
@@ -9,13 +9,20 @@ BEGIN_BUILD_PIPELINE_LIBRARY(VertexDescription)
|
|||||||
library.flags = VK_GRAPHICS_PIPELINE_LIBRARY_VERTEX_INPUT_INTERFACE_BIT_EXT;
|
library.flags = VK_GRAPHICS_PIPELINE_LIBRARY_VERTEX_INPUT_INTERFACE_BIT_EXT;
|
||||||
|
|
||||||
VkPipelineVertexInputStateCreateInfo vertexInput = {};
|
VkPipelineVertexInputStateCreateInfo vertexInput = {};
|
||||||
|
VkPipelineInputAssemblyStateCreateInfo inputAssembly = {};
|
||||||
|
|
||||||
vertexInput.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
|
vertexInput.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
|
||||||
vertexInput.vertexBindingDescriptionCount = layouts.GetSize();
|
vertexInput.vertexBindingDescriptionCount = layouts.GetSize();
|
||||||
vertexInput.pVertexBindingDescriptions = layouts.GetData();
|
vertexInput.pVertexBindingDescriptions = layouts.GetData();
|
||||||
vertexInput.vertexAttributeDescriptionCount = attributes.GetSize();
|
vertexInput.vertexAttributeDescriptionCount = attributes.GetSize();
|
||||||
vertexInput.pVertexAttributeDescriptions = attributes.GetData();
|
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.pVertexInputState = &vertexInput;
|
||||||
|
pipeline.pInputAssemblyState = &inputAssembly;
|
||||||
END_BUILD_PIPELINE_LIBRARY()
|
END_BUILD_PIPELINE_LIBRARY()
|
||||||
|
|
||||||
void CVkVertexDescriptionPipelineLibrary::AddLayout( int iIndex, int iStride )
|
void CVkVertexDescriptionPipelineLibrary::AddLayout( int iIndex, int iStride )
|
||||||
@@ -39,5 +46,5 @@ void CVkVertexDescriptionPipelineLibrary::AddAttribute( int iBufferIndex, int iL
|
|||||||
|
|
||||||
void CVkVertexDescriptionPipelineLibrary::SetTopology( ETopologyMode eTopology )
|
void CVkVertexDescriptionPipelineLibrary::SetTopology( ETopologyMode eTopology )
|
||||||
{
|
{
|
||||||
|
m_eTopology = VulkanGetTopology(eTopology);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,13 @@ BEGIN_DEFINE_PIPELINE_LIBRARY(VertexDescription)
|
|||||||
void AddAttribute( int iBufferIndex, int iLocation, EVertexFormat eFormat, int iOffset );
|
void AddAttribute( int iBufferIndex, int iLocation, EVertexFormat eFormat, int iOffset );
|
||||||
void SetTopology( ETopologyMode eTopology );
|
void SetTopology( ETopologyMode eTopology );
|
||||||
|
|
||||||
|
VkPrimitiveTopology m_eTopology;
|
||||||
CUtlVector<VkVertexInputAttributeDescription> attributes;
|
CUtlVector<VkVertexInputAttributeDescription> attributes;
|
||||||
CUtlVector<VkVertexInputBindingDescription> layouts;
|
CUtlVector<VkVertexInputBindingDescription> layouts;
|
||||||
END_DEFINE_PIPELINE_LIBRARY()
|
END_DEFINE_PIPELINE_LIBRARY()
|
||||||
|
|
||||||
BEGIN_DEFINE_PIPELINE_LIBRARY(VertexTransform)
|
BEGIN_DEFINE_PIPELINE_LIBRARY(VertexTransform)
|
||||||
|
|
||||||
END_DEFINE_PIPELINE_LIBRARY()
|
END_DEFINE_PIPELINE_LIBRARY()
|
||||||
|
|
||||||
BEGIN_DEFINE_PIPELINE_LIBRARY(PixelShade)
|
BEGIN_DEFINE_PIPELINE_LIBRARY(PixelShade)
|
||||||
|
|||||||
@@ -480,11 +480,13 @@ void CVkRenderContext::Init()
|
|||||||
pCommand->g = 0;
|
pCommand->g = 0;
|
||||||
pCommand->AddSwapchainDependency( (IRenderingObject**)g_vkSwapchainImages.GetData(), DEPENDENCY_MODE_COLOR_CLEAR_DESTINATION );
|
pCommand->AddSwapchainDependency( (IRenderingObject**)g_vkSwapchainImages.GetData(), DEPENDENCY_MODE_COLOR_CLEAR_DESTINATION );
|
||||||
|
|
||||||
CVkVertexDescriptionPipelineLibrary functions = {};
|
CVkVertexDescriptionPipelineLibrary vertexDescription = {};
|
||||||
functions.AddAttribute(0, 0, VERTEX_FORMAT_XYZ32_SFLOAT, 0);
|
vertexDescription.AddAttribute(0, 0, VERTEX_FORMAT_XYZ32_SFLOAT, 0);
|
||||||
functions.AddLayout(0, 12);
|
vertexDescription.AddLayout(0, 12);
|
||||||
functions.SetTopology(TOPOLOGY_MODE_TRIANGLE_LIST);
|
vertexDescription.SetTopology(TOPOLOGY_MODE_TRIANGLE_LIST);
|
||||||
functions.Build();
|
vertexDescription.Build();
|
||||||
|
|
||||||
|
CVkVertexTransformPipelineLibrary vertexTransform = {};
|
||||||
|
|
||||||
CVkEmptyCommand *pPresentCommand = (CVkEmptyCommand*)g_pCommandBufferManager->CreateCommand("Empty");
|
CVkEmptyCommand *pPresentCommand = (CVkEmptyCommand*)g_pCommandBufferManager->CreateCommand("Empty");
|
||||||
pPresentCommand->AddSwapchainDependency( (IRenderingObject**)g_vkSwapchainImages.GetData(), DEPENDENCY_MODE_IMAGE_PRESENT );
|
pPresentCommand->AddSwapchainDependency( (IRenderingObject**)g_vkSwapchainImages.GetData(), DEPENDENCY_MODE_IMAGE_PRESENT );
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "materialsystem/imaterialsystem.h"
|
||||||
#include "vulkan_state.h"
|
#include "vulkan_state.h"
|
||||||
|
|
||||||
IRenderingObject *VulkanGetObject( VkFrameObject_t stObject, int iIndex )
|
IRenderingObject *VulkanGetObject( VkFrameObject_t stObject, int iIndex )
|
||||||
@@ -60,3 +61,15 @@ VkFormat VulkanGetVertexFormat( EVertexFormat eFormat )
|
|||||||
return VK_FORMAT_UNDEFINED;
|
return VK_FORMAT_UNDEFINED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VkPrimitiveTopology VulkanGetTopology( ETopologyMode eMode )
|
||||||
|
{
|
||||||
|
switch ( eMode )
|
||||||
|
{
|
||||||
|
case TOPOLOGY_MODE_POINT_LIST: return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
|
||||||
|
case TOPOLOGY_MODE_LINE_LIST: return VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||||
|
case TOPOLOGY_MODE_LINE_STRIP: return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
|
||||||
|
case TOPOLOGY_MODE_TRIANGLE_LIST: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||||
|
case TOPOLOGY_MODE_TRIANGLE_STRIP: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -273,4 +273,5 @@ VkAccessFlags2 VulkanGetAccessFlags( EDependencyMode eMode );
|
|||||||
VkPipelineStageFlags2 VulkanGetStageFlags( EDependencyMode eMode );
|
VkPipelineStageFlags2 VulkanGetStageFlags( EDependencyMode eMode );
|
||||||
VkImageLayout VulkanGetImageLayout( EDependencyMode eMode );
|
VkImageLayout VulkanGetImageLayout( EDependencyMode eMode );
|
||||||
VkFormat VulkanGetVertexFormat( EVertexFormat eFormat );
|
VkFormat VulkanGetVertexFormat( EVertexFormat eFormat );
|
||||||
|
VkPrimitiveTopology VulkanGetTopology( ETopologyMode eMode );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user