mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-02 19:32:11 +01:00
6fbbc2683e
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.
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
// Copyright 2017 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
#include <fmt/format.h>
|
|
|
|
#include "VideoCommon/ShaderGenCommon.h"
|
|
#include "VideoCommon/VideoCommon.h"
|
|
|
|
namespace UberShader
|
|
{
|
|
// Common functions across all ubershaders
|
|
void WriteUberShaderCommonHeader(ShaderCode& out, APIType api_type,
|
|
const ShaderHostConfig& host_config);
|
|
|
|
// Vertex lighting
|
|
void WriteLightingFunction(ShaderCode& out);
|
|
void WriteVertexLighting(ShaderCode& out, APIType api_type, const char* world_pos_var,
|
|
const char* normal_var, const char* in_color_0_var,
|
|
const char* in_color_1_var, const char* out_color_0_var,
|
|
const char* out_color_1_var);
|
|
|
|
// bitfieldExtract generator for BitField types
|
|
template <typename T>
|
|
std::string BitfieldExtract(std::string_view source, T type)
|
|
{
|
|
return fmt::format("bitfieldExtract({}, {}, {})", source, static_cast<u32>(type.StartBit()),
|
|
static_cast<u32>(type.NumBits()));
|
|
}
|
|
} // namespace UberShader
|