Misc: Fix a couple of fmt errors

This commit is contained in:
Stenzek 2023-11-28 13:51:04 +10:00
parent 0af059aae2
commit 333c9fdf6f
No known key found for this signature in database
2 changed files with 24 additions and 17 deletions

View File

@ -329,18 +329,25 @@ ALWAYS_INLINE void SmallStringBase::fmt(fmt::format_string<T...> fmt, T&&... arg
#pragma warning(pop)
#endif
template<>
struct fmt::formatter<SmallStringBase>
{
template<typename ParseContext>
constexpr auto parse(ParseContext& ctx)
{
return ctx.begin();
}
#define MAKE_FORMATTER(type) \
template<> \
struct fmt::formatter<type> \
{ \
template<typename ParseContext> \
constexpr auto parse(ParseContext& ctx) \
{ \
return ctx.begin(); \
} \
\
template<typename FormatContext> \
auto format(const type& str, FormatContext& ctx) \
{ \
return fmt::format_to(ctx.out(), "{}", str.view()); \
} \
};
template<typename FormatContext>
auto format(const SmallStringBase& str, FormatContext& ctx)
{
return fmt::format_to(ctx.out(), "{}", str.view());
}
};
MAKE_FORMATTER(TinyString);
MAKE_FORMATTER(SmallString);
MAKE_FORMATTER(LargeString);
#undef MAKE_FORMATTER

View File

@ -358,9 +358,9 @@ GLuint OpenGLDevice::CompileProgram(const GPUPipeline::GraphicsConfig& plconfig)
}
else
{
glBindAttribLocation(
program_id, i,
TinyString::from_fmt("{}{}", semantic_vars[static_cast<u8>(va.semantic.GetValue())], va.semantic_index));
glBindAttribLocation(program_id, i,
TinyString::from_fmt("{}{}", semantic_vars[static_cast<u8>(va.semantic.GetValue())],
static_cast<u8>(va.semantic_index)));
}
}