From 1204f35f1e85607f4d6d44864de1419b27b9e9e4 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Mon, 16 Feb 2015 21:58:24 -0800 Subject: [PATCH] --disable_framebuffer_readback --- src/xenia/gpu/gl4/command_processor.cc | 46 ++++++++++++++------------ src/xenia/gpu/gl4/gl4_gpu-private.h | 1 + src/xenia/gpu/gl4/gl4_gpu.cc | 2 ++ 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index 7a9540116..4eebfc138 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -2396,29 +2396,31 @@ bool CommandProcessor::IssueCopy() { uint32_t w = copy_dest_pitch; uint32_t h = copy_dest_height; - // Make active so glReadPixels reads from us. - glBindFramebuffer(GL_READ_FRAMEBUFFER, source_framebuffer->framebuffer); - switch (copy_command) { - case CopyCommand::kConvert: - if (copy_src_select <= 3) { - // Source from a bound render target. - // glBindBuffer(GL_READ_FRAMEBUFFER, framebuffer) - glNamedFramebufferReadBuffer(source_framebuffer->framebuffer, - GL_COLOR_ATTACHMENT0 + copy_src_select); - glReadPixels(x, y, w, h, read_format, read_type, ptr); - } else { - // Source from the bound depth/stencil target. - glReadPixels(x, y, w, h, GL_DEPTH_STENCIL, read_type, ptr); - } - break; - case CopyCommand::kRaw: - case CopyCommand::kConstantOne: - case CopyCommand::kNull: - default: - // assert_unhandled_case(copy_command); - return false; + if (!FLAGS_disable_framebuffer_readback) { + // Make active so glReadPixels reads from us. + glBindFramebuffer(GL_READ_FRAMEBUFFER, source_framebuffer->framebuffer); + switch (copy_command) { + case CopyCommand::kConvert: + if (copy_src_select <= 3) { + // Source from a bound render target. + // glBindBuffer(GL_READ_FRAMEBUFFER, framebuffer) + glNamedFramebufferReadBuffer(source_framebuffer->framebuffer, + GL_COLOR_ATTACHMENT0 + copy_src_select); + glReadPixels(x, y, w, h, read_format, read_type, ptr); + } else { + // Source from the bound depth/stencil target. + glReadPixels(x, y, w, h, GL_DEPTH_STENCIL, read_type, ptr); + } + break; + case CopyCommand::kRaw: + case CopyCommand::kConstantOne: + case CopyCommand::kNull: + default: + // assert_unhandled_case(copy_command); + return false; + } + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); } - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); // Perform any requested clears. uint32_t copy_depth_clear = regs[XE_GPU_REG_RB_DEPTH_CLEAR].u32; diff --git a/src/xenia/gpu/gl4/gl4_gpu-private.h b/src/xenia/gpu/gl4/gl4_gpu-private.h index 3d14b5823..a374227a2 100644 --- a/src/xenia/gpu/gl4/gl4_gpu-private.h +++ b/src/xenia/gpu/gl4/gl4_gpu-private.h @@ -22,6 +22,7 @@ DECLARE_bool(gl_debug_output_synchronous); DECLARE_bool(vendor_gl_extensions); +DECLARE_bool(disable_framebuffer_readback); DECLARE_bool(disable_textures); namespace xe { diff --git a/src/xenia/gpu/gl4/gl4_gpu.cc b/src/xenia/gpu/gl4/gl4_gpu.cc index be29dc6a5..bcbba56ea 100644 --- a/src/xenia/gpu/gl4/gl4_gpu.cc +++ b/src/xenia/gpu/gl4/gl4_gpu.cc @@ -22,6 +22,8 @@ DEFINE_bool(gl_debug_output_synchronous, true, DEFINE_bool(vendor_gl_extensions, true, "Enable vendor-specific (NV, AMD, etc) GL extensions."); +DEFINE_bool(disable_framebuffer_readback, false, + "Disable framebuffer readback."); DEFINE_bool(disable_textures, false, "Disable textures and use colors only."); namespace xe {