mirror of https://git.suyu.dev/suyu/suyu
gl_shader_decompiler: Hide local definitions inside an anonymous namespace
This commit is contained in:
parent
da02946f4f
commit
38658b38b4
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
namespace OpenGL::GLShader {
|
namespace OpenGL::GLShader {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
using Tegra::Shader::Attribute;
|
using Tegra::Shader::Attribute;
|
||||||
using Tegra::Shader::AttributeUse;
|
using Tegra::Shader::AttributeUse;
|
||||||
using Tegra::Shader::Header;
|
using Tegra::Shader::Header;
|
||||||
|
@ -36,11 +38,9 @@ using Operation = const OperationNode&;
|
||||||
|
|
||||||
enum class Type { Bool, Bool2, Float, Int, Uint, HalfFloat };
|
enum class Type { Bool, Bool2, Float, Int, Uint, HalfFloat };
|
||||||
|
|
||||||
namespace {
|
|
||||||
struct TextureAoffi {};
|
struct TextureAoffi {};
|
||||||
using TextureArgument = std::pair<Type, Node>;
|
using TextureArgument = std::pair<Type, Node>;
|
||||||
using TextureIR = std::variant<TextureAoffi, TextureArgument>;
|
using TextureIR = std::variant<TextureAoffi, TextureArgument>;
|
||||||
} // namespace
|
|
||||||
|
|
||||||
enum : u32 { POSITION_VARYING_LOCATION = 0, GENERIC_VARYING_START_LOCATION = 1 };
|
enum : u32 { POSITION_VARYING_LOCATION = 0, GENERIC_VARYING_START_LOCATION = 1 };
|
||||||
constexpr u32 MAX_CONSTBUFFER_ELEMENTS =
|
constexpr u32 MAX_CONSTBUFFER_ELEMENTS =
|
||||||
|
@ -97,7 +97,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Generates code to use for a swizzle operation.
|
/// Generates code to use for a swizzle operation.
|
||||||
static std::string GetSwizzle(u32 elem) {
|
std::string GetSwizzle(u32 elem) {
|
||||||
ASSERT(elem <= 3);
|
ASSERT(elem <= 3);
|
||||||
std::string swizzle = ".";
|
std::string swizzle = ".";
|
||||||
swizzle += "xyzw"[elem];
|
swizzle += "xyzw"[elem];
|
||||||
|
@ -105,7 +105,7 @@ static std::string GetSwizzle(u32 elem) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translate topology
|
/// Translate topology
|
||||||
static std::string GetTopologyName(Tegra::Shader::OutputTopology topology) {
|
std::string GetTopologyName(Tegra::Shader::OutputTopology topology) {
|
||||||
switch (topology) {
|
switch (topology) {
|
||||||
case Tegra::Shader::OutputTopology::PointList:
|
case Tegra::Shader::OutputTopology::PointList:
|
||||||
return "points";
|
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
|
/// 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();
|
const auto& meta = operand.GetMeta();
|
||||||
|
|
||||||
if (const auto arithmetic = std::get_if<MetaArithmetic>(&meta)) {
|
if (const auto arithmetic = std::get_if<MetaArithmetic>(&meta)) {
|
||||||
|
@ -132,7 +132,7 @@ static bool IsPrecise(Operation operand) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsPrecise(Node node) {
|
bool IsPrecise(Node node) {
|
||||||
if (const auto operation = std::get_if<OperationNode>(node)) {
|
if (const auto operation = std::get_if<OperationNode>(node)) {
|
||||||
return IsPrecise(*operation);
|
return IsPrecise(*operation);
|
||||||
}
|
}
|
||||||
|
@ -1612,6 +1612,8 @@ private:
|
||||||
ShaderWriter code;
|
ShaderWriter code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // Anonymous namespace
|
||||||
|
|
||||||
std::string GetCommonDeclarations() {
|
std::string GetCommonDeclarations() {
|
||||||
const auto cbuf = std::to_string(MAX_CONSTBUFFER_ELEMENTS);
|
const auto cbuf = std::to_string(MAX_CONSTBUFFER_ELEMENTS);
|
||||||
const auto gmem = std::to_string(MAX_GLOBALMEMORY_ELEMENTS);
|
const auto gmem = std::to_string(MAX_GLOBALMEMORY_ELEMENTS);
|
||||||
|
|
Loading…
Reference in New Issue