some fixes
This commit is contained in:
@@ -1,57 +1,43 @@
|
||||
#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(Functions)
|
||||
CUtlBuffer<unsigned char> vertexShaderData;
|
||||
VkShaderModuleCreateInfo stVertexModule = {};
|
||||
VkPipelineShaderStageCreateInfo stVertexStage = {};
|
||||
if (szVertexShader)
|
||||
{
|
||||
BEGIN_BUILD_PIPELINE_LIBRARY(VertexDescription)
|
||||
library.flags = VK_GRAPHICS_PIPELINE_LIBRARY_VERTEX_INPUT_INTERFACE_BIT_EXT;
|
||||
|
||||
VkPipelineVertexInputStateCreateInfo vertexInput = {};
|
||||
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();
|
||||
|
||||
IFileHandle *pFile = filesystem->Open(szVertexShader, FILEMODE_READ);
|
||||
vertexShaderData = filesystem->Read(pFile);
|
||||
pFile->Close();
|
||||
|
||||
stVertexModule.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||
stVertexModule.codeSize = vertexShaderData.GetSize();
|
||||
stVertexModule.pCode = (uint32_t*)vertexShaderData.GetMemory();
|
||||
|
||||
stVertexStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
stVertexStage.pName = szVertexShaderMain;
|
||||
stVertexStage.pNext = &stVertexModule;
|
||||
}
|
||||
|
||||
CUtlBuffer<unsigned char> pixelShaderData;
|
||||
VkShaderModuleCreateInfo stPixelModule = {};
|
||||
VkPipelineShaderStageCreateInfo stPixelStage = {};
|
||||
if (szPixelShader)
|
||||
{
|
||||
|
||||
IFileHandle *pFile = filesystem->Open(szPixelShader, FILEMODE_READ);
|
||||
pixelShaderData = filesystem->Read(pFile);
|
||||
pFile->Close();
|
||||
|
||||
stPixelModule.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||
stPixelModule.codeSize = pixelShaderData.GetSize();
|
||||
stPixelModule.pCode = (uint32_t*)pixelShaderData.GetMemory();
|
||||
|
||||
stPixelStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
stPixelStage.pName = szPixelShaderMain;
|
||||
stPixelStage.pNext = &stPixelModule;
|
||||
}
|
||||
pipeline.pVertexInputState = &vertexInput;
|
||||
END_BUILD_PIPELINE_LIBRARY()
|
||||
void CVkFunctionsPipelineLibrary::SetVertex( const char *szFile, const char *szMain )
|
||||
|
||||
void CVkVertexDescriptionPipelineLibrary::AddLayout( int iIndex, int iStride )
|
||||
{
|
||||
szVertexShader = szFile;
|
||||
szVertexShaderMain = szMain;
|
||||
VkVertexInputBindingDescription layout = {};
|
||||
layout.binding = iIndex;
|
||||
layout.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
|
||||
layout.stride = iStride;
|
||||
layouts.AppendTail(layout);
|
||||
}
|
||||
|
||||
void CVkFunctionsPipelineLibrary::SetPixel( const char *szFile, const char *szMain )
|
||||
void CVkVertexDescriptionPipelineLibrary::AddAttribute( int iBufferIndex, int iLocation, EVertexFormat eFormat, int iOffset )
|
||||
{
|
||||
szPixelShader = szFile;
|
||||
szPixelShaderMain = szMain;
|
||||
VkVertexInputAttributeDescription attribute = {};
|
||||
attribute.binding = iBufferIndex;
|
||||
attribute.location = iLocation;
|
||||
attribute.format = VulkanGetVertexFormat(eFormat);
|
||||
attribute.offset = iOffset;
|
||||
attributes.AppendTail(attribute);
|
||||
}
|
||||
|
||||
void CVkVertexDescriptionPipelineLibrary::SetTopology( ETopologyMode eTopology )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user