added barriers, started working on libraries
This commit is contained in:
57
materialsystem/vulkan/libraries/raster.cpp
Normal file
57
materialsystem/vulkan/libraries/raster.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "../vulkan_state.h"
|
||||
#include "../raster_libraries.h"
|
||||
#include "tier1/utlbuffer.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)
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
END_BUILD_PIPELINE_LIBRARY()
|
||||
void CVkFunctionsPipelineLibrary::SetVertex( const char *szFile, const char *szMain )
|
||||
{
|
||||
szVertexShader = szFile;
|
||||
szVertexShaderMain = szMain;
|
||||
}
|
||||
|
||||
void CVkFunctionsPipelineLibrary::SetPixel( const char *szFile, const char *szMain )
|
||||
{
|
||||
szPixelShader = szFile;
|
||||
szPixelShaderMain = szMain;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user