24 lines
740 B
C++
24 lines
740 B
C++
/*
|
|
* 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;
|
|
}
|
|
} |