Change shader handling
This commit is contained in:
24
openVulkanoCpp/Vulkan/VulkanDrawContext.cpp
Normal file
24
openVulkanoCpp/Vulkan/VulkanDrawContext.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "VulkanDrawContext.hpp"
|
||||
#include "Scene/Shader.hpp"
|
||||
#include "Scene/VulkanShader.hpp"
|
||||
|
||||
namespace openVulkanoCpp::Vulkan
|
||||
{
|
||||
void VulkanDrawContext::EncodeShader(Scene::Shader* shader)
|
||||
{
|
||||
VulkanShader* vkShader = static_cast<VulkanShader*>(shader->renderShader);
|
||||
if (!vkShader)
|
||||
{
|
||||
vkShader = renderer->GetResourceManager().CreateShader(shader);
|
||||
}
|
||||
else if (m_lastShader == vkShader) return; // Skip it if shader is already bound
|
||||
vkShader->Record(commandBuffer, currentImageId);
|
||||
m_lastShader = vkShader;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user