Permalink
Browse files

Make FLAG_FLUSHBEFORE a no-op, move flushes into the execution functi…

…ons.

It would only be necessary if we needed the previous value, which we
don't do in any of these.
  • Loading branch information...
hrydgard committed Aug 17, 2017
1 parent cd43049 commit 71baecabd6a55dd17a96924016921e673e1695fd
Showing with 27 additions and 6 deletions.
  1. +5 −1 GPU/D3D11/GPU_D3D11.cpp
  2. +6 −2 GPU/Directx9/GPU_DX9.cpp
  3. +6 −2 GPU/GLES/GPU_GLES.cpp
  4. +5 −0 GPU/GPUCommon.cpp
  5. +5 −1 GPU/Vulkan/GPU_Vulkan.cpp
View
@@ -397,7 +397,7 @@ void GPU_D3D11::FastRunLoop(DisplayList &list) {
const u8 cmdFlags = info.flags; // If we stashed the cmdFlags in the top bits of the cmdmem, we could get away with one table lookup instead of two
const u32 diff = op ^ gstate.cmdmem[cmd];
// Inlined CheckFlushOp here to get rid of the dumpThisFrame_ check.
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
if (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE)) {
drawEngine_.Flush();
}
gstate.cmdmem[cmd] = op; // TODO: no need to write if diff==0...
@@ -546,6 +546,8 @@ void GPU_D3D11::Execute_Prim(u32 op, u32 diff) {
}
void GPU_D3D11::Execute_Bezier(u32 op, u32 diff) {
Flush();
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
@@ -608,6 +610,8 @@ void GPU_D3D11::Execute_Bezier(u32 op, u32 diff) {
}
void GPU_D3D11::Execute_Spline(u32 op, u32 diff) {
Flush();
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
View
@@ -364,7 +364,7 @@ void GPU_DX9::FastRunLoop(DisplayList &list) {
const u8 cmdFlags = info.flags; // If we stashed the cmdFlags in the top bits of the cmdmem, we could get away with one table lookup instead of two
const u32 diff = op ^ gstate.cmdmem[cmd];
// Inlined CheckFlushOp here to get rid of the dumpThisFrame_ check.
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
if (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE)) {
drawEngine_.Flush();
}
gstate.cmdmem[cmd] = op; // TODO: no need to write if diff==0...
@@ -386,7 +386,7 @@ void GPU_DX9::FinishDeferred() {
inline void GPU_DX9::CheckFlushOp(int cmd, u32 diff) {
const u8 cmdFlags = cmdInfo_[cmd].flags;
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
if (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE)) {
if (dumpThisFrame_) {
NOTICE_LOG(G3D, "================ FLUSH ================");
}
@@ -512,6 +512,8 @@ void GPU_DX9::Execute_Prim(u32 op, u32 diff) {
}
void GPU_DX9::Execute_Bezier(u32 op, u32 diff) {
Flush();
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
@@ -559,6 +561,8 @@ void GPU_DX9::Execute_Bezier(u32 op, u32 diff) {
}
void GPU_DX9::Execute_Spline(u32 op, u32 diff) {
Flush();
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
View
@@ -571,7 +571,7 @@ void GPU_GLES::FastRunLoop(DisplayList &list) {
const u8 cmdFlags = info.flags; // If we stashed the cmdFlags in the top bits of the cmdmem, we could get away with one table lookup instead of two
const u32 diff = op ^ gstate.cmdmem[cmd];
// Inlined CheckFlushOp here to get rid of the dumpThisFrame_ check.
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
if (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE)) {
drawEngine_.Flush();
}
gstate.cmdmem[cmd] = op; // TODO: no need to write if diff==0...
@@ -596,7 +596,7 @@ void GPU_GLES::FinishDeferred() {
inline void GPU_GLES::CheckFlushOp(int cmd, u32 diff) {
const u8 cmdFlags = cmdInfo_[cmd].flags;
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
if (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE)) {
if (dumpThisFrame_) {
NOTICE_LOG(G3D, "================ FLUSH ================");
}
@@ -720,6 +720,8 @@ void GPU_GLES::Execute_VertexTypeSkinning(u32 op, u32 diff) {
}
void GPU_GLES::Execute_Bezier(u32 op, u32 diff) {
Flush();
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
@@ -782,6 +784,8 @@ void GPU_GLES::Execute_Bezier(u32 op, u32 diff) {
}
void GPU_GLES::Execute_Spline(u32 op, u32 diff) {
Flush();
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
View
@@ -1267,6 +1267,8 @@ void GPUCommon::Execute_Ret(u32 op, u32 diff) {
}
void GPUCommon::Execute_End(u32 op, u32 diff) {
Flush();
easy_guard guard(listLock);
const u32 prev = Memory::ReadUnchecked_U32(currentList->pc - 4);
UpdatePC(currentList->pc, currentList->pc);
@@ -1451,6 +1453,7 @@ void GPUCommon::Execute_TexLevel(u32 op, u32 diff) {
}
void GPUCommon::Execute_Bezier(u32 op, u32 diff) {
Flush();
// This also make skipping drawing very effective.
framebufferManager_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
@@ -1494,6 +1497,7 @@ void GPUCommon::Execute_Bezier(u32 op, u32 diff) {
}
void GPUCommon::Execute_Spline(u32 op, u32 diff) {
Flush();
// This also make skipping drawing very effective.
framebufferManager_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
@@ -1568,6 +1572,7 @@ void GPUCommon::Execute_BoundingBox(u32 op, u32 diff) {
}
void GPUCommon::Execute_BlockTransferStart(u32 op, u32 diff) {
Flush();
// and take appropriate action. This is a block transfer between RAM and VRAM, or vice versa.
// Can we skip this on SkipDraw?
DoBlockTransfer(gstate_c.skipDrawReason);
@@ -402,7 +402,7 @@ void GPU_Vulkan::FastRunLoop(DisplayList &list) {
const u8 cmdFlags = info.flags; // If we stashed the cmdFlags in the top bits of the cmdmem, we could get away with one table lookup instead of two
const u32 diff = op ^ gstate.cmdmem[cmd];
// Inlined CheckFlushOp here to get rid of the dumpThisFrame_ check.
if ((cmdFlags & FLAG_FLUSHBEFORE) || (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE))) {
if (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE)) {
drawEngine_.Flush();
}
gstate.cmdmem[cmd] = op; // TODO: no need to write if diff==0...
@@ -551,6 +551,8 @@ void GPU_Vulkan::Execute_VertexTypeSkinning(u32 op, u32 diff) {
}
void GPU_Vulkan::Execute_Bezier(u32 op, u32 diff) {
Flush();
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
@@ -613,6 +615,8 @@ void GPU_Vulkan::Execute_Bezier(u32 op, u32 diff) {
}
void GPU_Vulkan::Execute_Spline(u32 op, u32 diff) {
Flush();
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);

0 comments on commit 71baeca

Please sign in to comment.