From 441ddda9239b2611385514853620e7d5832190df Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Wed, 30 Mar 2016 18:33:30 +0200 Subject: [PATCH] removeme-debug-hw-depth-print --- src/video_core/command_processor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 08ec2907a..35fd5cedb 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -23,6 +23,8 @@ #include "video_core/debug_utils/debug_utils.h" #include "video_core/shader/shader_interpreter.h" +#include + namespace Pica { namespace CommandProcessor { @@ -169,6 +171,13 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { if (g_debug_context) { g_debug_context->OnEvent(DebugContext::Event::FinishedPrimitiveBatch, nullptr); } + + float depth; + uint8_t stencil; + glReadPixels(regs.framebuffer.GetWidth() / 2, regs.framebuffer.GetHeight() / 2, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth); + glReadPixels(regs.framebuffer.GetWidth() / 2, regs.framebuffer.GetHeight() / 2, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &stencil); + printf("Read depth: %f, stencil: 0x%02X\n", depth, stencil); + } break;