1
0
Fork 0

Merge pull request #4654 from tgsm/video-nested

video_core: use nested namespaces
This commit is contained in:
Pengfei Zhu 2019-02-19 21:44:38 +08:00 committed by GitHub
commit f6d0e43c77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 52 additions and 120 deletions

View File

@ -28,9 +28,7 @@
#include "video_core/vertex_loader.h" #include "video_core/vertex_loader.h"
#include "video_core/video_core.h" #include "video_core/video_core.h"
namespace Pica { namespace Pica::CommandProcessor {
namespace CommandProcessor {
static int vs_float_regs_counter = 0; static int vs_float_regs_counter = 0;
static u32 vs_uniform_write_buffer[4]; static u32 vs_uniform_write_buffer[4];
@ -675,6 +673,4 @@ void ProcessCommandList(const u32* list, u32 size) {
} }
} }
} // namespace CommandProcessor } // namespace Pica::CommandProcessor
} // namespace Pica

View File

@ -8,9 +8,7 @@
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_types.h" #include "common/common_types.h"
namespace Pica { namespace Pica::CommandProcessor {
namespace CommandProcessor {
union CommandHeader { union CommandHeader {
u32 hex; u32 hex;
@ -36,6 +34,4 @@ static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect
void ProcessCommandList(const u32* list, u32 size); void ProcessCommandList(const u32* list, u32 size);
} // namespace CommandProcessor } // namespace Pica::CommandProcessor
} // namespace Pica

View File

@ -11,11 +11,9 @@ namespace OpenGL {
struct ScreenInfo; struct ScreenInfo;
} }
namespace Pica { namespace Pica::Shader {
namespace Shader {
struct OutputVertex; struct OutputVertex;
} } // namespace Pica::Shader
} // namespace Pica
namespace VideoCore { namespace VideoCore {

View File

@ -9,8 +9,7 @@
#include "common/vector_math.h" #include "common/vector_math.h"
#include "video_core/pica_types.h" #include "video_core/pica_types.h"
namespace Pica { namespace Pica::Shader {
namespace Shader {
/// Helper structure used to keep track of data useful for inspection of shader emulation /// Helper structure used to keep track of data useful for inspection of shader emulation
template <bool full_debugging> template <bool full_debugging>
@ -182,5 +181,4 @@ inline void Record(DebugData<true>& debug_data, u32 offset, ValueType value) {
debug_data.records[offset].mask |= type; debug_data.records[offset].mask |= type;
} }
} // namespace Shader } // namespace Pica::Shader
} // namespace Pica

View File

@ -17,9 +17,7 @@
#endif // ARCHITECTURE_x86_64 #endif // ARCHITECTURE_x86_64
#include "video_core/video_core.h" #include "video_core/video_core.h"
namespace Pica { namespace Pica::Shader {
namespace Shader {
void OutputVertex::ValidateSemantics(const RasterizerRegs& regs) { void OutputVertex::ValidateSemantics(const RasterizerRegs& regs) {
unsigned int num_attributes = regs.vs_output_total; unsigned int num_attributes = regs.vs_output_total;
@ -161,6 +159,4 @@ void Shutdown() {
#endif // ARCHITECTURE_x86_64 #endif // ARCHITECTURE_x86_64
} }
} // namespace Shader } // namespace Pica::Shader
} // namespace Pica

View File

@ -22,9 +22,7 @@ using nihstro::DestRegister;
using nihstro::RegisterType; using nihstro::RegisterType;
using nihstro::SourceRegister; using nihstro::SourceRegister;
namespace Pica { namespace Pica::Shader {
namespace Shader {
constexpr unsigned MAX_PROGRAM_CODE_LENGTH = 4096; constexpr unsigned MAX_PROGRAM_CODE_LENGTH = 4096;
constexpr unsigned MAX_SWIZZLE_DATA_LENGTH = 4096; constexpr unsigned MAX_SWIZZLE_DATA_LENGTH = 4096;
@ -262,6 +260,4 @@ public:
ShaderEngine* GetEngine(); ShaderEngine* GetEngine();
void Shutdown(); void Shutdown();
} // namespace Shader } // namespace Pica::Shader
} // namespace Pica

View File

@ -25,9 +25,7 @@ using nihstro::RegisterType;
using nihstro::SourceRegister; using nihstro::SourceRegister;
using nihstro::SwizzlePattern; using nihstro::SwizzlePattern;
namespace Pica { namespace Pica::Shader {
namespace Shader {
struct CallStackElement { struct CallStackElement {
u32 final_address; // Address upon which we jump to return_address u32 final_address; // Address upon which we jump to return_address
@ -696,6 +694,4 @@ DebugData<true> InterpreterEngine::ProduceDebugInfo(const ShaderSetup& setup,
return debug_data; return debug_data;
} }
} // namespace Shader } // namespace Pica::Shader
} // namespace Pica

View File

@ -7,9 +7,7 @@
#include "video_core/shader/debug_data.h" #include "video_core/shader/debug_data.h"
#include "video_core/shader/shader.h" #include "video_core/shader/shader.h"
namespace Pica { namespace Pica::Shader {
namespace Shader {
class InterpreterEngine final : public ShaderEngine { class InterpreterEngine final : public ShaderEngine {
public: public:
@ -27,6 +25,4 @@ public:
const ShaderRegs& config) const; const ShaderRegs& config) const;
}; };
} // namespace Shader } // namespace Pica::Shader
} // namespace Pica

View File

@ -7,8 +7,7 @@
#include "video_core/shader/shader_jit_x64.h" #include "video_core/shader/shader_jit_x64.h"
#include "video_core/shader/shader_jit_x64_compiler.h" #include "video_core/shader/shader_jit_x64_compiler.h"
namespace Pica { namespace Pica::Shader {
namespace Shader {
JitX64Engine::JitX64Engine() = default; JitX64Engine::JitX64Engine() = default;
JitX64Engine::~JitX64Engine() = default; JitX64Engine::~JitX64Engine() = default;
@ -43,5 +42,4 @@ void JitX64Engine::Run(const ShaderSetup& setup, UnitState& state) const {
shader->Run(setup, state, setup.engine_data.entry_point); shader->Run(setup, state, setup.engine_data.entry_point);
} }
} // namespace Shader } // namespace Pica::Shader
} // namespace Pica

View File

@ -9,8 +9,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "video_core/shader/shader.h" #include "video_core/shader/shader.h"
namespace Pica { namespace Pica::Shader {
namespace Shader {
class JitShader; class JitShader;
@ -26,5 +25,4 @@ private:
std::unordered_map<u64, std::unique_ptr<JitShader>> cache; std::unordered_map<u64, std::unique_ptr<JitShader>> cache;
}; };
} // namespace Shader } // namespace Pica::Shader
} // namespace Pica

View File

@ -26,9 +26,7 @@ using Xbyak::Reg32;
using Xbyak::Reg64; using Xbyak::Reg64;
using Xbyak::Xmm; using Xbyak::Xmm;
namespace Pica { namespace Pica::Shader {
namespace Shader {
typedef void (JitShader::*JitFunction)(Instruction instr); typedef void (JitShader::*JitFunction)(Instruction instr);
@ -1123,6 +1121,4 @@ Xbyak::Label JitShader::CompilePrelude_Exp2() {
return subroutine; return subroutine;
} }
} // namespace Shader } // namespace Pica::Shader
} // namespace Pica

View File

@ -19,9 +19,7 @@ using nihstro::Instruction;
using nihstro::OpCode; using nihstro::OpCode;
using nihstro::SwizzlePattern; using nihstro::SwizzlePattern;
namespace Pica { namespace Pica::Shader {
namespace Shader {
/// Memory allocated for each compiled shader /// Memory allocated for each compiled shader
constexpr std::size_t MAX_SHADER_SIZE = MAX_PROGRAM_CODE_LENGTH * 64; constexpr std::size_t MAX_SHADER_SIZE = MAX_PROGRAM_CODE_LENGTH * 64;
@ -138,6 +136,4 @@ private:
Xbyak::Label exp2_subroutine; Xbyak::Label exp2_subroutine;
}; };
} // namespace Shader } // namespace Pica::Shader
} // namespace Pica

View File

@ -19,8 +19,7 @@
using Pica::Rasterizer::Vertex; using Pica::Rasterizer::Vertex;
namespace Pica { namespace Pica::Clipper {
namespace Clipper {
struct ClippingEdge { struct ClippingEdge {
public: public:
@ -192,5 +191,4 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu
} }
} }
} // namespace Clipper } // namespace Pica::Clipper
} // namespace Pica

View File

@ -16,8 +16,7 @@
#include "video_core/utils.h" #include "video_core/utils.h"
#include "video_core/video_core.h" #include "video_core/video_core.h"
namespace Pica { namespace Pica::Rasterizer {
namespace Rasterizer {
void DrawPixel(int x, int y, const Math::Vec4<u8>& color) { void DrawPixel(int x, int y, const Math::Vec4<u8>& color) {
const auto& framebuffer = g_state.regs.framebuffer.framebuffer; const auto& framebuffer = g_state.regs.framebuffer.framebuffer;
@ -407,5 +406,4 @@ void DrawShadowMapPixel(int x, int y, u32 depth, u8 stencil) {
} }
} }
} // namespace Rasterizer } // namespace Pica::Rasterizer
} // namespace Pica

View File

@ -8,8 +8,7 @@
#include "common/vector_math.h" #include "common/vector_math.h"
#include "video_core/regs_framebuffer.h" #include "video_core/regs_framebuffer.h"
namespace Pica { namespace Pica::Rasterizer {
namespace Rasterizer {
void DrawPixel(int x, int y, const Math::Vec4<u8>& color); void DrawPixel(int x, int y, const Math::Vec4<u8>& color);
const Math::Vec4<u8> GetPixel(int x, int y); const Math::Vec4<u8> GetPixel(int x, int y);
@ -27,5 +26,4 @@ u8 LogicOp(u8 src, u8 dest, FramebufferRegs::LogicOp op);
void DrawShadowMapPixel(int x, int y, u32 depth, u8 stencil); void DrawShadowMapPixel(int x, int y, u32 depth, u8 stencil);
} // namespace Rasterizer } // namespace Pica::Rasterizer
} // namespace Pica

View File

@ -7,8 +7,7 @@
#include "common/math_util.h" #include "common/math_util.h"
#include "video_core/swrasterizer/proctex.h" #include "video_core/swrasterizer/proctex.h"
namespace Pica { namespace Pica::Rasterizer {
namespace Rasterizer {
using ProcTexClamp = TexturingRegs::ProcTexClamp; using ProcTexClamp = TexturingRegs::ProcTexClamp;
using ProcTexShift = TexturingRegs::ProcTexShift; using ProcTexShift = TexturingRegs::ProcTexShift;
@ -219,5 +218,4 @@ Math::Vec4<u8> ProcTex(float u, float v, TexturingRegs regs, State::ProcTex stat
} }
} }
} // namespace Rasterizer } // namespace Pica::Rasterizer
} // namespace Pica

View File

@ -6,11 +6,9 @@
#include "common/vector_math.h" #include "common/vector_math.h"
#include "video_core/pica_state.h" #include "video_core/pica_state.h"
namespace Pica { namespace Pica::Rasterizer {
namespace Rasterizer {
/// Generates procedural texture color for the given coordinates /// Generates procedural texture color for the given coordinates
Math::Vec4<u8> ProcTex(float u, float v, TexturingRegs regs, State::ProcTex state); Math::Vec4<u8> ProcTex(float u, float v, TexturingRegs regs, State::ProcTex state);
} // namespace Rasterizer } // namespace Pica::Rasterizer
} // namespace Pica

View File

@ -32,8 +32,7 @@
#include "video_core/utils.h" #include "video_core/utils.h"
#include "video_core/video_core.h" #include "video_core/video_core.h"
namespace Pica { namespace Pica::Rasterizer {
namespace Rasterizer {
// NOTE: Assuming that rasterizer coordinates are 12.4 fixed-point values // NOTE: Assuming that rasterizer coordinates are 12.4 fixed-point values
struct Fix12P4 { struct Fix12P4 {
@ -893,5 +892,4 @@ void ProcessTriangle(const Vertex& v0, const Vertex& v1, const Vertex& v2) {
ProcessTriangleInternal(v0, v1, v2); ProcessTriangleInternal(v0, v1, v2);
} }
} // namespace Rasterizer } // namespace Pica::Rasterizer
} // namespace Pica

View File

@ -6,8 +6,7 @@
#include "video_core/shader/shader.h" #include "video_core/shader/shader.h"
namespace Pica { namespace Pica::Rasterizer {
namespace Rasterizer {
struct Vertex : Shader::OutputVertex { struct Vertex : Shader::OutputVertex {
Vertex(const OutputVertex& v) : OutputVertex(v) {} Vertex(const OutputVertex& v) : OutputVertex(v) {}
@ -42,5 +41,4 @@ struct Vertex : Shader::OutputVertex {
void ProcessTriangle(const Vertex& v0, const Vertex& v1, const Vertex& v2); void ProcessTriangle(const Vertex& v0, const Vertex& v1, const Vertex& v2);
} // namespace Rasterizer } // namespace Pica::Rasterizer
} // namespace Pica

View File

@ -7,11 +7,9 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
namespace Pica { namespace Pica::Shader {
namespace Shader {
struct OutputVertex; struct OutputVertex;
} } // namespace Pica::Shader
} // namespace Pica
namespace VideoCore { namespace VideoCore {

View File

@ -9,8 +9,7 @@
#include "video_core/regs_texturing.h" #include "video_core/regs_texturing.h"
#include "video_core/swrasterizer/texturing.h" #include "video_core/swrasterizer/texturing.h"
namespace Pica { namespace Pica::Rasterizer {
namespace Rasterizer {
using TevStageConfig = TexturingRegs::TevStageConfig; using TevStageConfig = TexturingRegs::TevStageConfig;
@ -238,5 +237,4 @@ u8 AlphaCombine(TevStageConfig::Operation op, const std::array<u8, 3>& input) {
} }
}; };
} // namespace Rasterizer } // namespace Pica::Rasterizer
} // namespace Pica

View File

@ -8,8 +8,7 @@
#include "common/vector_math.h" #include "common/vector_math.h"
#include "video_core/regs_texturing.h" #include "video_core/regs_texturing.h"
namespace Pica { namespace Pica::Rasterizer {
namespace Rasterizer {
int GetWrappedTexCoord(TexturingRegs::TextureConfig::WrapMode mode, int val, unsigned size); int GetWrappedTexCoord(TexturingRegs::TextureConfig::WrapMode mode, int val, unsigned size);
@ -24,5 +23,4 @@ Math::Vec3<u8> ColorCombine(TexturingRegs::TevStageConfig::Operation op,
u8 AlphaCombine(TexturingRegs::TevStageConfig::Operation op, const std::array<u8, 3>& input); u8 AlphaCombine(TexturingRegs::TevStageConfig::Operation op, const std::array<u8, 3>& input);
} // namespace Rasterizer } // namespace Pica::Rasterizer
} // namespace Pica

View File

@ -10,8 +10,7 @@
#include "common/vector_math.h" #include "common/vector_math.h"
#include "video_core/texture/etc1.h" #include "video_core/texture/etc1.h"
namespace Pica { namespace Pica::Texture {
namespace Texture {
namespace { namespace {
@ -125,5 +124,4 @@ Math::Vec3<u8> SampleETC1Subtile(u64 value, unsigned int x, unsigned int y) {
return tile.GetRGB(x, y); return tile.GetRGB(x, y);
} }
} // namespace Texture } // namespace Pica::Texture
} // namespace Pica

View File

@ -7,10 +7,8 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/vector_math.h" #include "common/vector_math.h"
namespace Pica { namespace Pica::Texture {
namespace Texture {
Math::Vec3<u8> SampleETC1Subtile(u64 value, unsigned int x, unsigned int y); Math::Vec3<u8> SampleETC1Subtile(u64 value, unsigned int x, unsigned int y);
} // namespace Texture } // namespace Pica::Texture
} // namespace Pica

View File

@ -15,8 +15,7 @@
using TextureFormat = Pica::TexturingRegs::TextureFormat; using TextureFormat = Pica::TexturingRegs::TextureFormat;
namespace Pica { namespace Pica::Texture {
namespace Texture {
constexpr std::size_t TILE_SIZE = 8 * 8; constexpr std::size_t TILE_SIZE = 8 * 8;
constexpr std::size_t ETC1_SUBTILES = 2 * 2; constexpr std::size_t ETC1_SUBTILES = 2 * 2;
@ -223,5 +222,4 @@ TextureInfo TextureInfo::FromPicaRegister(const TexturingRegs::TextureConfig& co
return info; return info;
} }
} // namespace Texture } // namespace Pica::Texture
} // namespace Pica

View File

@ -8,8 +8,7 @@
#include "common/vector_math.h" #include "common/vector_math.h"
#include "video_core/regs_texturing.h" #include "video_core/regs_texturing.h"
namespace Pica { namespace Pica::Texture {
namespace Texture {
/// Returns the byte size of a 8*8 tile of the specified texture format. /// Returns the byte size of a 8*8 tile of the specified texture format.
size_t CalculateTileSize(TexturingRegs::TextureFormat format); size_t CalculateTileSize(TexturingRegs::TextureFormat format);
@ -56,5 +55,4 @@ Math::Vec4<u8> LookupTexture(const u8* source, unsigned int x, unsigned int y,
Math::Vec4<u8> LookupTexelInTile(const u8* source, unsigned int x, unsigned int y, Math::Vec4<u8> LookupTexelInTile(const u8* source, unsigned int x, unsigned int y,
const TextureInfo& info, bool disable_alpha); const TextureInfo& info, bool disable_alpha);
} // namespace Texture } // namespace Pica::Texture
} // namespace Pica