mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
VideoCommon: Make use of fmt outside of shader generators
Migrates most of VideoCommon over to using fmt, with the exception being the shader generator code. The shader generators are quite large and have more corner cases to deal with in terms of conversion (shaders have braces in them, so we need to make sure to escape them). Because of the large amount of code that would need to be converted, the conversion of VideoCommon will be in two parts: - This change (which converts over the general case string formatting), - A follow up change that will specifically deal with converting over the shader generators.
This commit is contained in:
@ -4,6 +4,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "VideoCommon/ShaderGenCommon.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
|
||||
@ -22,9 +27,9 @@ void WriteVertexLighting(ShaderCode& out, APIType api_type, const char* world_po
|
||||
|
||||
// bitfieldExtract generator for BitField types
|
||||
template <typename T>
|
||||
std::string BitfieldExtract(const std::string& source, T type)
|
||||
std::string BitfieldExtract(std::string_view source, T type)
|
||||
{
|
||||
return StringFromFormat("bitfieldExtract(%s, %u, %u)", source.c_str(),
|
||||
static_cast<u32>(type.StartBit()), static_cast<u32>(type.NumBits()));
|
||||
return fmt::format("bitfieldExtract({}, {}, {})", source, static_cast<u32>(type.StartBit()),
|
||||
static_cast<u32>(type.NumBits()));
|
||||
}
|
||||
} // namespace UberShader
|
||||
|
Reference in New Issue
Block a user