From 34692ab826abc8f8faa61bdb2280b742424528f1 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 7 Dec 2013 15:14:29 -0500 Subject: Remove unnecessary Src/ folders --- Source/Core/VideoCommon/PixelEngine.cpp | 479 ++++++++++++++++++++++++++++++++ 1 file changed, 479 insertions(+) create mode 100644 Source/Core/VideoCommon/PixelEngine.cpp (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp new file mode 100644 index 0000000000..40a21a2132 --- /dev/null +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -0,0 +1,479 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + + +// http://developer.nvidia.com/object/General_FAQ.html#t6 !!!!! + + +#include "Common.h" +#include "VideoCommon.h" +#include "ChunkFile.h" +#include "Atomic.h" +#include "CoreTiming.h" +#include "ConfigManager.h" + +#include "PixelEngine.h" +#include "RenderBase.h" +#include "CommandProcessor.h" +#include "HW/ProcessorInterface.h" +#include "DLCache.h" +#include "State.h" + +namespace PixelEngine +{ + +union UPEZConfReg +{ + u16 Hex; + struct + { + u16 ZCompEnable : 1; // Z Comparator Enable + u16 Function : 3; + u16 ZUpdEnable : 1; + u16 : 11; + }; +}; + +union UPEAlphaConfReg +{ + u16 Hex; + struct + { + u16 BMMath : 1; // GX_BM_BLEND || GX_BM_SUBSTRACT + u16 BMLogic : 1; // GX_BM_LOGIC + u16 Dither : 1; + u16 ColorUpdEnable : 1; + u16 AlphaUpdEnable : 1; + u16 DstFactor : 3; + u16 SrcFactor : 3; + u16 Substract : 1; // Additive mode by default + u16 BlendOperator : 4; + }; +}; + +union UPEDstAlphaConfReg +{ + u16 Hex; + struct + { + u16 DstAlpha : 8; + u16 Enable : 1; + u16 : 7; + }; +}; + +union UPEAlphaModeConfReg +{ + u16 Hex; + struct + { + u16 Threshold : 8; + u16 CompareMode : 8; + }; +}; + +// fifo Control Register +union UPECtrlReg +{ + struct + { + u16 PETokenEnable : 1; + u16 PEFinishEnable : 1; + u16 PEToken : 1; // write only + u16 PEFinish : 1; // write only + u16 : 12; + }; + u16 Hex; + UPECtrlReg() {Hex = 0; } + UPECtrlReg(u16 _hex) {Hex = _hex; } +}; + +// STATE_TO_SAVE +static UPEZConfReg m_ZConf; +static UPEAlphaConfReg m_AlphaConf; +static UPEDstAlphaConfReg m_DstAlphaConf; +static UPEAlphaModeConfReg m_AlphaModeConf; +static UPEAlphaReadReg m_AlphaRead; +static UPECtrlReg m_Control; +//static u16 m_Token; // token value most recently encountered + +volatile u32 g_bSignalTokenInterrupt; +volatile u32 g_bSignalFinishInterrupt; + +static int et_SetTokenOnMainThread; +static int et_SetFinishOnMainThread; + +volatile u32 interruptSetToken = 0; +volatile u32 interruptSetFinish = 0; + +u16 bbox[4]; +bool bbox_active; + +enum +{ + INT_CAUSE_PE_TOKEN = 0x200, // GP Token + INT_CAUSE_PE_FINISH = 0x400, // GP Finished +}; + +void DoState(PointerWrap &p) +{ + p.Do(m_ZConf); + p.Do(m_AlphaConf); + p.Do(m_DstAlphaConf); + p.Do(m_AlphaModeConf); + p.Do(m_AlphaRead); + p.DoPOD(m_Control); + + p.Do(g_bSignalTokenInterrupt); + p.Do(g_bSignalFinishInterrupt); + p.Do(interruptSetToken); + p.Do(interruptSetFinish); + + p.Do(bbox); + p.Do(bbox_active); +} + +void UpdateInterrupts(); +void UpdateTokenInterrupt(bool active); +void UpdateFinishInterrupt(bool active); +void SetToken_OnMainThread(u64 userdata, int cyclesLate); +void SetFinish_OnMainThread(u64 userdata, int cyclesLate); + +void Init() +{ + m_Control.Hex = 0; + m_ZConf.Hex = 0; + m_AlphaConf.Hex = 0; + m_DstAlphaConf.Hex = 0; + m_AlphaModeConf.Hex = 0; + m_AlphaRead.Hex = 0; + + g_bSignalTokenInterrupt = 0; + g_bSignalFinishInterrupt = 0; + interruptSetToken = 0; + interruptSetFinish = 0; + + et_SetTokenOnMainThread = CoreTiming::RegisterEvent("SetToken", SetToken_OnMainThread); + et_SetFinishOnMainThread = CoreTiming::RegisterEvent("SetFinish", SetFinish_OnMainThread); + + bbox[0] = 0x80; + bbox[1] = 0xA0; + bbox[2] = 0x80; + bbox[3] = 0xA0; + + bbox_active = false; +} + +void Read16(u16& _uReturnValue, const u32 _iAddress) +{ + DEBUG_LOG(PIXELENGINE, "(r16) 0x%08x", _iAddress); + switch (_iAddress & 0xFFF) + { + // CPU Direct Access EFB Raster State Config + case PE_ZCONF: + _uReturnValue = m_ZConf.Hex; + INFO_LOG(PIXELENGINE, "(r16) ZCONF"); + break; + case PE_ALPHACONF: + // Most games read this early. no idea why. + _uReturnValue = m_AlphaConf.Hex; + INFO_LOG(PIXELENGINE, "(r16) ALPHACONF"); + break; + case PE_DSTALPHACONF: + _uReturnValue = m_DstAlphaConf.Hex; + INFO_LOG(PIXELENGINE, "(r16) DSTALPHACONF"); + break; + case PE_ALPHAMODE: + _uReturnValue = m_AlphaModeConf.Hex; + INFO_LOG(PIXELENGINE, "(r16) ALPHAMODE"); + break; + case PE_ALPHAREAD: + _uReturnValue = m_AlphaRead.Hex; + WARN_LOG(PIXELENGINE, "(r16) ALPHAREAD"); + break; + + case PE_CTRL_REGISTER: + _uReturnValue = m_Control.Hex; + INFO_LOG(PIXELENGINE, "(r16) CTRL_REGISTER : %04x", _uReturnValue); + break; + + case PE_TOKEN_REG: + _uReturnValue = Common::AtomicLoad(*(volatile u32*)&CommandProcessor::fifo.PEToken); + INFO_LOG(PIXELENGINE, "(r16) TOKEN_REG : %04x", _uReturnValue); + break; + + case PE_BBOX_LEFT: + { + // Left must be even and 606px max + _uReturnValue = std::min((u16) 606, bbox[0]) & ~1; + + INFO_LOG(PIXELENGINE, "R: BBOX_LEFT = %i", _uReturnValue); + bbox_active = false; + break; + } + + case PE_BBOX_RIGHT: + { + // Right must be odd and 607px max + _uReturnValue = std::min((u16) 607, bbox[1]) | 1; + + INFO_LOG(PIXELENGINE, "R: BBOX_RIGHT = %i", _uReturnValue); + bbox_active = false; + break; + } + + case PE_BBOX_TOP: + { + // Top must be even and 478px max + _uReturnValue = std::min((u16) 478, bbox[2]) & ~1; + + INFO_LOG(PIXELENGINE, "R: BBOX_TOP = %i", _uReturnValue); + bbox_active = false; + break; + } + + case PE_BBOX_BOTTOM: + { + // Bottom must be odd and 479px max + _uReturnValue = std::min((u16) 479, bbox[3]) | 1; + + INFO_LOG(PIXELENGINE, "R: BBOX_BOTTOM = %i", _uReturnValue); + bbox_active = false; + break; + } + + // NOTE(neobrain): only PE_PERF_ZCOMP_OUTPUT is implemented in D3D11, but the other values shouldn't be contradictionary to the value of that register (i.e. INPUT registers should always be greater or equal to their corresponding OUTPUT registers). + case PE_PERF_ZCOMP_INPUT_ZCOMPLOC_L: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT_ZCOMPLOC) & 0xFFFF; + break; + + case PE_PERF_ZCOMP_INPUT_ZCOMPLOC_H: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT_ZCOMPLOC) >> 16; + break; + + case PE_PERF_ZCOMP_OUTPUT_ZCOMPLOC_L: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT_ZCOMPLOC) & 0xFFFF; + break; + + case PE_PERF_ZCOMP_OUTPUT_ZCOMPLOC_H: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT_ZCOMPLOC) >> 16; + break; + + case PE_PERF_ZCOMP_INPUT_L: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT) & 0xFFFF; + break; + + case PE_PERF_ZCOMP_INPUT_H: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT) >> 16; + break; + + case PE_PERF_ZCOMP_OUTPUT_L: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT) & 0xFFFF; + break; + + case PE_PERF_ZCOMP_OUTPUT_H: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT) >> 16; + break; + + case PE_PERF_BLEND_INPUT_L: + // Super Mario Sunshine uses this register in episode 6 of Sirena Beach: + // The amount of remaining goop is determined by checking how many pixels reach the blending stage. + // Once this register falls below a particular value (around 0x90), the game regards the challenge finished. + // In very old builds, Dolphin only returned 0. That caused the challenge to be immediately finished without any goop being cleaned (the timer just didn't even start counting from 3:00:00). + // Later builds returned 1 for the high register. That caused the timer to actually count down, but made the challenge unbeatable because the game always thought you didn't clear any goop at all. + // Note that currently this functionality is only implemented in the D3D11 backend. + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_BLEND_INPUT) & 0xFFFF; + break; + + case PE_PERF_BLEND_INPUT_H: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_BLEND_INPUT) >> 16; + break; + + case PE_PERF_EFB_COPY_CLOCKS_L: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_EFB_COPY_CLOCKS) & 0xFFFF; + break; + + case PE_PERF_EFB_COPY_CLOCKS_H: + _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_EFB_COPY_CLOCKS) >> 16; + break; + + default: + INFO_LOG(PIXELENGINE, "(r16) unknown @ %08x", _iAddress); + _uReturnValue = 1; + break; + } + +} + +void Write16(const u16 _iValue, const u32 _iAddress) +{ + switch (_iAddress & 0xFFF) + { + // CPU Direct Access EFB Raster State Config + case PE_ZCONF: + m_ZConf.Hex = _iValue; + INFO_LOG(PIXELENGINE, "(w16) ZCONF: %02x", _iValue); + break; + case PE_ALPHACONF: + m_AlphaConf.Hex = _iValue; + INFO_LOG(PIXELENGINE, "(w16) ALPHACONF: %02x", _iValue); + break; + case PE_DSTALPHACONF: + m_DstAlphaConf.Hex = _iValue; + INFO_LOG(PIXELENGINE, "(w16) DSTALPHACONF: %02x", _iValue); + break; + case PE_ALPHAMODE: + m_AlphaModeConf.Hex = _iValue; + INFO_LOG(PIXELENGINE, "(w16) ALPHAMODE: %02x", _iValue); + break; + case PE_ALPHAREAD: + m_AlphaRead.Hex = _iValue; + INFO_LOG(PIXELENGINE, "(w16) ALPHAREAD: %02x", _iValue); + break; + + case PE_CTRL_REGISTER: + { + UPECtrlReg tmpCtrl(_iValue); + + if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = 0; + if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = 0; + + m_Control.PETokenEnable = tmpCtrl.PETokenEnable; + m_Control.PEFinishEnable = tmpCtrl.PEFinishEnable; + m_Control.PEToken = 0; // this flag is write only + m_Control.PEFinish = 0; // this flag is write only + + DEBUG_LOG(PIXELENGINE, "(w16) CTRL_REGISTER: 0x%04x", _iValue); + UpdateInterrupts(); + } + break; + + case PE_TOKEN_REG: + PanicAlert("(w16) WTF? PowerPC program wrote token: %i", _iValue); + //only the gx pipeline is supposed to be able to write here + //g_token = _iValue; + break; + + default: + WARN_LOG(PIXELENGINE, "(w16) unknown %04x @ %08x", _iValue, _iAddress); + break; + } + +} + +void Write32(const u32 _iValue, const u32 _iAddress) +{ + WARN_LOG(PIXELENGINE, "(w32) 0x%08x @ 0x%08x IGNORING...",_iValue,_iAddress); +} + +bool AllowIdleSkipping() +{ + return !SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread || (!m_Control.PETokenEnable && !m_Control.PEFinishEnable); +} + +void UpdateInterrupts() +{ + // check if there is a token-interrupt + UpdateTokenInterrupt((g_bSignalTokenInterrupt & m_Control.PETokenEnable)); + + // check if there is a finish-interrupt + UpdateFinishInterrupt((g_bSignalFinishInterrupt & m_Control.PEFinishEnable)); +} + +void UpdateTokenInterrupt(bool active) +{ + ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, active); + Common::AtomicStore(interruptSetToken, active ? 1 : 0); +} + +void UpdateFinishInterrupt(bool active) +{ + ProcessorInterface::SetInterrupt(INT_CAUSE_PE_FINISH, active); + Common::AtomicStore(interruptSetFinish, active ? 1 : 0); +} + +// TODO(mb2): Refactor SetTokenINT_OnMainThread(u64 userdata, int cyclesLate). +// Think about the right order between tokenVal and tokenINT... one day maybe. +// Cleanup++ + +// Called only if BPMEM_PE_TOKEN_INT_ID is ack by GP +void SetToken_OnMainThread(u64 userdata, int cyclesLate) +{ + // XXX: No 16-bit atomic store available, so cheat and use 32-bit. + // That's what we've always done. We're counting on fifo.PEToken to be + // 4-byte padded. + Common::AtomicStore(*(volatile u32*)&CommandProcessor::fifo.PEToken, userdata & 0xffff); + INFO_LOG(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: %04x)", CommandProcessor::fifo.PEToken); + if (userdata >> 16) + { + Common::AtomicStore(*(volatile u32*)&g_bSignalTokenInterrupt, 1); + UpdateInterrupts(); + } + CommandProcessor::interruptTokenWaiting = false; + IncrementCheckContextId(); +} + +void SetFinish_OnMainThread(u64 userdata, int cyclesLate) +{ + Common::AtomicStore(*(volatile u32*)&g_bSignalFinishInterrupt, 1); + UpdateInterrupts(); + CommandProcessor::interruptFinishWaiting = false; + CommandProcessor::isPossibleWaitingSetDrawDone = false; +} + +// SetToken +// THIS IS EXECUTED FROM VIDEO THREAD +void SetToken(const u16 _token, const int _bSetTokenAcknowledge) +{ + if (_bSetTokenAcknowledge) // set token INT + { + Common::AtomicStore(*(volatile u32*)&g_bSignalTokenInterrupt, 1); + } + + CommandProcessor::interruptTokenWaiting = true; + CoreTiming::ScheduleEvent_Threadsafe(0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16)); + IncrementCheckContextId(); +} + +// SetFinish +// THIS IS EXECUTED FROM VIDEO THREAD (BPStructs.cpp) when a new frame has been drawn +void SetFinish() +{ + CommandProcessor::interruptFinishWaiting = true; + CoreTiming::ScheduleEvent_Threadsafe(0, et_SetFinishOnMainThread, 0); + INFO_LOG(PIXELENGINE, "VIDEO Set Finish"); + IncrementCheckContextId(); +} + +//This function is used in CommandProcessor when write CTRL_REGISTER and the new fifo is attached. +void ResetSetFinish() +{ + //if SetFinish happened but PE_CTRL_REGISTER not, I reset the interrupt else + //remove event from the queue + if (g_bSignalFinishInterrupt) + { + UpdateFinishInterrupt(false); + g_bSignalFinishInterrupt = false; + } + else + { + CoreTiming::RemoveEvent(et_SetFinishOnMainThread); + } + CommandProcessor::interruptFinishWaiting = false; +} + +void ResetSetToken() +{ + if (g_bSignalTokenInterrupt) + { + UpdateTokenInterrupt(false); + g_bSignalTokenInterrupt = 0; + } + else + { + CoreTiming::RemoveEvent(et_SetTokenOnMainThread); + } + CommandProcessor::interruptTokenWaiting = false; +} +} // end of namespace PixelEngine -- cgit v1.2.3 From cdfe58f7ede09ff11b13adf5a911da5a50927870 Mon Sep 17 00:00:00 2001 From: crudelios Date: Sat, 25 Jan 2014 15:36:23 +0000 Subject: Rewrote bounding box algotithm. Fixes issues 5967, 6154, 6196, 6211. Instead of being vertex-based, it is now primitive (point, line or dissected triangle) based, with proper clipping. Also, screen position is now calculated based on viewport values, instead of "guesstimating". This fixes many graphical glitches in Paper Mario: TTYD and Super Paper Mario. Also, the new code allows Mickey's Magical Mirror and Disney's Hide & Sneak to work (mostly) bug-free. I changed their inis to use bbox. These changes have a slight cost in performance when bbox is being used (rare), mostly due to the new clipping algorithm. Please check for any regressions or crashes. --- Source/Core/VideoCommon/PixelEngine.cpp | 35 ++------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 40a21a2132..67b707836c 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -203,45 +203,14 @@ void Read16(u16& _uReturnValue, const u32 _iAddress) INFO_LOG(PIXELENGINE, "(r16) TOKEN_REG : %04x", _uReturnValue); break; + // BBox case PE_BBOX_LEFT: - { - // Left must be even and 606px max - _uReturnValue = std::min((u16) 606, bbox[0]) & ~1; - - INFO_LOG(PIXELENGINE, "R: BBOX_LEFT = %i", _uReturnValue); - bbox_active = false; - break; - } - case PE_BBOX_RIGHT: - { - // Right must be odd and 607px max - _uReturnValue = std::min((u16) 607, bbox[1]) | 1; - - INFO_LOG(PIXELENGINE, "R: BBOX_RIGHT = %i", _uReturnValue); - bbox_active = false; - break; - } - case PE_BBOX_TOP: - { - // Top must be even and 478px max - _uReturnValue = std::min((u16) 478, bbox[2]) & ~1; - - INFO_LOG(PIXELENGINE, "R: BBOX_TOP = %i", _uReturnValue); - bbox_active = false; - break; - } - case PE_BBOX_BOTTOM: - { - // Bottom must be odd and 479px max - _uReturnValue = std::min((u16) 479, bbox[3]) | 1; - - INFO_LOG(PIXELENGINE, "R: BBOX_BOTTOM = %i", _uReturnValue); + _uReturnValue = bbox[(_iAddress >> 1) & 3]; bbox_active = false; break; - } // NOTE(neobrain): only PE_PERF_ZCOMP_OUTPUT is implemented in D3D11, but the other values shouldn't be contradictionary to the value of that register (i.e. INPUT registers should always be greater or equal to their corresponding OUTPUT registers). case PE_PERF_ZCOMP_INPUT_ZCOMPLOC_L: -- cgit v1.2.3 From 010a0d481ad0f5dd19182eafc411feec387404db Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 30 Jan 2014 15:51:20 +0100 Subject: VideoCommon: remove Cache Displaylist This option was known to break every second game and only boost a bit. It also seems to be broken because of streaming into pinned memory and buffer storage buffers. v2: also remove dlc_desc --- Source/Core/VideoCommon/PixelEngine.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 67b707836c..32d91f4310 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -17,7 +17,6 @@ #include "RenderBase.h" #include "CommandProcessor.h" #include "HW/ProcessorInterface.h" -#include "DLCache.h" #include "State.h" namespace PixelEngine @@ -380,7 +379,6 @@ void SetToken_OnMainThread(u64 userdata, int cyclesLate) UpdateInterrupts(); } CommandProcessor::interruptTokenWaiting = false; - IncrementCheckContextId(); } void SetFinish_OnMainThread(u64 userdata, int cyclesLate) @@ -402,7 +400,6 @@ void SetToken(const u16 _token, const int _bSetTokenAcknowledge) CommandProcessor::interruptTokenWaiting = true; CoreTiming::ScheduleEvent_Threadsafe(0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16)); - IncrementCheckContextId(); } // SetFinish @@ -412,7 +409,6 @@ void SetFinish() CommandProcessor::interruptFinishWaiting = true; CoreTiming::ScheduleEvent_Threadsafe(0, et_SetFinishOnMainThread, 0); INFO_LOG(PIXELENGINE, "VIDEO Set Finish"); - IncrementCheckContextId(); } //This function is used in CommandProcessor when write CTRL_REGISTER and the new fifo is attached. -- cgit v1.2.3 From 40182a48a56b8e294e126c64f5f37910a40c67cd Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 9 Feb 2014 16:03:16 -0500 Subject: Cleanup enum indentations. --- Source/Core/VideoCommon/PixelEngine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 32d91f4310..7ac79ebe3e 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -111,8 +111,8 @@ bool bbox_active; enum { - INT_CAUSE_PE_TOKEN = 0x200, // GP Token - INT_CAUSE_PE_FINISH = 0x400, // GP Finished + INT_CAUSE_PE_TOKEN = 0x200, // GP Token + INT_CAUSE_PE_FINISH = 0x400, // GP Finished }; void DoState(PointerWrap &p) -- cgit v1.2.3 From ebb48d019eec1c29a37a406e2db16d7565367faa Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 9 Feb 2014 18:29:13 -0500 Subject: Clean up some struct indentations Also cleaned up the indentations of some variable declarations. --- Source/Core/VideoCommon/PixelEngine.cpp | 60 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 7ac79ebe3e..b075a296d9 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -27,10 +27,10 @@ union UPEZConfReg u16 Hex; struct { - u16 ZCompEnable : 1; // Z Comparator Enable - u16 Function : 3; - u16 ZUpdEnable : 1; - u16 : 11; + u16 ZCompEnable : 1; // Z Comparator Enable + u16 Function : 3; + u16 ZUpdEnable : 1; + u16 : 11; }; }; @@ -39,15 +39,15 @@ union UPEAlphaConfReg u16 Hex; struct { - u16 BMMath : 1; // GX_BM_BLEND || GX_BM_SUBSTRACT - u16 BMLogic : 1; // GX_BM_LOGIC - u16 Dither : 1; - u16 ColorUpdEnable : 1; - u16 AlphaUpdEnable : 1; - u16 DstFactor : 3; - u16 SrcFactor : 3; - u16 Substract : 1; // Additive mode by default - u16 BlendOperator : 4; + u16 BMMath : 1; // GX_BM_BLEND || GX_BM_SUBSTRACT + u16 BMLogic : 1; // GX_BM_LOGIC + u16 Dither : 1; + u16 ColorUpdEnable : 1; + u16 AlphaUpdEnable : 1; + u16 DstFactor : 3; + u16 SrcFactor : 3; + u16 Substract : 1; // Additive mode by default + u16 BlendOperator : 4; }; }; @@ -56,9 +56,9 @@ union UPEDstAlphaConfReg u16 Hex; struct { - u16 DstAlpha : 8; - u16 Enable : 1; - u16 : 7; + u16 DstAlpha : 8; + u16 Enable : 1; + u16 : 7; }; }; @@ -67,8 +67,8 @@ union UPEAlphaModeConfReg u16 Hex; struct { - u16 Threshold : 8; - u16 CompareMode : 8; + u16 Threshold : 8; + u16 CompareMode : 8; }; }; @@ -77,11 +77,11 @@ union UPECtrlReg { struct { - u16 PETokenEnable : 1; - u16 PEFinishEnable : 1; - u16 PEToken : 1; // write only - u16 PEFinish : 1; // write only - u16 : 12; + u16 PETokenEnable : 1; + u16 PEFinishEnable : 1; + u16 PEToken : 1; // write only + u16 PEFinish : 1; // write only + u16 : 12; }; u16 Hex; UPECtrlReg() {Hex = 0; } @@ -89,13 +89,13 @@ union UPECtrlReg }; // STATE_TO_SAVE -static UPEZConfReg m_ZConf; -static UPEAlphaConfReg m_AlphaConf; -static UPEDstAlphaConfReg m_DstAlphaConf; -static UPEAlphaModeConfReg m_AlphaModeConf; -static UPEAlphaReadReg m_AlphaRead; -static UPECtrlReg m_Control; -//static u16 m_Token; // token value most recently encountered +static UPEZConfReg m_ZConf; +static UPEAlphaConfReg m_AlphaConf; +static UPEDstAlphaConfReg m_DstAlphaConf; +static UPEAlphaModeConfReg m_AlphaModeConf; +static UPEAlphaReadReg m_AlphaRead; +static UPECtrlReg m_Control; +//static u16 m_Token; // token value most recently encountered volatile u32 g_bSignalTokenInterrupt; volatile u32 g_bSignalFinishInterrupt; -- cgit v1.2.3 From 4129b30494757a79daf8a07e6a07ea937ba1c94b Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 2 Feb 2014 14:16:43 +0100 Subject: MMIO: Port the VideoCommon CP MMIOs to the new interface (and provide framework for other video related mappings). --- Source/Core/VideoCommon/PixelEngine.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index b075a296d9..ccdd28b0b2 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -133,6 +133,11 @@ void DoState(PointerWrap &p) p.Do(bbox_active); } +void RegisterMMIO(MMIO::Mapping* mmio, u32 base) +{ + // TODO +} + void UpdateInterrupts(); void UpdateTokenInterrupt(bool active); void UpdateFinishInterrupt(bool active); -- cgit v1.2.3 From 5b5dfb384ee8172b4a09412c27a753eef5df751c Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 2 Feb 2014 16:08:09 +0100 Subject: MMIO: Port the VideoCommon PE MMIOs to the new interface. --- Source/Core/VideoCommon/PixelEngine.cpp | 237 +++++++++++--------------------- 1 file changed, 84 insertions(+), 153 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index ccdd28b0b2..98f39f6ff3 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -16,6 +16,7 @@ #include "PixelEngine.h" #include "RenderBase.h" #include "CommandProcessor.h" +#include "HW/MMIO.h" #include "HW/ProcessorInterface.h" #include "State.h" @@ -133,11 +134,6 @@ void DoState(PointerWrap &p) p.Do(bbox_active); } -void RegisterMMIO(MMIO::Mapping* mmio, u32 base) -{ - // TODO -} - void UpdateInterrupts(); void UpdateTokenInterrupt(bool active); void UpdateFinishInterrupt(bool active); @@ -169,145 +165,61 @@ void Init() bbox_active = false; } -void Read16(u16& _uReturnValue, const u32 _iAddress) +void RegisterMMIO(MMIO::Mapping* mmio, u32 base) { - DEBUG_LOG(PIXELENGINE, "(r16) 0x%08x", _iAddress); - switch (_iAddress & 0xFFF) + // Directly mapped registers. + struct { + u32 addr; + u16* ptr; + } directly_mapped_vars[] = { + { PE_ZCONF, &m_ZConf.Hex }, + { PE_ALPHACONF, &m_AlphaConf.Hex }, + { PE_DSTALPHACONF, &m_DstAlphaConf.Hex }, + { PE_ALPHAMODE, &m_AlphaModeConf.Hex }, + { PE_ALPHAREAD, &m_AlphaRead.Hex }, + }; + for (auto& mapped_var : directly_mapped_vars) { - // CPU Direct Access EFB Raster State Config - case PE_ZCONF: - _uReturnValue = m_ZConf.Hex; - INFO_LOG(PIXELENGINE, "(r16) ZCONF"); - break; - case PE_ALPHACONF: - // Most games read this early. no idea why. - _uReturnValue = m_AlphaConf.Hex; - INFO_LOG(PIXELENGINE, "(r16) ALPHACONF"); - break; - case PE_DSTALPHACONF: - _uReturnValue = m_DstAlphaConf.Hex; - INFO_LOG(PIXELENGINE, "(r16) DSTALPHACONF"); - break; - case PE_ALPHAMODE: - _uReturnValue = m_AlphaModeConf.Hex; - INFO_LOG(PIXELENGINE, "(r16) ALPHAMODE"); - break; - case PE_ALPHAREAD: - _uReturnValue = m_AlphaRead.Hex; - WARN_LOG(PIXELENGINE, "(r16) ALPHAREAD"); - break; - - case PE_CTRL_REGISTER: - _uReturnValue = m_Control.Hex; - INFO_LOG(PIXELENGINE, "(r16) CTRL_REGISTER : %04x", _uReturnValue); - break; - - case PE_TOKEN_REG: - _uReturnValue = Common::AtomicLoad(*(volatile u32*)&CommandProcessor::fifo.PEToken); - INFO_LOG(PIXELENGINE, "(r16) TOKEN_REG : %04x", _uReturnValue); - break; - - // BBox - case PE_BBOX_LEFT: - case PE_BBOX_RIGHT: - case PE_BBOX_TOP: - case PE_BBOX_BOTTOM: - _uReturnValue = bbox[(_iAddress >> 1) & 3]; - bbox_active = false; - break; - - // NOTE(neobrain): only PE_PERF_ZCOMP_OUTPUT is implemented in D3D11, but the other values shouldn't be contradictionary to the value of that register (i.e. INPUT registers should always be greater or equal to their corresponding OUTPUT registers). - case PE_PERF_ZCOMP_INPUT_ZCOMPLOC_L: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT_ZCOMPLOC) & 0xFFFF; - break; - - case PE_PERF_ZCOMP_INPUT_ZCOMPLOC_H: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT_ZCOMPLOC) >> 16; - break; - - case PE_PERF_ZCOMP_OUTPUT_ZCOMPLOC_L: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT_ZCOMPLOC) & 0xFFFF; - break; - - case PE_PERF_ZCOMP_OUTPUT_ZCOMPLOC_H: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT_ZCOMPLOC) >> 16; - break; - - case PE_PERF_ZCOMP_INPUT_L: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT) & 0xFFFF; - break; - - case PE_PERF_ZCOMP_INPUT_H: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_INPUT) >> 16; - break; - - case PE_PERF_ZCOMP_OUTPUT_L: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT) & 0xFFFF; - break; - - case PE_PERF_ZCOMP_OUTPUT_H: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_ZCOMP_OUTPUT) >> 16; - break; - - case PE_PERF_BLEND_INPUT_L: - // Super Mario Sunshine uses this register in episode 6 of Sirena Beach: - // The amount of remaining goop is determined by checking how many pixels reach the blending stage. - // Once this register falls below a particular value (around 0x90), the game regards the challenge finished. - // In very old builds, Dolphin only returned 0. That caused the challenge to be immediately finished without any goop being cleaned (the timer just didn't even start counting from 3:00:00). - // Later builds returned 1 for the high register. That caused the timer to actually count down, but made the challenge unbeatable because the game always thought you didn't clear any goop at all. - // Note that currently this functionality is only implemented in the D3D11 backend. - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_BLEND_INPUT) & 0xFFFF; - break; - - case PE_PERF_BLEND_INPUT_H: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_BLEND_INPUT) >> 16; - break; - - case PE_PERF_EFB_COPY_CLOCKS_L: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_EFB_COPY_CLOCKS) & 0xFFFF; - break; - - case PE_PERF_EFB_COPY_CLOCKS_H: - _uReturnValue = g_video_backend->Video_GetQueryResult(PQ_EFB_COPY_CLOCKS) >> 16; - break; - - default: - INFO_LOG(PIXELENGINE, "(r16) unknown @ %08x", _iAddress); - _uReturnValue = 1; - break; + mmio->Register(base | mapped_var.addr, + MMIO::DirectRead(mapped_var.ptr), + MMIO::DirectWrite(mapped_var.ptr) + ); } -} - -void Write16(const u16 _iValue, const u32 _iAddress) -{ - switch (_iAddress & 0xFFF) + // Performance queries registers: read only, need to call the video backend + // to get the results. + struct { + u32 addr; + PerfQueryType pqtype; + } pq_regs[] = { + { PE_PERF_ZCOMP_INPUT_ZCOMPLOC_L, PQ_ZCOMP_INPUT_ZCOMPLOC }, + { PE_PERF_ZCOMP_OUTPUT_ZCOMPLOC_L, PQ_ZCOMP_OUTPUT_ZCOMPLOC }, + { PE_PERF_ZCOMP_INPUT_L, PQ_ZCOMP_INPUT }, + { PE_PERF_ZCOMP_OUTPUT_L, PQ_ZCOMP_OUTPUT }, + { PE_PERF_BLEND_INPUT_L, PQ_BLEND_INPUT }, + { PE_PERF_EFB_COPY_CLOCKS_L, PQ_EFB_COPY_CLOCKS }, + }; + for (auto& pq_reg : pq_regs) { - // CPU Direct Access EFB Raster State Config - case PE_ZCONF: - m_ZConf.Hex = _iValue; - INFO_LOG(PIXELENGINE, "(w16) ZCONF: %02x", _iValue); - break; - case PE_ALPHACONF: - m_AlphaConf.Hex = _iValue; - INFO_LOG(PIXELENGINE, "(w16) ALPHACONF: %02x", _iValue); - break; - case PE_DSTALPHACONF: - m_DstAlphaConf.Hex = _iValue; - INFO_LOG(PIXELENGINE, "(w16) DSTALPHACONF: %02x", _iValue); - break; - case PE_ALPHAMODE: - m_AlphaModeConf.Hex = _iValue; - INFO_LOG(PIXELENGINE, "(w16) ALPHAMODE: %02x", _iValue); - break; - case PE_ALPHAREAD: - m_AlphaRead.Hex = _iValue; - INFO_LOG(PIXELENGINE, "(w16) ALPHAREAD: %02x", _iValue); - break; - - case PE_CTRL_REGISTER: - { - UPECtrlReg tmpCtrl(_iValue); + mmio->Register(base | pq_reg.addr, + MMIO::ComplexRead([pq_reg](u32) { + return g_video_backend->Video_GetQueryResult(pq_reg.pqtype) & 0xFFFF; + }), + MMIO::InvalidWrite() + ); + mmio->Register(base | (pq_reg.addr + 2), + MMIO::ComplexRead([pq_reg](u32) { + return g_video_backend->Video_GetQueryResult(pq_reg.pqtype) >> 16; + }), + MMIO::InvalidWrite() + ); + } + + // Control register + mmio->Register(base | PE_CTRL_REGISTER, + MMIO::DirectRead(&m_Control.Hex), + MMIO::ComplexWrite([](u32, u16 val) { + UPECtrlReg tmpCtrl(val); if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = 0; if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = 0; @@ -317,27 +229,46 @@ void Write16(const u16 _iValue, const u32 _iAddress) m_Control.PEToken = 0; // this flag is write only m_Control.PEFinish = 0; // this flag is write only - DEBUG_LOG(PIXELENGINE, "(w16) CTRL_REGISTER: 0x%04x", _iValue); + DEBUG_LOG(PIXELENGINE, "(w16) CTRL_REGISTER: 0x%04x", val); UpdateInterrupts(); - } - break; - - case PE_TOKEN_REG: - PanicAlert("(w16) WTF? PowerPC program wrote token: %i", _iValue); - //only the gx pipeline is supposed to be able to write here - //g_token = _iValue; - break; - - default: - WARN_LOG(PIXELENGINE, "(w16) unknown %04x @ %08x", _iValue, _iAddress); - break; + }) + ); + + // Token register, readonly. + mmio->Register(base | PE_TOKEN_REG, + MMIO::DirectRead(&CommandProcessor::fifo.PEToken), + MMIO::InvalidWrite() + ); + + // BBOX registers, readonly and need to update a flag. + for (int i = 0; i < 4; ++i) + { + mmio->Register(base | (PE_BBOX_LEFT + 2 * i), + MMIO::ComplexRead([i](u32) { + bbox_active = false; + return bbox[i]; + }), + MMIO::InvalidWrite() + ); } +} +void Read16(u16& _uReturnValue, const u32 _iAddress) +{ + // HACK: Remove this function when the new MMIO interface is used. + Memory::mmio_mapping->Read(_iAddress, _uReturnValue); +} + +void Write16(const u16 _iValue, const u32 _iAddress) +{ + // HACK: Remove this function when the new MMIO interface is used. + Memory::mmio_mapping->Write(_iAddress, _iValue); } void Write32(const u32 _iValue, const u32 _iAddress) { - WARN_LOG(PIXELENGINE, "(w32) 0x%08x @ 0x%08x IGNORING...",_iValue,_iAddress); + // HACK: Remove this function when the new MMIO interface is used. + Memory::mmio_mapping->Write(_iAddress, _iValue); } bool AllowIdleSkipping() -- cgit v1.2.3 From 92f8d93e969abf942002439ef583d2a25acad019 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sat, 15 Feb 2014 03:23:35 +0100 Subject: Remove the old MMIO access "interface". --- Source/Core/VideoCommon/PixelEngine.cpp | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 98f39f6ff3..9a5137a60e 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -253,24 +253,6 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) } } -void Read16(u16& _uReturnValue, const u32 _iAddress) -{ - // HACK: Remove this function when the new MMIO interface is used. - Memory::mmio_mapping->Read(_iAddress, _uReturnValue); -} - -void Write16(const u16 _iValue, const u32 _iAddress) -{ - // HACK: Remove this function when the new MMIO interface is used. - Memory::mmio_mapping->Write(_iAddress, _iValue); -} - -void Write32(const u32 _iValue, const u32 _iAddress) -{ - // HACK: Remove this function when the new MMIO interface is used. - Memory::mmio_mapping->Write(_iAddress, _iValue); -} - bool AllowIdleSkipping() { return !SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread || (!m_Control.PETokenEnable && !m_Control.PEFinishEnable); @@ -377,4 +359,10 @@ void ResetSetToken() } CommandProcessor::interruptTokenWaiting = false; } + +UPEAlphaReadReg GetAlphaReadMode() +{ + return m_AlphaRead; +} + } // end of namespace PixelEngine -- cgit v1.2.3 From 3fd87a7636ff434118a5d7f7334550be8db55c0b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Feb 2014 23:51:41 -0500 Subject: Second and final pass of clearing out tabs. --- Source/Core/VideoCommon/PixelEngine.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 9a5137a60e..de46dce77a 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -221,13 +221,13 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) MMIO::ComplexWrite([](u32, u16 val) { UPECtrlReg tmpCtrl(val); - if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = 0; - if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = 0; + if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = 0; + if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = 0; m_Control.PETokenEnable = tmpCtrl.PETokenEnable; m_Control.PEFinishEnable = tmpCtrl.PEFinishEnable; - m_Control.PEToken = 0; // this flag is write only - m_Control.PEFinish = 0; // this flag is write only + m_Control.PEToken = 0; // this flag is write only + m_Control.PEFinish = 0; // this flag is write only DEBUG_LOG(PIXELENGINE, "(w16) CTRL_REGISTER: 0x%04x", val); UpdateInterrupts(); @@ -280,8 +280,8 @@ void UpdateFinishInterrupt(bool active) } // TODO(mb2): Refactor SetTokenINT_OnMainThread(u64 userdata, int cyclesLate). -// Think about the right order between tokenVal and tokenINT... one day maybe. -// Cleanup++ +// Think about the right order between tokenVal and tokenINT... one day maybe. +// Cleanup++ // Called only if BPMEM_PE_TOKEN_INT_ID is ack by GP void SetToken_OnMainThread(u64 userdata, int cyclesLate) -- cgit v1.2.3 From 2afe2152712981e21d6bda6f029292ed2b1cf91e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 17 Feb 2014 05:18:15 -0500 Subject: Convert all includes to relative paths. --- Source/Core/VideoCommon/PixelEngine.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index de46dce77a..9436d93db7 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -6,19 +6,20 @@ // http://developer.nvidia.com/object/General_FAQ.html#t6 !!!!! -#include "Common.h" -#include "VideoCommon.h" -#include "ChunkFile.h" -#include "Atomic.h" -#include "CoreTiming.h" -#include "ConfigManager.h" - -#include "PixelEngine.h" -#include "RenderBase.h" -#include "CommandProcessor.h" -#include "HW/MMIO.h" -#include "HW/ProcessorInterface.h" -#include "State.h" +#include "Common/ChunkFile.h" +#include "Common/Common.h" +#include "Common/Atomic.h" + +#include "Core/ConfigManager.h" +#include "Core/CoreTiming.h" +#include "Core/State.h" +#include "Core/HW/MMIO.h" +#include "Core/HW/ProcessorInterface.h" + +#include "VideoCommon/CommandProcessor.h" +#include "VideoCommon/PixelEngine.h" +#include "VideoCommon/RenderBase.h" +#include "VideoCommon/VideoCommon.h" namespace PixelEngine { -- cgit v1.2.3 From ffe588cc240745f0a30595c604083d37e791c670 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Wed, 19 Feb 2014 02:27:20 +0100 Subject: Fix more header sorting issues in VideoCommon/ (now check-includes clean). --- Source/Core/VideoCommon/PixelEngine.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 9436d93db7..4d913dd836 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -6,16 +6,14 @@ // http://developer.nvidia.com/object/General_FAQ.html#t6 !!!!! +#include "Common/Atomic.h" #include "Common/ChunkFile.h" #include "Common/Common.h" -#include "Common/Atomic.h" - #include "Core/ConfigManager.h" #include "Core/CoreTiming.h" #include "Core/State.h" #include "Core/HW/MMIO.h" #include "Core/HW/ProcessorInterface.h" - #include "VideoCommon/CommandProcessor.h" #include "VideoCommon/PixelEngine.h" #include "VideoCommon/RenderBase.h" -- cgit v1.2.3 From 0aecd9504e8ccbf52b89032be9d15b25ff14543d Mon Sep 17 00:00:00 2001 From: magumagu Date: Sun, 1 Jun 2014 01:56:09 -0700 Subject: Video backends: remove dead code. --- Source/Core/VideoCommon/PixelEngine.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 4d913dd836..531ef21df6 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -328,37 +328,6 @@ void SetFinish() INFO_LOG(PIXELENGINE, "VIDEO Set Finish"); } -//This function is used in CommandProcessor when write CTRL_REGISTER and the new fifo is attached. -void ResetSetFinish() -{ - //if SetFinish happened but PE_CTRL_REGISTER not, I reset the interrupt else - //remove event from the queue - if (g_bSignalFinishInterrupt) - { - UpdateFinishInterrupt(false); - g_bSignalFinishInterrupt = false; - } - else - { - CoreTiming::RemoveEvent(et_SetFinishOnMainThread); - } - CommandProcessor::interruptFinishWaiting = false; -} - -void ResetSetToken() -{ - if (g_bSignalTokenInterrupt) - { - UpdateTokenInterrupt(false); - g_bSignalTokenInterrupt = 0; - } - else - { - CoreTiming::RemoveEvent(et_SetTokenOnMainThread); - } - CommandProcessor::interruptTokenWaiting = false; -} - UPEAlphaReadReg GetAlphaReadMode() { return m_AlphaRead; -- cgit v1.2.3 From 22e1aa5bb4a159d6d66a321f978917614aa36331 Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 8 Jul 2014 14:29:26 +0200 Subject: mark all local functions as static --- Source/Core/VideoCommon/PixelEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 531ef21df6..85d4ed34f8 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -252,7 +252,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) } } -bool AllowIdleSkipping() +static bool AllowIdleSkipping() { return !SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread || (!m_Control.PETokenEnable && !m_Control.PEFinishEnable); } -- cgit v1.2.3 From 6d3f249dcc746cc7845ef88ddb8ce3bcc9221aca Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 8 Jul 2014 15:58:25 +0200 Subject: mark all local variables as static --- Source/Core/VideoCommon/PixelEngine.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 85d4ed34f8..a66dd5ee98 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -97,14 +97,14 @@ static UPEAlphaReadReg m_AlphaRead; static UPECtrlReg m_Control; //static u16 m_Token; // token value most recently encountered -volatile u32 g_bSignalTokenInterrupt; -volatile u32 g_bSignalFinishInterrupt; +static volatile u32 g_bSignalTokenInterrupt; +static volatile u32 g_bSignalFinishInterrupt; static int et_SetTokenOnMainThread; static int et_SetFinishOnMainThread; -volatile u32 interruptSetToken = 0; -volatile u32 interruptSetFinish = 0; +static volatile u32 interruptSetToken = 0; +static volatile u32 interruptSetFinish = 0; u16 bbox[4]; bool bbox_active; -- cgit v1.2.3 From 0ccee6c87b78843caf4bb0dce48a46144e05f69e Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 13 Jul 2014 02:16:51 +0200 Subject: Fix warnings unearthed by #579 --- Source/Core/VideoCommon/PixelEngine.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index a66dd5ee98..5e049e3b18 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -252,11 +252,6 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) } } -static bool AllowIdleSkipping() -{ - return !SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread || (!m_Control.PETokenEnable && !m_Control.PEFinishEnable); -} - void UpdateInterrupts() { // check if there is a token-interrupt -- cgit v1.2.3 From fbc64984ca7de7db10b1a8a4f49002f260c93569 Mon Sep 17 00:00:00 2001 From: Rohit Nirmal Date: Sun, 7 Sep 2014 20:06:58 -0500 Subject: Include CommonTypes.h instead of Common.h. --- Source/Core/VideoCommon/PixelEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 5e049e3b18..da36e2d019 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -8,7 +8,7 @@ #include "Common/Atomic.h" #include "Common/ChunkFile.h" -#include "Common/Common.h" +#include "Common/CommonTypes.h" #include "Core/ConfigManager.h" #include "Core/CoreTiming.h" #include "Core/State.h" -- cgit v1.2.3 From 2d4b7e3f3f67f48ec2fb3d8eb8b2af3b70e4afcc Mon Sep 17 00:00:00 2001 From: crudelios Date: Sun, 14 Sep 2014 17:52:51 +0100 Subject: Reimplement Bounding Box calculation using the software renderer. --- Source/Core/VideoCommon/PixelEngine.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index da36e2d019..877acf916c 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -16,6 +16,7 @@ #include "Core/HW/ProcessorInterface.h" #include "VideoCommon/CommandProcessor.h" #include "VideoCommon/PixelEngine.h" +#include "VideoCommon/BoundingBox.h" #include "VideoCommon/RenderBase.h" #include "VideoCommon/VideoCommon.h" @@ -106,9 +107,6 @@ static int et_SetFinishOnMainThread; static volatile u32 interruptSetToken = 0; static volatile u32 interruptSetFinish = 0; -u16 bbox[4]; -bool bbox_active; - enum { INT_CAUSE_PE_TOKEN = 0x200, // GP Token @@ -128,9 +126,6 @@ void DoState(PointerWrap &p) p.Do(g_bSignalFinishInterrupt); p.Do(interruptSetToken); p.Do(interruptSetFinish); - - p.Do(bbox); - p.Do(bbox_active); } void UpdateInterrupts(); @@ -155,13 +150,6 @@ void Init() et_SetTokenOnMainThread = CoreTiming::RegisterEvent("SetToken", SetToken_OnMainThread); et_SetFinishOnMainThread = CoreTiming::RegisterEvent("SetFinish", SetFinish_OnMainThread); - - bbox[0] = 0x80; - bbox[1] = 0xA0; - bbox[2] = 0x80; - bbox[3] = 0xA0; - - bbox_active = false; } void RegisterMMIO(MMIO::Mapping* mmio, u32 base) @@ -244,8 +232,8 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) { mmio->Register(base | (PE_BBOX_LEFT + 2 * i), MMIO::ComplexRead([i](u32) { - bbox_active = false; - return bbox[i]; + BoundingBox::active = false; + return BoundingBox::coords[i]; }), MMIO::InvalidWrite() ); -- cgit v1.2.3 From 176ea06e8233386f397eaa6d8941747d6f035576 Mon Sep 17 00:00:00 2001 From: crudelios Date: Wed, 17 Sep 2014 02:04:37 +0100 Subject: Get buildbot to compile. --- Source/Core/VideoCommon/PixelEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 877acf916c..7fd8e12a39 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -14,9 +14,9 @@ #include "Core/State.h" #include "Core/HW/MMIO.h" #include "Core/HW/ProcessorInterface.h" +#include "VideoCommon/BoundingBox.h" #include "VideoCommon/CommandProcessor.h" #include "VideoCommon/PixelEngine.h" -#include "VideoCommon/BoundingBox.h" #include "VideoCommon/RenderBase.h" #include "VideoCommon/VideoCommon.h" -- cgit v1.2.3 From c211450b997effa6d91059fb0aaa564892297719 Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 13 Nov 2014 23:26:49 +0100 Subject: OGL: implement bounding box support with ssbo This implemention tries to be as accurate as the old SW implemention, but it will remove the dependcy of our vertexloader on videosw. --- Source/Core/VideoCommon/PixelEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 7fd8e12a39..f6bc26186a 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -233,7 +233,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) mmio->Register(base | (PE_BBOX_LEFT + 2 * i), MMIO::ComplexRead([i](u32) { BoundingBox::active = false; - return BoundingBox::coords[i]; + return g_video_backend->Video_GetBoundingBox(i); }), MMIO::InvalidWrite() ); -- cgit v1.2.3 From 47be9d8e6b8659e403ac4be5c709a48db647dac4 Mon Sep 17 00:00:00 2001 From: magumagu Date: Fri, 30 Jan 2015 14:48:23 -0800 Subject: Clean up usage of ScheduleEvent_Threadsafe. --- Source/Core/VideoCommon/PixelEngine.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index f6bc26186a..afe08c7d0a 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -16,6 +16,7 @@ #include "Core/HW/ProcessorInterface.h" #include "VideoCommon/BoundingBox.h" #include "VideoCommon/CommandProcessor.h" +#include "VideoCommon/Fifo.h" #include "VideoCommon/PixelEngine.h" #include "VideoCommon/RenderBase.h" #include "VideoCommon/VideoCommon.h" @@ -299,7 +300,10 @@ void SetToken(const u16 _token, const int _bSetTokenAcknowledge) } CommandProcessor::interruptTokenWaiting = true; - CoreTiming::ScheduleEvent_Threadsafe(0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16)); + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread || g_use_deterministic_gpu_thread) + CoreTiming::ScheduleEvent(0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16)); + else + CoreTiming::ScheduleEvent_Threadsafe(0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16)); } // SetFinish @@ -307,7 +311,10 @@ void SetToken(const u16 _token, const int _bSetTokenAcknowledge) void SetFinish() { CommandProcessor::interruptFinishWaiting = true; - CoreTiming::ScheduleEvent_Threadsafe(0, et_SetFinishOnMainThread, 0); + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread || g_use_deterministic_gpu_thread) + CoreTiming::ScheduleEvent(0, et_SetFinishOnMainThread, 0); + else + CoreTiming::ScheduleEvent_Threadsafe(0, et_SetFinishOnMainThread, 0); INFO_LOG(PIXELENGINE, "VIDEO Set Finish"); } -- cgit v1.2.3 From b020ae1c5db4e2e198d1beea91c75219a251a167 Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 5 Mar 2015 21:14:46 +0100 Subject: Fifo: rewrite sync on idle skipping hack Now it's done without a busy loop --- Source/Core/VideoCommon/PixelEngine.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index afe08c7d0a..da086924b1 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -287,7 +287,6 @@ void SetFinish_OnMainThread(u64 userdata, int cyclesLate) Common::AtomicStore(*(volatile u32*)&g_bSignalFinishInterrupt, 1); UpdateInterrupts(); CommandProcessor::interruptFinishWaiting = false; - CommandProcessor::isPossibleWaitingSetDrawDone = false; } // SetToken -- cgit v1.2.3 From 5799824b226f5f63c6edd46758441ca3904c3fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingve=20Sk=C3=A5ra?= Date: Fri, 1 May 2015 21:42:50 +0200 Subject: Fix dead link --- Source/Core/VideoCommon/PixelEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index da086924b1..5c9a651fb5 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -3,7 +3,7 @@ // Refer to the license.txt file included. -// http://developer.nvidia.com/object/General_FAQ.html#t6 !!!!! +// http://www.nvidia.com/object/General_FAQ.html#t6 !!!!! #include "Common/Atomic.h" -- cgit v1.2.3 From cefcb0ace9d363b3679b4e93bcc9ec05f1e5f4f8 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 18 May 2015 01:08:10 +0200 Subject: Update license headers to GPLv2+ --- Source/Core/VideoCommon/PixelEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 5c9a651fb5..ab33ff8728 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -1,5 +1,5 @@ // Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 +// Licensed under GPLv2+ // Refer to the license.txt file included. -- cgit v1.2.3 From 30ebb2459eb97ba544547183854775df8460b475 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 24 May 2015 06:55:12 +0200 Subject: Set copyright year to when a file was created --- Source/Core/VideoCommon/PixelEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index ab33ff8728..a5c3f49536 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -1,4 +1,4 @@ -// Copyright 2013 Dolphin Emulator Project +// Copyright 2008 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. -- cgit v1.2.3 From ec03196267634e0fcb93c8278223575fd4965484 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 27 May 2015 02:18:22 -0400 Subject: PixelEngine: Replace volatile usages with atomics Also removes two unused volatile variables. --- Source/Core/VideoCommon/PixelEngine.cpp | 39 ++++++++++++++------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index a5c3f49536..9b2c48876b 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -5,6 +5,7 @@ // http://www.nvidia.com/object/General_FAQ.html#t6 !!!!! +#include #include "Common/Atomic.h" #include "Common/ChunkFile.h" @@ -99,15 +100,12 @@ static UPEAlphaReadReg m_AlphaRead; static UPECtrlReg m_Control; //static u16 m_Token; // token value most recently encountered -static volatile u32 g_bSignalTokenInterrupt; -static volatile u32 g_bSignalFinishInterrupt; +static std::atomic s_signal_token_interrupt; +static std::atomic s_signal_finish_interrupt; static int et_SetTokenOnMainThread; static int et_SetFinishOnMainThread; -static volatile u32 interruptSetToken = 0; -static volatile u32 interruptSetFinish = 0; - enum { INT_CAUSE_PE_TOKEN = 0x200, // GP Token @@ -123,10 +121,8 @@ void DoState(PointerWrap &p) p.Do(m_AlphaRead); p.DoPOD(m_Control); - p.Do(g_bSignalTokenInterrupt); - p.Do(g_bSignalFinishInterrupt); - p.Do(interruptSetToken); - p.Do(interruptSetFinish); + p.Do(s_signal_token_interrupt); + p.Do(s_signal_finish_interrupt); } void UpdateInterrupts(); @@ -144,10 +140,8 @@ void Init() m_AlphaModeConf.Hex = 0; m_AlphaRead.Hex = 0; - g_bSignalTokenInterrupt = 0; - g_bSignalFinishInterrupt = 0; - interruptSetToken = 0; - interruptSetFinish = 0; + s_signal_token_interrupt.store(0); + s_signal_finish_interrupt.store(0); et_SetTokenOnMainThread = CoreTiming::RegisterEvent("SetToken", SetToken_OnMainThread); et_SetFinishOnMainThread = CoreTiming::RegisterEvent("SetFinish", SetFinish_OnMainThread); @@ -209,8 +203,11 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) MMIO::ComplexWrite([](u32, u16 val) { UPECtrlReg tmpCtrl(val); - if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = 0; - if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = 0; + if (tmpCtrl.PEToken) + s_signal_token_interrupt.store(0); + + if (tmpCtrl.PEFinish) + s_signal_finish_interrupt.store(0); m_Control.PETokenEnable = tmpCtrl.PETokenEnable; m_Control.PEFinishEnable = tmpCtrl.PEFinishEnable; @@ -244,22 +241,20 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) void UpdateInterrupts() { // check if there is a token-interrupt - UpdateTokenInterrupt((g_bSignalTokenInterrupt & m_Control.PETokenEnable)); + UpdateTokenInterrupt((s_signal_token_interrupt.load() & m_Control.PETokenEnable) != 0); // check if there is a finish-interrupt - UpdateFinishInterrupt((g_bSignalFinishInterrupt & m_Control.PEFinishEnable)); + UpdateFinishInterrupt((s_signal_finish_interrupt.load() & m_Control.PEFinishEnable) != 0); } void UpdateTokenInterrupt(bool active) { ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, active); - Common::AtomicStore(interruptSetToken, active ? 1 : 0); } void UpdateFinishInterrupt(bool active) { ProcessorInterface::SetInterrupt(INT_CAUSE_PE_FINISH, active); - Common::AtomicStore(interruptSetFinish, active ? 1 : 0); } // TODO(mb2): Refactor SetTokenINT_OnMainThread(u64 userdata, int cyclesLate). @@ -276,7 +271,7 @@ void SetToken_OnMainThread(u64 userdata, int cyclesLate) INFO_LOG(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: %04x)", CommandProcessor::fifo.PEToken); if (userdata >> 16) { - Common::AtomicStore(*(volatile u32*)&g_bSignalTokenInterrupt, 1); + s_signal_token_interrupt.store(1); UpdateInterrupts(); } CommandProcessor::interruptTokenWaiting = false; @@ -284,7 +279,7 @@ void SetToken_OnMainThread(u64 userdata, int cyclesLate) void SetFinish_OnMainThread(u64 userdata, int cyclesLate) { - Common::AtomicStore(*(volatile u32*)&g_bSignalFinishInterrupt, 1); + s_signal_finish_interrupt.store(1); UpdateInterrupts(); CommandProcessor::interruptFinishWaiting = false; } @@ -295,7 +290,7 @@ void SetToken(const u16 _token, const int _bSetTokenAcknowledge) { if (_bSetTokenAcknowledge) // set token INT { - Common::AtomicStore(*(volatile u32*)&g_bSignalTokenInterrupt, 1); + s_signal_token_interrupt.store(1); } CommandProcessor::interruptTokenWaiting = true; -- cgit v1.2.3 From 1ba3b4e7ac9d53710454c46ac5384ee44a096b70 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 27 May 2015 03:08:48 -0400 Subject: CommandProcessor: Replace volatile usages with atomics Also remove said variables from being globals. --- Source/Core/VideoCommon/PixelEngine.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 9b2c48876b..45db963d23 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -274,14 +274,14 @@ void SetToken_OnMainThread(u64 userdata, int cyclesLate) s_signal_token_interrupt.store(1); UpdateInterrupts(); } - CommandProcessor::interruptTokenWaiting = false; + CommandProcessor::SetInterruptTokenWaiting(false); } void SetFinish_OnMainThread(u64 userdata, int cyclesLate) { s_signal_finish_interrupt.store(1); UpdateInterrupts(); - CommandProcessor::interruptFinishWaiting = false; + CommandProcessor::SetInterruptFinishWaiting(false); } // SetToken @@ -293,7 +293,8 @@ void SetToken(const u16 _token, const int _bSetTokenAcknowledge) s_signal_token_interrupt.store(1); } - CommandProcessor::interruptTokenWaiting = true; + CommandProcessor::SetInterruptTokenWaiting(true); + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread || g_use_deterministic_gpu_thread) CoreTiming::ScheduleEvent(0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16)); else @@ -304,11 +305,13 @@ void SetToken(const u16 _token, const int _bSetTokenAcknowledge) // THIS IS EXECUTED FROM VIDEO THREAD (BPStructs.cpp) when a new frame has been drawn void SetFinish() { - CommandProcessor::interruptFinishWaiting = true; + CommandProcessor::SetInterruptFinishWaiting(true); + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread || g_use_deterministic_gpu_thread) CoreTiming::ScheduleEvent(0, et_SetFinishOnMainThread, 0); else CoreTiming::ScheduleEvent_Threadsafe(0, et_SetFinishOnMainThread, 0); + INFO_LOG(PIXELENGINE, "VIDEO Set Finish"); } -- cgit v1.2.3 From 9c63b78397f2707e3df37f1f632f1705916d5075 Mon Sep 17 00:00:00 2001 From: comex Date: Sat, 6 Jun 2015 01:20:51 -0400 Subject: Fix indeterminism in GPU thread mode. --- Source/Core/VideoCommon/PixelEngine.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Source/Core/VideoCommon/PixelEngine.cpp') diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index 45db963d23..91662e9931 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -11,6 +11,7 @@ #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" #include "Core/ConfigManager.h" +#include "Core/Core.h" #include "Core/CoreTiming.h" #include "Core/State.h" #include "Core/HW/MMIO.h" @@ -282,6 +283,8 @@ void SetFinish_OnMainThread(u64 userdata, int cyclesLate) s_signal_finish_interrupt.store(1); UpdateInterrupts(); CommandProcessor::SetInterruptFinishWaiting(false); + + Core::FrameUpdateOnCPUThread(); } // SetToken -- cgit v1.2.3