Pipeline key now includes the VertexBufferLayout
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
This commit is contained in:
@@ -67,13 +67,15 @@ KRPipelineManager::~KRPipelineManager()
|
||||
|
||||
KRPipeline* KRPipelineManager::getPipeline(KRSurface& surface, const PipelineInfo& info)
|
||||
{
|
||||
std::pair<std::string, std::vector<int> > key;
|
||||
key.first = *info.shader_name;
|
||||
key.second.push_back(surface.m_deviceHandle);
|
||||
key.second.push_back(surface.m_swapChain->m_imageFormat);
|
||||
key.second.push_back(surface.m_swapChain->m_extent.width);
|
||||
key.second.push_back(surface.m_swapChain->m_extent.height);
|
||||
// key.second.push_back(info.layout); // FINDME!! KIPG!! HACK!!! Need to add a unique key generated from info.layout
|
||||
const char* szShaderName = info.shader_name->c_str();
|
||||
std::vector<std::byte> key;
|
||||
key.insert(key.begin(), (std::byte*)szShaderName, (std::byte*)szShaderName + strlen(szShaderName) + 1); // purposefully include the zero terminator
|
||||
key.insert(key.begin(), (std::byte*)&surface.m_deviceHandle, (std::byte*)&surface.m_deviceHandle + sizeof(surface.m_deviceHandle));
|
||||
key.insert(key.begin(), (std::byte*)&surface.m_swapChain->m_imageFormat, (std::byte*)&surface.m_swapChain->m_imageFormat + sizeof(surface.m_swapChain->m_imageFormat));
|
||||
key.insert(key.begin(), (std::byte*)&surface.m_swapChain->m_extent.width, (std::byte*)&surface.m_swapChain->m_extent.width + sizeof(surface.m_swapChain->m_extent.width));
|
||||
key.insert(key.begin(), (std::byte*)&surface.m_swapChain->m_extent.height, (std::byte*)&surface.m_swapChain->m_extent.height + sizeof(surface.m_swapChain->m_extent.height));
|
||||
key.insert(key.begin(), (std::byte*)info.layout, (std::byte*)info.layout + sizeof(*info.layout));
|
||||
|
||||
// TODO - Add renderPass unique identifier to key
|
||||
PipelineMap::iterator itr = m_pipelines.find(key);
|
||||
if (itr != m_pipelines.end()) {
|
||||
@@ -308,15 +310,3 @@ size_t KRPipelineManager::getPipelineHandlesUsed()
|
||||
{
|
||||
return m_pipelines.size();
|
||||
}
|
||||
|
||||
|
||||
KRPipeline* KRPipelineManager::get(const char* name)
|
||||
{
|
||||
std::pair<std::string, std::vector<int> > key;
|
||||
key.first = name;
|
||||
auto itr = m_pipelines.find(key);
|
||||
if (itr == m_pipelines.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return (*itr).second;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ public:
|
||||
|
||||
KRPipelineManager(KRContext& context);
|
||||
virtual ~KRPipelineManager();
|
||||
KRPipeline* get(const char* szKey);
|
||||
|
||||
KRPipeline* getPipeline(KRSurface& surface, const PipelineInfo& info);
|
||||
|
||||
@@ -63,6 +62,6 @@ public:
|
||||
KRPipeline* m_active_pipeline;
|
||||
|
||||
private:
|
||||
typedef std::map<std::pair<std::string, std::vector<int> >, KRPipeline*> PipelineMap;
|
||||
typedef std::map<std::vector<std::byte>, KRPipeline* > PipelineMap;
|
||||
PipelineMap m_pipelines;
|
||||
};
|
||||
|
||||
@@ -481,11 +481,7 @@ void KRMesh::renderSubmesh(VkCommandBuffer& commandBuffer, int iSubmesh, const K
|
||||
|
||||
if (iVertex + cVertexes >= MAX_VBO_SIZE) {
|
||||
assert(iVertex + (MAX_VBO_SIZE - iVertex) <= cBufferVertexes);
|
||||
if (getIndexCount(0) == 0) {
|
||||
vkCmdDraw(commandBuffer, (MAX_VBO_SIZE - iVertex), 1, iVertex, 0);
|
||||
} else {
|
||||
vkCmdDrawIndexed(commandBuffer, (MAX_VBO_SIZE - iVertex), 1, iVertex, 0, 0);
|
||||
}
|
||||
m_pContext->getMeshManager()->log_draw_call(renderPass->getType(), object_name, material_name, (MAX_VBO_SIZE - iVertex));
|
||||
|
||||
cVertexes -= (MAX_VBO_SIZE - iVertex);
|
||||
|
||||
Reference in New Issue
Block a user