aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-07-26 11:45:51 -0400
committerbunnei <bunneidev@gmail.com>2015-07-26 11:45:51 -0400
commitcb76453ec40eec3710e6092f89d3c0d49a5b0ddf (patch)
treea161341d0efc0cbf3823d058eb9bfe39d77f7144 /src
parent72237a930509d353f9029d7245855780071dd663 (diff)
parent13347997ba59aa578d61d5d1ac723ad00953bd96 (diff)
Merge pull request #992 from yuriks/hot-path-debug
VideoCore: #ifdef out some debugging routines
Diffstat (limited to 'src')
-rw-r--r--src/video_core/command_processor.cpp10
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp12
-rw-r--r--src/video_core/debug_utils/debug_utils.h5
-rw-r--r--src/video_core/rasterizer.cpp2
-rw-r--r--src/video_core/vertex_shader.cpp2
5 files changed, 18 insertions, 13 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 43ae0618..ef9584ab 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -116,7 +116,9 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
{
Common::Profiling::ScopeTimer scope_timer(category_drawing);
+#if PICA_LOG_TEV
DebugUtils::DumpTevStageConfig(regs.GetTevStages());
+#endif
if (g_debug_context)
g_debug_context->OnEvent(DebugContext::Event::IncomingPrimitiveBatch, nullptr);
@@ -159,9 +161,11 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
const u16* index_address_16 = (u16*)index_address_8;
bool index_u16 = index_info.format != 0;
+#if PICA_DUMP_GEOMETRY
DebugUtils::GeometryDumper geometry_dumper;
- PrimitiveAssembler<VertexShader::OutputVertex> primitive_assembler(regs.triangle_topology.Value());
PrimitiveAssembler<DebugUtils::GeometryDumper::Vertex> dumping_primitive_assembler(regs.triangle_topology.Value());
+#endif
+ PrimitiveAssembler<VertexShader::OutputVertex> primitive_assembler(regs.triangle_topology.Value());
if (g_debug_context) {
for (int i = 0; i < 3; ++i) {
@@ -271,6 +275,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
if (g_debug_context)
g_debug_context->OnEvent(DebugContext::Event::VertexLoaded, (void*)&input);
+#if PICA_DUMP_GEOMETRY
// NOTE: When dumping geometry, we simply assume that the first input attribute
// corresponds to the position for now.
DebugUtils::GeometryDumper::Vertex dumped_vertex = {
@@ -280,6 +285,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
dumping_primitive_assembler.SubmitVertex(dumped_vertex,
std::bind(&DebugUtils::GeometryDumper::AddTriangle,
&geometry_dumper, _1, _2, _3));
+#endif
// Send to vertex shader
VertexShader::OutputVertex output = VertexShader::RunShader(input, attribute_config.GetNumTotalAttributes(), g_state.regs.vs, g_state.vs);
@@ -312,7 +318,9 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
VideoCore::g_renderer->hw_rasterizer->DrawTriangles();
}
+#if PICA_DUMP_GEOMETRY
geometry_dumper.Dump();
+#endif
if (g_debug_context) {
g_debug_context->OnEvent(DebugContext::Event::FinishedPrimitiveBatch, nullptr);
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
index c3f8321c..e9a85841 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -90,10 +90,6 @@ void GeometryDumper::AddTriangle(Vertex& v0, Vertex& v1, Vertex& v2) {
}
void GeometryDumper::Dump() {
- // NOTE: Permanently enabling this just trashes the hard disk for no reason.
- // Hence, this is currently disabled.
- return;
-
static int index = 0;
std::string filename = std::string("geometry_dump") + std::to_string(++index) + ".obj";
@@ -116,10 +112,6 @@ void GeometryDumper::Dump() {
void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data, u32 swizzle_size,
u32 main_offset, const Regs::VSOutputAttributes* output_attributes)
{
- // NOTE: Permanently enabling this just trashes hard disks for no reason.
- // Hence, this is currently disabled.
- return;
-
struct StuffToWrite {
u8* pointer;
u32 size;
@@ -565,10 +557,6 @@ TextureInfo TextureInfo::FromPicaRegister(const Regs::TextureConfig& config,
}
void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) {
- // NOTE: Permanently enabling this just trashes hard disks for no reason.
- // Hence, this is currently disabled.
- return;
-
#ifndef HAVE_PNG
return;
#else
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h
index 3f109dcb..81eea30a 100644
--- a/src/video_core/debug_utils/debug_utils.h
+++ b/src/video_core/debug_utils/debug_utils.h
@@ -157,6 +157,11 @@ extern std::shared_ptr<DebugContext> g_debug_context; // TODO: Get rid of this g
namespace DebugUtils {
+#define PICA_DUMP_GEOMETRY 0
+#define PICA_DUMP_SHADERS 0
+#define PICA_DUMP_TEXTURES 0
+#define PICA_LOG_TEV 0
+
// Simple utility class for dumping geometry data to an OBJ file
class GeometryDumper {
public:
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index e2b90ad1..68b7cc05 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -462,7 +462,9 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
// TODO: Apply the min and mag filters to the texture
texture_color[i] = DebugUtils::LookupTexture(texture_data, s, t, info);
+#if PICA_DUMP_TEXTURES
DebugUtils::DumpTexture(texture.config, texture_data);
+#endif
}
}
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp
index e73a1d36..960ae577 100644
--- a/src/video_core/vertex_shader.cpp
+++ b/src/video_core/vertex_shader.cpp
@@ -579,9 +579,11 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes, const Regs:
state.conditional_code[1] = false;
ProcessShaderCode(state);
+#if PICA_DUMP_SHADERS
DebugUtils::DumpShader(setup.program_code.data(), state.debug.max_offset, setup.swizzle_data.data(),
state.debug.max_opdesc_id, config.main_offset,
g_state.regs.vs_output_attributes); // TODO: Don't hardcode VS here
+#endif
// Setup output data
OutputVertex ret;