From 6ea003c7b5ec97d0a754197654cdf6e7fccdba24 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 17 Aug 2014 14:06:58 +0200 Subject: Pica: Add debug utility functions for dumping geometry data. --- src/video_core/debug_utils/debug_utils.h | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/video_core/debug_utils/debug_utils.h (limited to 'src/video_core/debug_utils/debug_utils.h') diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h new file mode 100644 index 000000000..9b4dce539 --- /dev/null +++ b/src/video_core/debug_utils/debug_utils.h @@ -0,0 +1,40 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +#include "video_core/pica.h" + +namespace Pica { + +namespace DebugUtils { + +using TriangleTopology = Regs::TriangleTopology; + +// Simple utility class for dumping geometry data to an OBJ file +class GeometryDumper { +public: + void AddVertex(std::array pos, TriangleTopology topology); + + void Dump(); + +private: + struct Vertex { + std::array pos; + }; + + struct Face { + int index[3]; + }; + + std::vector vertices; + std::vector faces; +}; + +} // namespace + +} // namespace -- cgit v1.2.3 From f37e39deb9abe88b4874ebc2889ed52e02ed9c13 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Thu, 14 Aug 2014 14:30:38 +0200 Subject: Pica: Add debug utilities for dumping shaders. --- src/video_core/debug_utils/debug_utils.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/video_core/debug_utils/debug_utils.h') diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 9b4dce539..bd7a0a89b 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -35,6 +35,9 @@ private: std::vector faces; }; +void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data, u32 swizzle_size, + u32 main_offset, const Regs::VSOutputAttributes* output_attributes); + } // namespace } // namespace -- cgit v1.2.3 From 26ade98411c1d76540695f15378ff7f6b5388b1a Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Thu, 14 Aug 2014 19:21:55 +0200 Subject: Pica/citra-qt: Replace command list view and command list debugging code with something more sophisticated. --- src/video_core/debug_utils/debug_utils.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/video_core/debug_utils/debug_utils.h') diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index bd7a0a89b..023500066 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include #include "video_core/pica.h" @@ -38,6 +39,26 @@ private: void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data, u32 swizzle_size, u32 main_offset, const Regs::VSOutputAttributes* output_attributes); + +// Utility class to log Pica commands. +struct PicaTrace { + struct Write : public std::pair { + Write(u32 id, u32 value) : std::pair(id, value) {} + + u32& Id() { return first; } + const u32& Id() const { return first; } + + u32& Value() { return second; } + const u32& Value() const { return second; } + }; + std::vector writes; +}; + +void StartPicaTracing(); +bool IsPicaTracing(); +void OnPicaRegWrite(u32 id, u32 value); +std::unique_ptr FinishPicaTracing(); + } // namespace } // namespace -- cgit v1.2.3 From c4691b784bd7746c5845df00a82ea0909b37ec0f Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sat, 16 Aug 2014 14:06:40 +0200 Subject: Pica: Add support for dumping textures. --- src/video_core/debug_utils/debug_utils.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/video_core/debug_utils/debug_utils.h') diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 023500066..49b19b28a 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -59,6 +59,8 @@ bool IsPicaTracing(); void OnPicaRegWrite(u32 id, u32 value); std::unique_ptr FinishPicaTracing(); +void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data); + } // namespace } // namespace -- cgit v1.2.3 From 34fa0b6d9cd9e4027198ce11562da6c03375cd70 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 17 Aug 2014 12:17:32 +0200 Subject: Pica/DebugUtils: Add convenient tev setup printer. --- src/video_core/debug_utils/debug_utils.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/video_core/debug_utils/debug_utils.h') diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 49b19b28a..53c33c96e 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -61,6 +61,8 @@ std::unique_ptr FinishPicaTracing(); void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data); +void DumpTevStageConfig(const std::array& stages); + } // namespace } // namespace -- cgit v1.2.3 From 2f1c129f6407fe2d5c8c3e57c6717d5668570de5 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 17 Aug 2014 17:44:55 +0200 Subject: Pica: Consolidate the primitive assembly code in PrimitiveAssembly and GeometryDumper. --- src/video_core/debug_utils/debug_utils.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/video_core/debug_utils/debug_utils.h') diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 53c33c96e..8b1499bf2 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -14,20 +14,18 @@ namespace Pica { namespace DebugUtils { -using TriangleTopology = Regs::TriangleTopology; - // Simple utility class for dumping geometry data to an OBJ file class GeometryDumper { public: - void AddVertex(std::array pos, TriangleTopology topology); - - void Dump(); - -private: struct Vertex { std::array pos; }; + void AddTriangle(Vertex& v0, Vertex& v1, Vertex& v2); + + void Dump(); + +private: struct Face { int index[3]; }; -- cgit v1.2.3