Allow error message to be formatted
This commit is contained in:
committed by
Jérôme Leclercq
parent
25957c4b7f
commit
a741672a51
@@ -51,7 +51,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError(std::string("Failed to instantiate texture: ") + e.what());
|
||||
NazaraError("failed to instantiate texture: {0}", e.what());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Nz
|
||||
|
||||
if (!newTexture->Copy(oldTexture, Boxui(0, 0, 0, oldSize.x, oldSize.y, oldSize.z)))
|
||||
{
|
||||
NazaraError("Failed to update texture");
|
||||
NazaraError("failed to update texture");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,11 +35,7 @@ namespace Nz
|
||||
if (textureProperty.type != textureData.imageType)
|
||||
{
|
||||
// TODO: Use EnumToString to show image type as string
|
||||
NazaraError("unmatching texture type: material property is of type " +
|
||||
std::to_string(UnderlyingCast(textureProperty.type)) +
|
||||
" but shader sampler is of type " +
|
||||
std::to_string(UnderlyingCast(textureData.imageType)));
|
||||
|
||||
NazaraError("unmatching texture type: material property is of type {0} but shader sampler is of type {1}", UnderlyingCast(textureProperty.type), UnderlyingCast(textureData.imageType));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +50,7 @@ namespace Nz
|
||||
m_optionHash = optionData->hash;
|
||||
}
|
||||
else
|
||||
NazaraError("option " + m_optionName + " is not a boolean option (got " + ToString(optionData->type) + ")");
|
||||
NazaraError("option {0} is not a boolean option (got {1})", m_optionName, nzsl::Ast::ToString(optionData->type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,14 +66,14 @@ namespace Nz
|
||||
const auto& arrayType = std::get<nzsl::Ast::ArrayType>(*varType);
|
||||
const auto& innerType = arrayType.containedType->type;
|
||||
if (!IsSamplerType(innerType))
|
||||
throw std::runtime_error("unexpected type " + ToString(innerType) + " in array " + ToString(arrayType));
|
||||
throw std::runtime_error("unexpected type " + nzsl::Ast::ToString(innerType) + " in array " + nzsl::Ast::ToString(arrayType));
|
||||
|
||||
arraySize = arrayType.length;
|
||||
bindingType = ShaderBindingType::Sampler;
|
||||
varType = &innerType;
|
||||
}
|
||||
else
|
||||
throw std::runtime_error("unexpected type " + ToString(varType));
|
||||
throw std::runtime_error("unexpected type " + nzsl::Ast::ToString(varType));
|
||||
|
||||
// TODO: Get more precise shader stage type
|
||||
m_pipelineLayoutInfo.bindings.push_back({
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Nz
|
||||
nzsl::Ast::ModulePtr newShaderModule = resolver->Resolve(name);
|
||||
if (!newShaderModule)
|
||||
{
|
||||
NazaraError("failed to retrieve updated shader module " + name);
|
||||
NazaraError("failed to retrieve updated shader module {0}", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError("failed to retrieve updated shader module " + name + ": " + e.what());
|
||||
NazaraError("failed to retrieve updated shader module {0}: {1}", name, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user