mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Centralize ProcessEvent
This commit is contained in:
parent
7634ff7f09
commit
dc5c0c0d2d
8 changed files with 48 additions and 128 deletions
|
@ -670,41 +670,6 @@ void GPU_DX9::FinishDeferred() {
|
||||||
drawEngine_.FinishDeferred();
|
drawEngine_.FinishDeferred();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_DX9::ProcessEvent(GPUEvent ev) {
|
|
||||||
switch (ev.type) {
|
|
||||||
case GPU_EVENT_INIT_CLEAR:
|
|
||||||
InitClearInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_BEGIN_FRAME:
|
|
||||||
BeginFrameInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_COPY_DISPLAY_TO_OUTPUT:
|
|
||||||
CopyDisplayToOutputInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_INVALIDATE_CACHE:
|
|
||||||
InvalidateCacheInternal(ev.invalidate_cache.addr, ev.invalidate_cache.size, ev.invalidate_cache.type);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_FB_MEMCPY:
|
|
||||||
PerformMemoryCopyInternal(ev.fb_memcpy.dst, ev.fb_memcpy.src, ev.fb_memcpy.size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_FB_MEMSET:
|
|
||||||
PerformMemorySetInternal(ev.fb_memset.dst, ev.fb_memset.v, ev.fb_memset.size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_FB_STENCIL_UPLOAD:
|
|
||||||
PerformStencilUploadInternal(ev.fb_stencil_upload.dst, ev.fb_stencil_upload.size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
GPUCommon::ProcessEvent(ev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void GPU_DX9::CheckFlushOp(int cmd, u32 diff) {
|
inline void GPU_DX9::CheckFlushOp(int cmd, u32 diff) {
|
||||||
const u8 cmdFlags = cmdInfo_[cmd].flags;
|
const u8 cmdFlags = cmdInfo_[cmd].flags;
|
||||||
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
|
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
|
||||||
|
|
|
@ -143,7 +143,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void FastRunLoop(DisplayList &list) override;
|
void FastRunLoop(DisplayList &list) override;
|
||||||
void ProcessEvent(GPUEvent ev) override;
|
|
||||||
void FastLoadBoneMatrix(u32 target) override;
|
void FastLoadBoneMatrix(u32 target) override;
|
||||||
void FinishDeferred() override;
|
void FinishDeferred() override;
|
||||||
|
|
||||||
|
@ -156,9 +155,10 @@ private:
|
||||||
// void ApplyDrawState(int prim);
|
// void ApplyDrawState(int prim);
|
||||||
void CheckFlushOp(int cmd, u32 diff);
|
void CheckFlushOp(int cmd, u32 diff);
|
||||||
void BuildReportingInfo();
|
void BuildReportingInfo();
|
||||||
void InitClearInternal();
|
|
||||||
void BeginFrameInternal();
|
void InitClearInternal() override;
|
||||||
void CopyDisplayToOutputInternal();
|
void BeginFrameInternal() override;
|
||||||
|
void CopyDisplayToOutputInternal() override;
|
||||||
|
|
||||||
FramebufferManagerDX9 *framebufferManagerDX9_;
|
FramebufferManagerDX9 *framebufferManagerDX9_;
|
||||||
TextureCacheDX9 *textureCacheDX9_;
|
TextureCacheDX9 *textureCacheDX9_;
|
||||||
|
|
|
@ -863,45 +863,6 @@ void GPU_GLES::FinishDeferred() {
|
||||||
drawEngine_.FinishDeferred();
|
drawEngine_.FinishDeferred();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_GLES::ProcessEvent(GPUEvent ev) {
|
|
||||||
switch (ev.type) {
|
|
||||||
case GPU_EVENT_INIT_CLEAR:
|
|
||||||
InitClearInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_BEGIN_FRAME:
|
|
||||||
BeginFrameInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_COPY_DISPLAY_TO_OUTPUT:
|
|
||||||
CopyDisplayToOutputInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_INVALIDATE_CACHE:
|
|
||||||
InvalidateCacheInternal(ev.invalidate_cache.addr, ev.invalidate_cache.size, ev.invalidate_cache.type);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_FB_MEMCPY:
|
|
||||||
PerformMemoryCopyInternal(ev.fb_memcpy.dst, ev.fb_memcpy.src, ev.fb_memcpy.size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_FB_MEMSET:
|
|
||||||
PerformMemorySetInternal(ev.fb_memset.dst, ev.fb_memset.v, ev.fb_memset.size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_FB_STENCIL_UPLOAD:
|
|
||||||
PerformStencilUploadInternal(ev.fb_stencil_upload.dst, ev.fb_stencil_upload.size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_REINITIALIZE:
|
|
||||||
ReinitializeInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
GPUCommon::ProcessEvent(ev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void GPU_GLES::CheckFlushOp(int cmd, u32 diff) {
|
inline void GPU_GLES::CheckFlushOp(int cmd, u32 diff) {
|
||||||
const u8 cmdFlags = cmdInfo_[cmd].flags;
|
const u8 cmdFlags = cmdInfo_[cmd].flags;
|
||||||
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
|
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
|
||||||
|
|
|
@ -149,7 +149,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void FastRunLoop(DisplayList &list) override;
|
void FastRunLoop(DisplayList &list) override;
|
||||||
void ProcessEvent(GPUEvent ev) override;
|
|
||||||
void FastLoadBoneMatrix(u32 target) override;
|
void FastLoadBoneMatrix(u32 target) override;
|
||||||
void FinishDeferred() override;
|
void FinishDeferred() override;
|
||||||
|
|
||||||
|
@ -159,10 +158,12 @@ private:
|
||||||
}
|
}
|
||||||
void CheckFlushOp(int cmd, u32 diff);
|
void CheckFlushOp(int cmd, u32 diff);
|
||||||
void BuildReportingInfo();
|
void BuildReportingInfo();
|
||||||
void InitClearInternal();
|
|
||||||
void BeginFrameInternal();
|
void InitClearInternal() override;
|
||||||
void CopyDisplayToOutputInternal();
|
void BeginFrameInternal() override;
|
||||||
void ReinitializeInternal();
|
void CopyDisplayToOutputInternal() override;
|
||||||
|
void ReinitializeInternal() override;
|
||||||
|
|
||||||
inline void UpdateVsyncInterval(bool force);
|
inline void UpdateVsyncInterval(bool force);
|
||||||
void UpdateCmdInfo();
|
void UpdateCmdInfo();
|
||||||
|
|
||||||
|
|
|
@ -698,8 +698,37 @@ void GPUCommon::ProcessEvent(GPUEvent ev) {
|
||||||
ReapplyGfxStateInternal();
|
ReapplyGfxStateInternal();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GPU_EVENT_INIT_CLEAR:
|
||||||
|
InitClearInternal();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GPU_EVENT_BEGIN_FRAME:
|
||||||
|
BeginFrameInternal();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GPU_EVENT_COPY_DISPLAY_TO_OUTPUT:
|
||||||
|
CopyDisplayToOutputInternal();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GPU_EVENT_INVALIDATE_CACHE:
|
||||||
|
InvalidateCacheInternal(ev.invalidate_cache.addr, ev.invalidate_cache.size, ev.invalidate_cache.type);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GPU_EVENT_FB_MEMCPY:
|
||||||
|
PerformMemoryCopyInternal(ev.fb_memcpy.dst, ev.fb_memcpy.src, ev.fb_memcpy.size);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GPU_EVENT_FB_MEMSET:
|
||||||
|
PerformMemorySetInternal(ev.fb_memset.dst, ev.fb_memset.v, ev.fb_memset.size);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GPU_EVENT_FB_STENCIL_UPLOAD:
|
||||||
|
PerformStencilUploadInternal(ev.fb_stencil_upload.dst, ev.fb_stencil_upload.size);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG_REPORT(G3D, "Unexpected GPU event type: %d", (int)ev);
|
ERROR_LOG_REPORT(G3D, "Unexpected GPU event type: %d", (int)ev);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void InitClearInternal() {}
|
||||||
|
virtual void BeginFrameInternal() {}
|
||||||
|
virtual void CopyDisplayToOutputInternal() {}
|
||||||
|
virtual void ReinitializeInternal() {}
|
||||||
|
|
||||||
// To avoid virtual calls to PreExecuteOp().
|
// To avoid virtual calls to PreExecuteOp().
|
||||||
virtual void FastRunLoop(DisplayList &list) = 0;
|
virtual void FastRunLoop(DisplayList &list) = 0;
|
||||||
void SlowRunLoop(DisplayList &list);
|
void SlowRunLoop(DisplayList &list);
|
||||||
|
|
|
@ -722,45 +722,6 @@ void GPU_Vulkan::FastRunLoop(DisplayList &list) {
|
||||||
void GPU_Vulkan::FinishDeferred() {
|
void GPU_Vulkan::FinishDeferred() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_Vulkan::ProcessEvent(GPUEvent ev) {
|
|
||||||
switch (ev.type) {
|
|
||||||
case GPU_EVENT_INIT_CLEAR:
|
|
||||||
InitClearInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_BEGIN_FRAME:
|
|
||||||
BeginFrameInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_COPY_DISPLAY_TO_OUTPUT:
|
|
||||||
CopyDisplayToOutputInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_INVALIDATE_CACHE:
|
|
||||||
InvalidateCacheInternal(ev.invalidate_cache.addr, ev.invalidate_cache.size, ev.invalidate_cache.type);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_FB_MEMCPY:
|
|
||||||
PerformMemoryCopyInternal(ev.fb_memcpy.dst, ev.fb_memcpy.src, ev.fb_memcpy.size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_FB_MEMSET:
|
|
||||||
PerformMemorySetInternal(ev.fb_memset.dst, ev.fb_memset.v, ev.fb_memset.size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_FB_STENCIL_UPLOAD:
|
|
||||||
PerformStencilUploadInternal(ev.fb_stencil_upload.dst, ev.fb_stencil_upload.size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPU_EVENT_REINITIALIZE:
|
|
||||||
ReinitializeInternal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
GPUCommon::ProcessEvent(ev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void GPU_Vulkan::CheckFlushOp(int cmd, u32 diff) {
|
inline void GPU_Vulkan::CheckFlushOp(int cmd, u32 diff) {
|
||||||
const u8 cmdFlags = cmdInfo_[cmd].flags;
|
const u8 cmdFlags = cmdInfo_[cmd].flags;
|
||||||
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
|
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
|
||||||
|
|
|
@ -137,10 +137,8 @@ public:
|
||||||
bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices) override;
|
bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices) override;
|
||||||
bool DescribeCodePtr(const u8 *ptr, std::string &name) override;
|
bool DescribeCodePtr(const u8 *ptr, std::string &name) override;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void FastRunLoop(DisplayList &list) override;
|
void FastRunLoop(DisplayList &list) override;
|
||||||
void ProcessEvent(GPUEvent ev) override;
|
|
||||||
void FastLoadBoneMatrix(u32 target) override;
|
void FastLoadBoneMatrix(u32 target) override;
|
||||||
void FinishDeferred() override;
|
void FinishDeferred() override;
|
||||||
|
|
||||||
|
@ -150,10 +148,10 @@ private:
|
||||||
}
|
}
|
||||||
void CheckFlushOp(int cmd, u32 diff);
|
void CheckFlushOp(int cmd, u32 diff);
|
||||||
void BuildReportingInfo();
|
void BuildReportingInfo();
|
||||||
void InitClearInternal();
|
void InitClearInternal() override;
|
||||||
void BeginFrameInternal();
|
void BeginFrameInternal() override;
|
||||||
void CopyDisplayToOutputInternal();
|
void CopyDisplayToOutputInternal() override;
|
||||||
void ReinitializeInternal();
|
void ReinitializeInternal() override;
|
||||||
inline void UpdateVsyncInterval(bool force);
|
inline void UpdateVsyncInterval(bool force);
|
||||||
void UpdateCmdInfo();
|
void UpdateCmdInfo();
|
||||||
static CommandInfo cmdInfo_[256];
|
static CommandInfo cmdInfo_[256];
|
||||||
|
|
Loading…
Add table
Reference in a new issue