Temp fix for NZSL update
This commit is contained in:
parent
b10e0a7408
commit
8e8bee7037
|
|
@ -67,7 +67,7 @@ namespace Nz
|
||||||
inline FaceFilling GetFaceFilling() const;
|
inline FaceFilling GetFaceFilling() const;
|
||||||
inline MaterialPassFlags GetFlags() const;
|
inline MaterialPassFlags GetFlags() const;
|
||||||
inline float GetLineWidth() const;
|
inline float GetLineWidth() const;
|
||||||
inline const nzsl::Ast::ConstantValue& GetOptionValue(std::size_t optionIndex) const;
|
inline const nzsl::Ast::ConstantSingleValue& GetOptionValue(std::size_t optionIndex) const;
|
||||||
inline const std::shared_ptr<MaterialPipeline>& GetPipeline() const;
|
inline const std::shared_ptr<MaterialPipeline>& GetPipeline() const;
|
||||||
inline const MaterialPipelineInfo& GetPipelineInfo() const;
|
inline const MaterialPipelineInfo& GetPipelineInfo() const;
|
||||||
inline float GetPointSize() const;
|
inline float GetPointSize() const;
|
||||||
|
|
@ -98,7 +98,7 @@ namespace Nz
|
||||||
inline void SetFaceCulling(FaceSide faceSide);
|
inline void SetFaceCulling(FaceSide faceSide);
|
||||||
inline void SetFaceFilling(FaceFilling filling);
|
inline void SetFaceFilling(FaceFilling filling);
|
||||||
inline void SetLineWidth(float lineWidth);
|
inline void SetLineWidth(float lineWidth);
|
||||||
inline void SetOptionValue(std::size_t optionIndex, nzsl::Ast::ConstantValue value);
|
inline void SetOptionValue(std::size_t optionIndex, nzsl::Ast::ConstantSingleValue value);
|
||||||
inline void SetPointSize(float pointSize);
|
inline void SetPointSize(float pointSize);
|
||||||
inline void SetPrimitiveMode(PrimitiveMode mode);
|
inline void SetPrimitiveMode(PrimitiveMode mode);
|
||||||
inline void SetTexture(std::size_t textureIndex, std::shared_ptr<Texture> texture);
|
inline void SetTexture(std::size_t textureIndex, std::shared_ptr<Texture> texture);
|
||||||
|
|
@ -142,7 +142,7 @@ namespace Nz
|
||||||
bool dataInvalidated = true;
|
bool dataInvalidated = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::array<nzsl::Ast::ConstantValue, 64> m_optionValues;
|
std::array<nzsl::Ast::ConstantSingleValue, 64> m_optionValues;
|
||||||
std::shared_ptr<const MaterialSettings> m_settings;
|
std::shared_ptr<const MaterialSettings> m_settings;
|
||||||
std::vector<MaterialTexture> m_textures;
|
std::vector<MaterialTexture> m_textures;
|
||||||
std::vector<ShaderEntry> m_shaders;
|
std::vector<ShaderEntry> m_shaders;
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ namespace Nz
|
||||||
return m_pipelineInfo.lineWidth;
|
return m_pipelineInfo.lineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const nzsl::Ast::ConstantValue& MaterialPass::GetOptionValue(std::size_t optionIndex) const
|
inline const nzsl::Ast::ConstantSingleValue& MaterialPass::GetOptionValue(std::size_t optionIndex) const
|
||||||
{
|
{
|
||||||
assert(optionIndex < m_optionValues.size());
|
assert(optionIndex < m_optionValues.size());
|
||||||
return m_optionValues[optionIndex];
|
return m_optionValues[optionIndex];
|
||||||
|
|
@ -566,7 +566,7 @@ namespace Nz
|
||||||
InvalidatePipeline();
|
InvalidatePipeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MaterialPass::SetOptionValue(std::size_t optionIndex, nzsl::Ast::ConstantValue value)
|
inline void MaterialPass::SetOptionValue(std::size_t optionIndex, nzsl::Ast::ConstantSingleValue value)
|
||||||
{
|
{
|
||||||
assert(optionIndex < m_optionValues.size());
|
assert(optionIndex < m_optionValues.size());
|
||||||
if (m_optionValues[optionIndex] != value)
|
if (m_optionValues[optionIndex] != value)
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace Nz
|
||||||
struct Option
|
struct Option
|
||||||
{
|
{
|
||||||
UInt32 hash;
|
UInt32 hash;
|
||||||
nzsl::Ast::ConstantValue value;
|
nzsl::Ast::ConstantSingleValue value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Shader
|
struct Shader
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ namespace Nz
|
||||||
|
|
||||||
struct Config
|
struct Config
|
||||||
{
|
{
|
||||||
std::unordered_map<UInt32, nzsl::Ast::ConstantValue> optionValues;
|
std::unordered_map<UInt32, nzsl::Ast::ConstantSingleValue> optionValues;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ConfigEqual
|
struct ConfigEqual
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,11 @@ namespace Nz
|
||||||
|
|
||||||
renderPipelineInfo.pipelineLayout = m_pipelineInfo.settings->GetRenderPipelineLayout();
|
renderPipelineInfo.pipelineLayout = m_pipelineInfo.settings->GetRenderPipelineLayout();
|
||||||
|
|
||||||
std::unordered_map<UInt32, nzsl::Ast::ConstantValue> optionValues;
|
std::unordered_map<UInt32, nzsl::Ast::ConstantSingleValue> optionValues;
|
||||||
for (std::size_t i = 0; i < m_pipelineInfo.optionCount; ++i)
|
for (std::size_t i = 0; i < m_pipelineInfo.optionCount; ++i)
|
||||||
{
|
{
|
||||||
const auto& option = m_pipelineInfo.optionValues[i];
|
const auto& option = m_pipelineInfo.optionValues[i];
|
||||||
|
|
||||||
optionValues[option.hash] = option.value;
|
optionValues[option.hash] = option.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,14 @@ namespace Nz
|
||||||
if (it == m_combinations.end())
|
if (it == m_combinations.end())
|
||||||
{
|
{
|
||||||
nzsl::ShaderWriter::States states;
|
nzsl::ShaderWriter::States states;
|
||||||
states.optionValues = config.optionValues;
|
// TODO: Remove this when arrays are accepted as config values
|
||||||
|
for (const auto& [optionHash, optionValue] : config.optionValues)
|
||||||
|
{
|
||||||
|
std::visit([&](auto&& arg)
|
||||||
|
{
|
||||||
|
states.optionValues[optionHash] = arg;
|
||||||
|
}, optionValue);
|
||||||
|
}
|
||||||
states.shaderModuleResolver = Graphics::Instance()->GetShaderModuleResolver();
|
states.shaderModuleResolver = Graphics::Instance()->GetShaderModuleResolver();
|
||||||
|
|
||||||
std::shared_ptr<ShaderModule> stage = Graphics::Instance()->GetRenderDevice()->InstantiateShaderModule(m_shaderStages, *m_shaderModule, std::move(states));
|
std::shared_ptr<ShaderModule> stage = Graphics::Instance()->GetRenderDevice()->InstantiateShaderModule(m_shaderStages, *m_shaderModule, std::move(states));
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ task("compile-shaders")
|
||||||
print("Compiling shaders...")
|
print("Compiling shaders...")
|
||||||
for _, filepath in pairs(os.files("src/Nazara/*/Resources/**.nzsl")) do
|
for _, filepath in pairs(os.files("src/Nazara/*/Resources/**.nzsl")) do
|
||||||
print(" - Compiling " .. filepath)
|
print(" - Compiling " .. filepath)
|
||||||
local argv = {"--compile=nzslb", "--partial", "--header-file", filepath }
|
local argv = {"--compile=nzslb-header", "--partial", filepath }
|
||||||
if option.get("measure") then
|
if option.get("measure") then
|
||||||
table.insert(argv, "--measure")
|
table.insert(argv, "--measure")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ rule("nzsl.compile.shaders")
|
||||||
|
|
||||||
-- add commands
|
-- add commands
|
||||||
batchcmds:show_progress(opt.progress, "${color.build.object}compiling shader %s", shaderfile)
|
batchcmds:show_progress(opt.progress, "${color.build.object}compiling shader %s", shaderfile)
|
||||||
local argv = {"--compile=nzslb", "--partial", "--header-file"}
|
local argv = {"--compile=nzslb-header", "--partial"}
|
||||||
|
|
||||||
-- handle --log-format
|
-- handle --log-format
|
||||||
local kind = target:data("plugin.project.kind") or ""
|
local kind = target:data("plugin.project.kind") or ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue