2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

gl_shader_decompiler: Hide local definitions inside an anonymous namespace

This commit is contained in:
ReinUsesLisp 2019-03-31 00:24:10 -03:00
parent da02946f4f
commit 38658b38b4

View file

@ -21,6 +21,8 @@
namespace OpenGL::GLShader {
namespace {
using Tegra::Shader::Attribute;
using Tegra::Shader::AttributeUse;
using Tegra::Shader::Header;
@ -36,11 +38,9 @@ using Operation = const OperationNode&;
enum class Type { Bool, Bool2, Float, Int, Uint, HalfFloat };
namespace {
struct TextureAoffi {};
using TextureArgument = std::pair<Type, Node>;
using TextureIR = std::variant<TextureAoffi, TextureArgument>;
} // namespace
enum : u32 { POSITION_VARYING_LOCATION = 0, GENERIC_VARYING_START_LOCATION = 1 };
constexpr u32 MAX_CONSTBUFFER_ELEMENTS =
@ -97,7 +97,7 @@ private:
};
/// Generates code to use for a swizzle operation.
static std::string GetSwizzle(u32 elem) {
std::string GetSwizzle(u32 elem) {
ASSERT(elem <= 3);
std::string swizzle = ".";
swizzle += "xyzw"[elem];
@ -105,7 +105,7 @@ static std::string GetSwizzle(u32 elem) {
}
/// Translate topology
static std::string GetTopologyName(Tegra::Shader::OutputTopology topology) {
std::string GetTopologyName(Tegra::Shader::OutputTopology topology) {
switch (topology) {
case Tegra::Shader::OutputTopology::PointList:
return "points";
@ -120,7 +120,7 @@ static std::string GetTopologyName(Tegra::Shader::OutputTopology topology) {
}
/// Returns true if an object has to be treated as precise
static bool IsPrecise(Operation operand) {
bool IsPrecise(Operation operand) {
const auto& meta = operand.GetMeta();
if (const auto arithmetic = std::get_if<MetaArithmetic>(&meta)) {
@ -132,7 +132,7 @@ static bool IsPrecise(Operation operand) {
return false;
}
static bool IsPrecise(Node node) {
bool IsPrecise(Node node) {
if (const auto operation = std::get_if<OperationNode>(node)) {
return IsPrecise(*operation);
}
@ -1612,6 +1612,8 @@ private:
ShaderWriter code;
};
} // Anonymous namespace
std::string GetCommonDeclarations() {
const auto cbuf = std::to_string(MAX_CONSTBUFFER_ELEMENTS);
const auto gmem = std::to_string(MAX_GLOBALMEMORY_ELEMENTS);