From a1e68c0036a03996e274d2d99a2d081015b4d92f Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Fri, 6 Mar 2015 19:27:45 -0800 Subject: [PATCH] Experimenting with clip mode but it doesn't work like I think it does. --- src/xenia/gpu/gl4/command_processor.cc | 22 +++++++++++++--------- src/xenia/gpu/gl4/command_processor.h | 1 + 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index 3a24188f3..7ceacd648 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -1836,15 +1836,6 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateViewportState() { (vte_control >> 9) & 0x1 ? 1.0f : 0.0f, (vte_control >> 10) & 0x1 ? 1.0f : 0.0f); - // Clipping. - // https://github.com/freedreno/amd-gpu/blob/master/include/reg/yamato/14/yamato_genenum.h#L1587 - uint32_t clip_control = regs[XE_GPU_REG_PA_CL_CLIP_CNTL].u32; - bool clip_enabled = ((clip_control >> 17) & 0x1) == 0; - // assert_true(clip_enabled); - bool dx_clip = ((clip_control >> 20) & 0x1) == 0x1; - // assert_true(dx_clip); - // glClipControl(GL_UPPER_LEFT, GL_ZERO_TO_ONE); - auto& state_regs = update_viewport_state_regs_; bool dirty = false; @@ -1852,6 +1843,8 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateViewportState() { XE_GPU_REG_PA_SC_WINDOW_SCISSOR_TL); dirty |= SetShadowRegister(state_regs.pa_sc_window_scissor_br, XE_GPU_REG_PA_SC_WINDOW_SCISSOR_BR); + // dirty |= SetShadowRegister(state_regs.pa_cl_clip_cntl, + // XE_GPU_REG_PA_CL_CLIP_CNTL); if (!dirty) { return UpdateStatus::kCompatible; } @@ -1863,6 +1856,17 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateViewportState() { 0, 0, std::min(2560u, state_regs.pa_sc_window_scissor_br & 0x7FFF), std::min(2560u, (state_regs.pa_sc_window_scissor_br >> 16) & 0x7FFF)); + // Clipping. + // https://github.com/freedreno/amd-gpu/blob/master/include/reg/yamato/14/yamato_genenum.h#L1587 + // bool clip_enabled = ((state_regs.pa_cl_clip_cntl >> 17) & 0x1) == 0; + // bool dx_clip = ((state_regs.pa_cl_clip_cntl >> 19) & 0x1) == 0x1; + //// TODO(benvanik): depth range? + // if (dx_clip) { + // glClipControl(GL_UPPER_LEFT, GL_ZERO_TO_ONE); + //} else { + // glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE); + //} + return UpdateStatus::kMismatch; } diff --git a/src/xenia/gpu/gl4/command_processor.h b/src/xenia/gpu/gl4/command_processor.h index bb8b28f50..d804ea687 100644 --- a/src/xenia/gpu/gl4/command_processor.h +++ b/src/xenia/gpu/gl4/command_processor.h @@ -300,6 +300,7 @@ class CommandProcessor { struct UpdateViewportStateRegisters { uint32_t pa_sc_window_scissor_tl; uint32_t pa_sc_window_scissor_br; + uint32_t pa_cl_clip_cntl; UpdateViewportStateRegisters() { Reset(); } void Reset() { std::memset(this, 0, sizeof(*this)); }