Adding combined image samplers

This commit is contained in:
Dynamitos
2024-04-26 11:42:28 +02:00
parent 54cd77beb2
commit 93ab9e38f0
9 changed files with 55 additions and 23 deletions
+8
View File
@@ -81,10 +81,18 @@ struct Map : public Tree<K, Pair<K, V>, _KeyFun<K, Pair<K, V>>, Compare, Allocat
{
return Super::remove(key);
}
constexpr bool exists(const key_type& key) const
{
return Super::find(key) != Super::end();
}
constexpr bool exists(const key_type& key)
{
return Super::find(key) != Super::end();
}
constexpr bool contains(const key_type& key) const
{
return exists(key);
}
constexpr bool contains(const key_type& key)
{
return exists(key);
+5 -1
View File
@@ -314,7 +314,7 @@ protected:
constexpr iterator find(const key_type& key) const
{
Node* it = root;
while (!equal(it->data, key))
while (it != nullptr && !equal(it->data, key))
{
if (comp(key, keyFun(it->data)))
{
@@ -325,6 +325,10 @@ protected:
it = it->rightChild;
}
}
if (it == nullptr)
{
return end();
}
return iterator(it);
}
constexpr Pair<iterator, bool> insert(const NodeData& data)
+1 -1
View File
@@ -21,7 +21,7 @@ Slang::ComPtr<slang::IBlob> Seele::generateShader(const ShaderCreateInfo& create
option[0].value = slang::CompilerOptionValue();
option[0].value.kind = slang::CompilerOptionValueKind::Int;
option[0].value.intValue0 = 1;
option[1].name = slang::CompilerOptionName::IgnoreCapabilities;
option[1].name = slang::CompilerOptionName::EmitSpirvViaGLSL;
option[1].value = slang::CompilerOptionValue();
option[1].value.kind = slang::CompilerOptionValueKind::Int;
option[1].value.intValue0 = 1;
+9 -2
View File
@@ -246,7 +246,7 @@ void CombinedTextureParameter::updateDescriptorSet(Gfx::PDescriptorSet descripto
void CombinedTextureParameter::generateDeclaration(std::ofstream& stream) const
{
stream << "\tTexture2D " << key << ";\n";
stream << "\tSampler2D " << key << ";\n";
}
void CombinedTextureParameter::save(ArchiveBuffer& buffer) const
@@ -408,7 +408,14 @@ std::string SampleExpression::evaluate(Map<std::string, std::string>& varState)
{
std::string varName = fmt::format("exp_{}", key);
varState[key] = varName;
return fmt::format("let {} = {}.Sample({}, {});\n", varName, varState[inputs.at("texture").source], varState[inputs.at("sampler").source], varState[inputs.at("coords").source]);
if (inputs.contains("texture"))
{
return fmt::format("let {} = {}.Sample({}, {});\n", varName, varState[inputs.at("texture").source], varState[inputs.at("sampler").source], varState[inputs.at("coords").source]);
}
else
{
return fmt::format("let {} = {}.Sample({});\n", varName, varState[inputs.at("sampler").source], varState[inputs.at("coords").source]);
}
}
void SampleExpression::save(ArchiveBuffer& buffer) const