Skip to content
Permalink
Browse files
Merge pull request #8508 from lioncash/fmt-tex
VideoCommon/TextureConverterShaderGen: Convert over to fmt
  • Loading branch information
Helios747 committed Dec 8, 2019
2 parents 9ef50a1 + 0f28f40 commit bac8c06
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 104 deletions.
@@ -6,11 +6,14 @@

#include <cstdarg>
#include <cstring>
#include <iterator>
#include <map>
#include <string>
#include <type_traits>
#include <vector>

#include <fmt/format.h>

#include "Common/CommonTypes.h"
#include "Common/StringUtil.h"
#include "VideoCommon/VideoCommon.h"
@@ -101,6 +104,8 @@ class ShaderCode : public ShaderGeneratorInterface
public:
ShaderCode() { m_buffer.reserve(16384); }
const std::string& GetBuffer() const { return m_buffer; }

// Deprecated: Writes format strings using traditional printf format strings.
void Write(const char* fmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
@@ -112,6 +117,13 @@ class ShaderCode : public ShaderGeneratorInterface
va_end(arglist);
}

// Writes format strings using fmtlib format strings.
template <typename... Args>
void WriteFmt(std::string_view format, Args&&... args)
{
fmt::format_to(std::back_inserter(m_buffer), format, std::forward<Args>(args)...);
}

protected:
std::string m_buffer;
};

0 comments on commit bac8c06

Please sign in to comment.