mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 01:02:48 +01:00
Merge pull request #992 from yuriks/hot-path-debug
VideoCore: #ifdef out some debugging routines
This commit is contained in:
commit
cb76453ec4
5 changed files with 18 additions and 13 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue