Shader: Add initial support for options (WIP)
This commit is contained in:
@@ -60,10 +60,10 @@ namespace Nz
|
||||
return stage;
|
||||
}
|
||||
|
||||
std::shared_ptr<ShaderModule> VulkanDevice::InstantiateShaderModule(ShaderStageTypeFlags stages, ShaderLanguage lang, const void* source, std::size_t sourceSize)
|
||||
std::shared_ptr<ShaderModule> VulkanDevice::InstantiateShaderModule(ShaderStageTypeFlags stages, ShaderLanguage lang, const void* source, std::size_t sourceSize, const ShaderWriter::States& states)
|
||||
{
|
||||
auto stage = std::make_shared<VulkanShaderModule>();
|
||||
if (!stage->Create(*this, stages, lang, source, sourceSize))
|
||||
if (!stage->Create(*this, stages, lang, source, sourceSize, states))
|
||||
throw std::runtime_error("failed to instanciate vulkan shader module");
|
||||
|
||||
return stage;
|
||||
|
||||
@@ -65,10 +65,10 @@ namespace Nz
|
||||
writer.SetEnv(env);
|
||||
|
||||
std::vector<UInt32> code = writer.Generate(shaderAst, states);
|
||||
return Create(device, shaderStages, ShaderLanguage::SpirV, code.data(), code.size() * sizeof(UInt32));
|
||||
return Create(device, shaderStages, ShaderLanguage::SpirV, code.data(), code.size() * sizeof(UInt32), {});
|
||||
}
|
||||
|
||||
bool VulkanShaderModule::Create(Vk::Device& device, ShaderStageTypeFlags shaderStages, ShaderLanguage lang, const void* source, std::size_t sourceSize)
|
||||
bool VulkanShaderModule::Create(Vk::Device& device, ShaderStageTypeFlags shaderStages, ShaderLanguage lang, const void* source, std::size_t sourceSize, const ShaderWriter::States& states)
|
||||
{
|
||||
switch (lang)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ namespace Nz
|
||||
|
||||
Nz::ShaderLang::Parser parser;
|
||||
Nz::ShaderAst::StatementPtr shaderAst = parser.Parse(tokens);
|
||||
return Create(device, shaderStages, shaderAst, {});
|
||||
return Create(device, shaderStages, shaderAst, states);
|
||||
}
|
||||
|
||||
case ShaderLanguage::SpirV:
|
||||
|
||||
Reference in New Issue
Block a user