summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-07-26 06:55:47 -0300
committerGravatar Yuri Kunde Schlesner2015-07-26 06:55:47 -0300
commit13347997ba59aa578d61d5d1ac723ad00953bd96 (patch)
treea84e55883de37980072ce427ed1ced68fe80036b /src
parentMerge pull request #990 from lioncash/arm (diff)
downloadyuzu-13347997ba59aa578d61d5d1ac723ad00953bd96.tar.gz
yuzu-13347997ba59aa578d61d5d1ac723ad00953bd96.tar.xz
yuzu-13347997ba59aa578d61d5d1ac723ad00953bd96.zip
VideoCore: #ifdef out some debugging routines
Some disabled debugging functionality was being called from rendering routines in VideoCore. Although disabled, many of them still allocated memory or did some extra work that was enough to show up in a profiler. Gives a slight (~2ms) speedup.
Diffstat (limited to '')
-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 43ae06181..ef9584abd 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) {
116 { 116 {
117 Common::Profiling::ScopeTimer scope_timer(category_drawing); 117 Common::Profiling::ScopeTimer scope_timer(category_drawing);
118 118
119#if PICA_LOG_TEV
119 DebugUtils::DumpTevStageConfig(regs.GetTevStages()); 120 DebugUtils::DumpTevStageConfig(regs.GetTevStages());
121#endif
120 122
121 if (g_debug_context) 123 if (g_debug_context)
122 g_debug_context->OnEvent(DebugContext::Event::IncomingPrimitiveBatch, nullptr); 124 g_debug_context->OnEvent(DebugContext::Event::IncomingPrimitiveBatch, nullptr);
@@ -159,9 +161,11 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
159 const u16* index_address_16 = (u16*)index_address_8; 161 const u16* index_address_16 = (u16*)index_address_8;
160 bool index_u16 = index_info.format != 0; 162 bool index_u16 = index_info.format != 0;
161 163
164#if PICA_DUMP_GEOMETRY
162 DebugUtils::GeometryDumper geometry_dumper; 165 DebugUtils::GeometryDumper geometry_dumper;
163 PrimitiveAssembler<VertexShader::OutputVertex> primitive_assembler(regs.triangle_topology.Value());
164 PrimitiveAssembler<DebugUtils::GeometryDumper::Vertex> dumping_primitive_assembler(regs.triangle_topology.Value()); 166 PrimitiveAssembler<DebugUtils::GeometryDumper::Vertex> dumping_primitive_assembler(regs.triangle_topology.Value());
167#endif
168 PrimitiveAssembler<VertexShader::OutputVertex> primitive_assembler(regs.triangle_topology.Value());
165 169
166 if (g_debug_context) { 170 if (g_debug_context) {
167 for (int i = 0; i < 3; ++i) { 171 for (int i = 0; i < 3; ++i) {
@@ -271,6 +275,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
271 if (g_debug_context) 275 if (g_debug_context)
272 g_debug_context->OnEvent(DebugContext::Event::VertexLoaded, (void*)&input); 276 g_debug_context->OnEvent(DebugContext::Event::VertexLoaded, (void*)&input);
273 277
278#if PICA_DUMP_GEOMETRY
274 // NOTE: When dumping geometry, we simply assume that the first input attribute 279 // NOTE: When dumping geometry, we simply assume that the first input attribute
275 // corresponds to the position for now. 280 // corresponds to the position for now.
276 DebugUtils::GeometryDumper::Vertex dumped_vertex = { 281 DebugUtils::GeometryDumper::Vertex dumped_vertex = {
@@ -280,6 +285,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
280 dumping_primitive_assembler.SubmitVertex(dumped_vertex, 285 dumping_primitive_assembler.SubmitVertex(dumped_vertex,
281 std::bind(&DebugUtils::GeometryDumper::AddTriangle, 286 std::bind(&DebugUtils::GeometryDumper::AddTriangle,
282 &geometry_dumper, _1, _2, _3)); 287 &geometry_dumper, _1, _2, _3));
288#endif
283 289
284 // Send to vertex shader 290 // Send to vertex shader
285 VertexShader::OutputVertex output = VertexShader::RunShader(input, attribute_config.GetNumTotalAttributes(), g_state.regs.vs, g_state.vs); 291 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) {
312 VideoCore::g_renderer->hw_rasterizer->DrawTriangles(); 318 VideoCore::g_renderer->hw_rasterizer->DrawTriangles();
313 } 319 }
314 320
321#if PICA_DUMP_GEOMETRY
315 geometry_dumper.Dump(); 322 geometry_dumper.Dump();
323#endif
316 324
317 if (g_debug_context) { 325 if (g_debug_context) {
318 g_debug_context->OnEvent(DebugContext::Event::FinishedPrimitiveBatch, nullptr); 326 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 c3f8321c6..e9a858411 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) {
90} 90}
91 91
92void GeometryDumper::Dump() { 92void GeometryDumper::Dump() {
93 // NOTE: Permanently enabling this just trashes the hard disk for no reason.
94 // Hence, this is currently disabled.
95 return;
96
97 static int index = 0; 93 static int index = 0;
98 std::string filename = std::string("geometry_dump") + std::to_string(++index) + ".obj"; 94 std::string filename = std::string("geometry_dump") + std::to_string(++index) + ".obj";
99 95
@@ -116,10 +112,6 @@ void GeometryDumper::Dump() {
116void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data, u32 swizzle_size, 112void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data, u32 swizzle_size,
117 u32 main_offset, const Regs::VSOutputAttributes* output_attributes) 113 u32 main_offset, const Regs::VSOutputAttributes* output_attributes)
118{ 114{
119 // NOTE: Permanently enabling this just trashes hard disks for no reason.
120 // Hence, this is currently disabled.
121 return;
122
123 struct StuffToWrite { 115 struct StuffToWrite {
124 u8* pointer; 116 u8* pointer;
125 u32 size; 117 u32 size;
@@ -565,10 +557,6 @@ TextureInfo TextureInfo::FromPicaRegister(const Regs::TextureConfig& config,
565} 557}
566 558
567void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) { 559void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) {
568 // NOTE: Permanently enabling this just trashes hard disks for no reason.
569 // Hence, this is currently disabled.
570 return;
571
572#ifndef HAVE_PNG 560#ifndef HAVE_PNG
573 return; 561 return;
574#else 562#else
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h
index 3f109dcb7..81eea30a9 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
157 157
158namespace DebugUtils { 158namespace DebugUtils {
159 159
160#define PICA_DUMP_GEOMETRY 0
161#define PICA_DUMP_SHADERS 0
162#define PICA_DUMP_TEXTURES 0
163#define PICA_LOG_TEV 0
164
160// Simple utility class for dumping geometry data to an OBJ file 165// Simple utility class for dumping geometry data to an OBJ file
161class GeometryDumper { 166class GeometryDumper {
162public: 167public:
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index e2b90ad1c..68b7cc05d 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -462,7 +462,9 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
462 462
463 // TODO: Apply the min and mag filters to the texture 463 // TODO: Apply the min and mag filters to the texture
464 texture_color[i] = DebugUtils::LookupTexture(texture_data, s, t, info); 464 texture_color[i] = DebugUtils::LookupTexture(texture_data, s, t, info);
465#if PICA_DUMP_TEXTURES
465 DebugUtils::DumpTexture(texture.config, texture_data); 466 DebugUtils::DumpTexture(texture.config, texture_data);
467#endif
466 } 468 }
467 } 469 }
468 470
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp
index b77503806..cc9f70869 100644
--- a/src/video_core/vertex_shader.cpp
+++ b/src/video_core/vertex_shader.cpp
@@ -582,9 +582,11 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes, const Regs:
582 state.conditional_code[1] = false; 582 state.conditional_code[1] = false;
583 583
584 ProcessShaderCode(state); 584 ProcessShaderCode(state);
585#if PICA_DUMP_SHADERS
585 DebugUtils::DumpShader(setup.program_code.data(), state.debug.max_offset, setup.swizzle_data.data(), 586 DebugUtils::DumpShader(setup.program_code.data(), state.debug.max_offset, setup.swizzle_data.data(),
586 state.debug.max_opdesc_id, config.main_offset, 587 state.debug.max_opdesc_id, config.main_offset,
587 g_state.regs.vs_output_attributes); // TODO: Don't hardcode VS here 588 g_state.regs.vs_output_attributes); // TODO: Don't hardcode VS here
589#endif
588 590
589 // Setup output data 591 // Setup output data
590 OutputVertex ret; 592 OutputVertex ret;