Renderer: Replace ShaderStage by ShaderModule (a module can handle multiple stages)
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Nz
|
||||
return pipelineLayout;
|
||||
}
|
||||
|
||||
std::shared_ptr<ShaderStage> VulkanDevice::InstantiateShaderStage(const ShaderAst& shaderAst, const ShaderWriter::States& states)
|
||||
std::shared_ptr<ShaderModule> VulkanDevice::InstantiateShaderModule(const ShaderAst& shaderAst, const ShaderWriter::States& states)
|
||||
{
|
||||
auto stage = std::make_shared<VulkanShaderStage>();
|
||||
if (!stage->Create(*this, shaderAst, states))
|
||||
@@ -60,7 +60,7 @@ namespace Nz
|
||||
return stage;
|
||||
}
|
||||
|
||||
std::shared_ptr<ShaderStage> VulkanDevice::InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize)
|
||||
std::shared_ptr<ShaderModule> VulkanDevice::InstantiateShaderModule(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize)
|
||||
{
|
||||
auto stage = std::make_shared<VulkanShaderStage>();
|
||||
if (!stage->Create(*this, type, lang, source, sourceSize))
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Nz
|
||||
{
|
||||
std::vector<VkPipelineShaderStageCreateInfo> shaderStageCreateInfos;
|
||||
|
||||
for (auto&& stagePtr : pipelineInfo.shaderStages)
|
||||
for (auto&& stagePtr : pipelineInfo.shaderModules)
|
||||
{
|
||||
Nz::VulkanShaderStage& vulkanStage = *static_cast<Nz::VulkanShaderStage*>(stagePtr.get());
|
||||
|
||||
|
||||
@@ -20,14 +20,7 @@ namespace Nz
|
||||
writer.SetEnv(env);
|
||||
|
||||
std::vector<UInt32> code = writer.Generate(shader, states);
|
||||
|
||||
if (!m_shaderModule.Create(device, code.data(), code.size() * sizeof(UInt32)))
|
||||
{
|
||||
NazaraError("Failed to create shader module");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Create(device, m_stage, ShaderLanguage::SpirV, code.data(), code.size() * sizeof(UInt32));
|
||||
}
|
||||
|
||||
bool VulkanShaderStage::Create(Vk::Device& device, ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize)
|
||||
|
||||
Reference in New Issue
Block a user