2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2017-09-02 11:23:26 -06:00
|
|
|
#include "VideoCommon/PixelEngine.h"
|
|
|
|
|
2016-08-10 01:44:08 -06:00
|
|
|
#include <mutex>
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2022-01-29 14:28:17 -07:00
|
|
|
#include "Common/BitField.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Common/ChunkFile.h"
|
2014-09-07 19:06:58 -06:00
|
|
|
#include "Common/CommonTypes.h"
|
2016-01-17 14:54:31 -07:00
|
|
|
#include "Common/Logging/Log.h"
|
2022-01-06 19:50:18 -07:00
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Core/ConfigManager.h"
|
2015-06-05 23:20:51 -06:00
|
|
|
#include "Core/Core.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Core/CoreTiming.h"
|
|
|
|
#include "Core/HW/MMIO.h"
|
|
|
|
#include "Core/HW/ProcessorInterface.h"
|
2022-01-06 19:50:18 -07:00
|
|
|
#include "Core/System.h"
|
|
|
|
|
2014-09-16 19:04:37 -06:00
|
|
|
#include "VideoCommon/BoundingBox.h"
|
2015-01-30 15:48:23 -07:00
|
|
|
#include "VideoCommon/Fifo.h"
|
2017-09-02 11:23:26 -06:00
|
|
|
#include "VideoCommon/PerfQueryBase.h"
|
2021-06-09 05:42:21 -06:00
|
|
|
#include "VideoCommon/RenderBase.h"
|
2017-09-02 11:23:26 -06:00
|
|
|
#include "VideoCommon/VideoBackendBase.h"
|
2012-06-17 05:58:29 -06:00
|
|
|
|
2009-10-10 15:19:39 -06:00
|
|
|
namespace PixelEngine
|
|
|
|
{
|
2022-01-29 14:28:17 -07:00
|
|
|
// Note: These enums are (assumed to be) identical to the one in BPMemory, but the base type is set
|
|
|
|
// to u16 instead of u32 for BitField
|
|
|
|
enum class CompareMode : u16
|
|
|
|
{
|
|
|
|
Never = 0,
|
|
|
|
Less = 1,
|
|
|
|
Equal = 2,
|
|
|
|
LEqual = 3,
|
|
|
|
Greater = 4,
|
|
|
|
NEqual = 5,
|
|
|
|
GEqual = 6,
|
|
|
|
Always = 7
|
|
|
|
};
|
|
|
|
|
2017-01-04 04:45:40 -07:00
|
|
|
union UPEZConfReg
|
|
|
|
{
|
2022-01-29 14:28:17 -07:00
|
|
|
u16 hex;
|
|
|
|
BitField<0, 1, bool, u16> z_comparator_enable;
|
|
|
|
BitField<1, 3, CompareMode, u16> function;
|
|
|
|
BitField<4, 1, bool, u16> z_update_enable;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class SrcBlendFactor : u16
|
|
|
|
{
|
|
|
|
Zero = 0,
|
|
|
|
One = 1,
|
|
|
|
DstClr = 2,
|
|
|
|
InvDstClr = 3,
|
|
|
|
SrcAlpha = 4,
|
|
|
|
InvSrcAlpha = 5,
|
|
|
|
DstAlpha = 6,
|
|
|
|
InvDstAlpha = 7
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class DstBlendFactor : u16
|
|
|
|
{
|
|
|
|
Zero = 0,
|
|
|
|
One = 1,
|
|
|
|
SrcClr = 2,
|
|
|
|
InvSrcClr = 3,
|
|
|
|
SrcAlpha = 4,
|
|
|
|
InvSrcAlpha = 5,
|
|
|
|
DstAlpha = 6,
|
|
|
|
InvDstAlpha = 7
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class LogicOp : u16
|
|
|
|
{
|
|
|
|
Clear = 0,
|
|
|
|
And = 1,
|
|
|
|
AndReverse = 2,
|
|
|
|
Copy = 3,
|
|
|
|
AndInverted = 4,
|
|
|
|
NoOp = 5,
|
|
|
|
Xor = 6,
|
|
|
|
Or = 7,
|
|
|
|
Nor = 8,
|
|
|
|
Equiv = 9,
|
|
|
|
Invert = 10,
|
|
|
|
OrReverse = 11,
|
|
|
|
CopyInverted = 12,
|
|
|
|
OrInverted = 13,
|
|
|
|
Nand = 14,
|
|
|
|
Set = 15
|
2009-10-10 15:19:39 -06:00
|
|
|
};
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2017-01-04 04:45:40 -07:00
|
|
|
union UPEAlphaConfReg
|
|
|
|
{
|
2022-01-29 14:28:17 -07:00
|
|
|
u16 hex;
|
|
|
|
BitField<0, 1, bool, u16> blend; // Set for GX_BM_BLEND or GX_BM_SUBTRACT
|
|
|
|
BitField<1, 1, bool, u16> logic; // Set for GX_BM_LOGIC
|
|
|
|
BitField<2, 1, bool, u16> dither;
|
|
|
|
BitField<3, 1, bool, u16> color_update_enable;
|
|
|
|
BitField<4, 1, bool, u16> alpha_update_enable;
|
|
|
|
BitField<5, 3, DstBlendFactor, u16> dst_factor;
|
|
|
|
BitField<8, 3, SrcBlendFactor, u16> src_factor;
|
|
|
|
BitField<11, 1, bool, u16> subtract; // Set for GX_BM_SUBTRACT
|
|
|
|
BitField<12, 4, LogicOp, u16> logic_op;
|
2009-10-10 15:19:39 -06:00
|
|
|
};
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2017-01-04 04:45:40 -07:00
|
|
|
union UPEDstAlphaConfReg
|
|
|
|
{
|
2022-01-29 14:28:17 -07:00
|
|
|
u16 hex;
|
|
|
|
BitField<0, 8, u8, u16> alpha;
|
|
|
|
BitField<8, 1, bool, u16> enable;
|
2009-10-10 15:19:39 -06:00
|
|
|
};
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2017-01-04 04:45:40 -07:00
|
|
|
union UPEAlphaModeConfReg
|
|
|
|
{
|
2022-01-29 14:28:17 -07:00
|
|
|
u16 hex;
|
|
|
|
BitField<0, 8, u8, u16> threshold;
|
|
|
|
// Yagcd and libogc use 8 bits for this, but the enum only needs 3
|
|
|
|
BitField<8, 3, CompareMode, u16> compare_mode;
|
|
|
|
};
|
|
|
|
|
|
|
|
union UPEAlphaReadReg
|
|
|
|
{
|
|
|
|
u16 hex;
|
|
|
|
BitField<0, 2, AlphaReadMode, u16> read_mode;
|
2009-10-10 15:19:39 -06:00
|
|
|
};
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2009-10-10 15:19:39 -06:00
|
|
|
// fifo Control Register
|
2017-01-04 04:45:40 -07:00
|
|
|
union UPECtrlReg
|
|
|
|
{
|
2022-01-29 14:28:17 -07:00
|
|
|
u16 hex;
|
|
|
|
BitField<0, 1, bool, u16> pe_token_enable;
|
|
|
|
BitField<1, 1, bool, u16> pe_finish_enable;
|
|
|
|
BitField<2, 1, bool, u16> pe_token; // Write only
|
|
|
|
BitField<3, 1, bool, u16> pe_finish; // Write only
|
2009-10-10 15:19:39 -06:00
|
|
|
};
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2009-10-10 15:19:39 -06:00
|
|
|
// 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;
|
2016-08-10 01:44:08 -06:00
|
|
|
|
2016-09-01 09:28:48 -06:00
|
|
|
static std::mutex s_token_finish_mutex;
|
2016-08-10 01:44:08 -06:00
|
|
|
static u16 s_token;
|
|
|
|
static u16 s_token_pending;
|
|
|
|
static bool s_token_interrupt_pending;
|
|
|
|
static bool s_finish_interrupt_pending;
|
|
|
|
static bool s_event_raised;
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2016-08-08 14:35:01 -06:00
|
|
|
static bool s_signal_token_interrupt;
|
|
|
|
static bool s_signal_finish_interrupt;
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2016-09-01 04:54:18 -06:00
|
|
|
static CoreTiming::EventType* et_SetTokenFinishOnMainThread;
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2009-10-10 15:19:39 -06:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
INT_CAUSE_PE_TOKEN = 0x200, // GP Token
|
|
|
|
INT_CAUSE_PE_FINISH = 0x400, // GP Finished
|
|
|
|
};
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2009-10-10 15:19:39 -06:00
|
|
|
void DoState(PointerWrap& p)
|
|
|
|
{
|
|
|
|
p.Do(m_ZConf);
|
|
|
|
p.Do(m_AlphaConf);
|
|
|
|
p.Do(m_DstAlphaConf);
|
|
|
|
p.Do(m_AlphaModeConf);
|
|
|
|
p.Do(m_AlphaRead);
|
2013-04-09 17:57:39 -06:00
|
|
|
p.DoPOD(m_Control);
|
2016-08-10 01:44:08 -06:00
|
|
|
|
|
|
|
p.Do(s_token);
|
|
|
|
p.Do(s_token_pending);
|
|
|
|
p.Do(s_token_interrupt_pending);
|
|
|
|
p.Do(s_finish_interrupt_pending);
|
|
|
|
p.Do(s_event_raised);
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2015-05-27 00:18:22 -06:00
|
|
|
p.Do(s_signal_token_interrupt);
|
|
|
|
p.Do(s_signal_finish_interrupt);
|
2009-10-10 15:19:39 -06:00
|
|
|
}
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2016-04-09 08:06:09 -06:00
|
|
|
static void UpdateInterrupts();
|
2016-08-10 01:44:08 -06:00
|
|
|
static void SetTokenFinish_OnMainThread(u64 userdata, s64 cyclesLate);
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2009-10-10 15:19:39 -06:00
|
|
|
void Init()
|
|
|
|
{
|
2022-01-29 14:28:17 -07:00
|
|
|
m_Control.hex = 0;
|
|
|
|
m_ZConf.hex = 0;
|
|
|
|
m_AlphaConf.hex = 0;
|
|
|
|
m_DstAlphaConf.hex = 0;
|
|
|
|
m_AlphaModeConf.hex = 0;
|
|
|
|
m_AlphaRead.hex = 0;
|
2016-08-10 01:44:08 -06:00
|
|
|
|
|
|
|
s_token = 0;
|
|
|
|
s_token_pending = 0;
|
|
|
|
s_token_interrupt_pending = false;
|
|
|
|
s_finish_interrupt_pending = false;
|
|
|
|
s_event_raised = false;
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2016-08-08 14:35:01 -06:00
|
|
|
s_signal_token_interrupt = false;
|
|
|
|
s_signal_finish_interrupt = false;
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2016-08-11 13:14:39 -06:00
|
|
|
et_SetTokenFinishOnMainThread =
|
|
|
|
CoreTiming::RegisterEvent("SetTokenFinish", SetTokenFinish_OnMainThread);
|
2009-10-10 15:19:39 -06:00
|
|
|
}
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2014-02-02 08:08:09 -07:00
|
|
|
void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
2009-10-10 15:19:39 -06:00
|
|
|
{
|
2014-02-02 08:08:09 -07:00
|
|
|
// Directly mapped registers.
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u32 addr;
|
|
|
|
u16* ptr;
|
|
|
|
} directly_mapped_vars[] = {
|
2022-01-29 14:28:17 -07:00
|
|
|
{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},
|
2014-02-02 08:08:09 -07:00
|
|
|
};
|
|
|
|
for (auto& mapped_var : directly_mapped_vars)
|
2009-10-10 15:19:39 -06:00
|
|
|
{
|
2014-02-02 08:08:09 -07:00
|
|
|
mmio->Register(base | mapped_var.addr, MMIO::DirectRead<u16>(mapped_var.ptr),
|
|
|
|
MMIO::DirectWrite<u16>(mapped_var.ptr));
|
2009-10-10 15:19:39 -06:00
|
|
|
}
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2014-02-02 08:08:09 -07:00
|
|
|
// 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)
|
2009-10-10 15:19:39 -06:00
|
|
|
{
|
2014-02-02 08:08:09 -07:00
|
|
|
mmio->Register(base | pq_reg.addr, MMIO::ComplexRead<u16>([pq_reg](u32) {
|
|
|
|
return g_video_backend->Video_GetQueryResult(pq_reg.pqtype) & 0xFFFF;
|
|
|
|
}),
|
|
|
|
MMIO::InvalidWrite<u16>());
|
|
|
|
mmio->Register(base | (pq_reg.addr + 2), MMIO::ComplexRead<u16>([pq_reg](u32) {
|
|
|
|
return g_video_backend->Video_GetQueryResult(pq_reg.pqtype) >> 16;
|
|
|
|
}),
|
|
|
|
MMIO::InvalidWrite<u16>());
|
|
|
|
}
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2014-02-02 08:08:09 -07:00
|
|
|
// Control register
|
2022-01-29 14:28:17 -07:00
|
|
|
mmio->Register(base | PE_CTRL_REGISTER, MMIO::DirectRead<u16>(&m_Control.hex),
|
2014-02-02 08:08:09 -07:00
|
|
|
MMIO::ComplexWrite<u16>([](u32, u16 val) {
|
2022-01-29 14:28:17 -07:00
|
|
|
UPECtrlReg tmpCtrl{.hex = val};
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2022-01-29 14:28:17 -07:00
|
|
|
if (tmpCtrl.pe_token)
|
2016-08-08 14:35:01 -06:00
|
|
|
s_signal_token_interrupt = false;
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2022-01-29 14:28:17 -07:00
|
|
|
if (tmpCtrl.pe_finish)
|
2016-08-08 14:35:01 -06:00
|
|
|
s_signal_finish_interrupt = false;
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2022-01-29 14:28:17 -07:00
|
|
|
m_Control.pe_token_enable = tmpCtrl.pe_token_enable.Value();
|
|
|
|
m_Control.pe_finish_enable = tmpCtrl.pe_finish_enable.Value();
|
|
|
|
m_Control.pe_token = false; // this flag is write only
|
|
|
|
m_Control.pe_finish = false; // this flag is write only
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2020-11-13 20:33:26 -07:00
|
|
|
DEBUG_LOG_FMT(PIXELENGINE, "(w16) CTRL_REGISTER: {:#06x}", val);
|
2009-10-10 15:19:39 -06:00
|
|
|
UpdateInterrupts();
|
2014-02-02 08:08:09 -07:00
|
|
|
}));
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2014-02-02 08:08:09 -07:00
|
|
|
// Token register, readonly.
|
2017-01-26 23:43:54 -07:00
|
|
|
mmio->Register(base | PE_TOKEN_REG, MMIO::DirectRead<u16>(&s_token), MMIO::InvalidWrite<u16>());
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2014-02-02 08:08:09 -07:00
|
|
|
// 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<u16>([i](u32) {
|
2021-06-09 05:42:21 -06:00
|
|
|
g_renderer->BBoxDisable();
|
2014-11-13 15:26:49 -07:00
|
|
|
return g_video_backend->Video_GetBoundingBox(i);
|
2014-02-02 08:08:09 -07:00
|
|
|
}),
|
|
|
|
MMIO::InvalidWrite<u16>());
|
2009-10-10 15:19:39 -06:00
|
|
|
}
|
2014-02-02 08:08:09 -07:00
|
|
|
}
|
2010-12-13 00:56:54 -07:00
|
|
|
|
2016-04-09 08:06:09 -06:00
|
|
|
static void UpdateInterrupts()
|
2009-10-10 15:19:39 -06:00
|
|
|
{
|
|
|
|
// check if there is a token-interrupt
|
2016-08-08 14:35:01 -06:00
|
|
|
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN,
|
2022-01-29 14:28:17 -07:00
|
|
|
s_signal_token_interrupt && m_Control.pe_token_enable);
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2009-10-10 15:19:39 -06:00
|
|
|
// check if there is a finish-interrupt
|
2016-08-08 14:35:01 -06:00
|
|
|
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_FINISH,
|
2022-01-29 14:28:17 -07:00
|
|
|
s_signal_finish_interrupt && m_Control.pe_finish_enable);
|
2010-12-13 00:56:54 -07:00
|
|
|
}
|
|
|
|
|
2016-08-10 01:44:08 -06:00
|
|
|
static void SetTokenFinish_OnMainThread(u64 userdata, s64 cyclesLate)
|
2009-10-10 15:19:39 -06:00
|
|
|
{
|
2016-08-10 01:44:08 -06:00
|
|
|
std::unique_lock<std::mutex> lk(s_token_finish_mutex);
|
|
|
|
s_event_raised = false;
|
|
|
|
|
|
|
|
s_token = s_token_pending;
|
|
|
|
|
|
|
|
if (s_token_interrupt_pending)
|
|
|
|
{
|
|
|
|
s_token_interrupt_pending = false;
|
|
|
|
s_signal_token_interrupt = true;
|
|
|
|
UpdateInterrupts();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s_finish_interrupt_pending)
|
|
|
|
{
|
|
|
|
s_finish_interrupt_pending = false;
|
|
|
|
s_signal_finish_interrupt = true;
|
|
|
|
UpdateInterrupts();
|
|
|
|
lk.unlock();
|
|
|
|
Core::FrameUpdateOnCPUThread();
|
|
|
|
}
|
2009-10-10 15:19:39 -06:00
|
|
|
}
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2016-08-10 01:44:08 -06:00
|
|
|
// Raise the event handler above on the CPU thread.
|
|
|
|
// s_token_finish_mutex must be locked.
|
|
|
|
// THIS IS EXECUTED FROM VIDEO THREAD
|
2021-11-24 15:01:37 -07:00
|
|
|
static void RaiseEvent(int cycles_into_future)
|
2009-10-10 15:19:39 -06:00
|
|
|
{
|
2016-08-10 01:44:08 -06:00
|
|
|
if (s_event_raised)
|
|
|
|
return;
|
2015-06-05 23:20:51 -06:00
|
|
|
|
2016-08-10 01:44:08 -06:00
|
|
|
s_event_raised = true;
|
2016-07-07 07:52:08 -06:00
|
|
|
|
|
|
|
CoreTiming::FromThread from = CoreTiming::FromThread::NON_CPU;
|
2021-11-24 15:01:37 -07:00
|
|
|
s64 cycles = 0; // we don't care about timings for dual core mode.
|
2022-01-06 19:50:18 -07:00
|
|
|
if (!Core::System::GetInstance().IsDualCoreMode() || Fifo::UseDeterministicGPUThread())
|
2021-11-24 15:01:37 -07:00
|
|
|
{
|
2016-07-07 07:52:08 -06:00
|
|
|
from = CoreTiming::FromThread::CPU;
|
2021-11-24 15:01:37 -07:00
|
|
|
|
|
|
|
// Hack: Dolphin's single-core gpu timings are way too fast. Enforce a minimum delay to give
|
|
|
|
// games time to setup any interrupt state
|
|
|
|
cycles = std::max(500, cycles_into_future);
|
|
|
|
}
|
|
|
|
CoreTiming::ScheduleEvent(cycles, et_SetTokenFinishOnMainThread, 0, from);
|
2009-10-10 15:19:39 -06:00
|
|
|
}
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2009-10-10 15:19:39 -06:00
|
|
|
// SetToken
|
|
|
|
// THIS IS EXECUTED FROM VIDEO THREAD
|
2021-11-24 15:01:37 -07:00
|
|
|
void SetToken(const u16 token, const bool interrupt, int cycles_into_future)
|
2009-10-10 15:19:39 -06:00
|
|
|
{
|
2020-11-13 20:33:26 -07:00
|
|
|
DEBUG_LOG_FMT(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: {:04x})", token);
|
2016-08-08 14:35:01 -06:00
|
|
|
|
2016-08-10 01:44:08 -06:00
|
|
|
std::lock_guard<std::mutex> lk(s_token_finish_mutex);
|
|
|
|
|
|
|
|
s_token_pending = token;
|
|
|
|
s_token_interrupt_pending |= interrupt;
|
|
|
|
|
2021-11-24 15:01:37 -07:00
|
|
|
RaiseEvent(cycles_into_future);
|
2009-10-10 15:19:39 -06:00
|
|
|
}
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2009-10-10 15:19:39 -06:00
|
|
|
// SetFinish
|
|
|
|
// THIS IS EXECUTED FROM VIDEO THREAD (BPStructs.cpp) when a new frame has been drawn
|
2021-11-24 15:01:37 -07:00
|
|
|
void SetFinish(int cycles_into_future)
|
2009-10-10 15:19:39 -06:00
|
|
|
{
|
2020-11-13 20:33:26 -07:00
|
|
|
DEBUG_LOG_FMT(PIXELENGINE, "VIDEO Set Finish");
|
2016-08-10 01:44:08 -06:00
|
|
|
|
|
|
|
std::lock_guard<std::mutex> lk(s_token_finish_mutex);
|
|
|
|
|
|
|
|
s_finish_interrupt_pending |= true;
|
|
|
|
|
2021-11-24 15:01:37 -07:00
|
|
|
RaiseEvent(cycles_into_future);
|
2009-10-10 15:19:39 -06:00
|
|
|
}
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2022-01-29 14:28:17 -07:00
|
|
|
AlphaReadMode GetAlphaReadMode()
|
2014-02-14 19:23:35 -07:00
|
|
|
{
|
2022-01-29 14:28:17 -07:00
|
|
|
return m_AlphaRead.read_mode;
|
2014-02-14 19:23:35 -07:00
|
|
|
}
|
|
|
|
|
2021-06-07 02:55:52 -06:00
|
|
|
} // namespace PixelEngine
|