diff options
| author | 2015-07-26 11:45:51 -0400 | |
|---|---|---|
| committer | 2015-07-26 11:45:51 -0400 | |
| commit | cb76453ec40eec3710e6092f89d3c0d49a5b0ddf (patch) | |
| tree | a161341d0efc0cbf3823d058eb9bfe39d77f7144 | |
| parent | Merge pull request #987 from yuriks/regnames (diff) | |
| parent | VideoCore: #ifdef out some debugging routines (diff) | |
| download | yuzu-cb76453ec40eec3710e6092f89d3c0d49a5b0ddf.tar.gz yuzu-cb76453ec40eec3710e6092f89d3c0d49a5b0ddf.tar.xz yuzu-cb76453ec40eec3710e6092f89d3c0d49a5b0ddf.zip | |
Merge pull request #992 from yuriks/hot-path-debug
VideoCore: #ifdef out some debugging routines
| -rw-r--r-- | src/video_core/command_processor.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 5 | ||||
| -rw-r--r-- | src/video_core/rasterizer.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/vertex_shader.cpp | 2 |
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 | ||
| 92 | void GeometryDumper::Dump() { | 92 | void 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() { | |||
| 116 | void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data, u32 swizzle_size, | 112 | void 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 | ||
| 567 | void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) { | 559 | void 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 | ||
| 158 | namespace DebugUtils { | 158 | namespace 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 |
| 161 | class GeometryDumper { | 166 | class GeometryDumper { |
| 162 | public: | 167 | public: |
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 e73a1d365..960ae5779 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: | |||
| 579 | state.conditional_code[1] = false; | 579 | state.conditional_code[1] = false; |
| 580 | 580 | ||
| 581 | ProcessShaderCode(state); | 581 | ProcessShaderCode(state); |
| 582 | #if PICA_DUMP_SHADERS | ||
| 582 | DebugUtils::DumpShader(setup.program_code.data(), state.debug.max_offset, setup.swizzle_data.data(), | 583 | DebugUtils::DumpShader(setup.program_code.data(), state.debug.max_offset, setup.swizzle_data.data(), |
| 583 | state.debug.max_opdesc_id, config.main_offset, | 584 | state.debug.max_opdesc_id, config.main_offset, |
| 584 | g_state.regs.vs_output_attributes); // TODO: Don't hardcode VS here | 585 | g_state.regs.vs_output_attributes); // TODO: Don't hardcode VS here |
| 586 | #endif | ||
| 585 | 587 | ||
| 586 | // Setup output data | 588 | // Setup output data |
| 587 | OutputVertex ret; | 589 | OutputVertex ret; |