Move framebufChanged into the dirty flag field

This commit is contained in:
Henrik Rydgard
2017-01-23 23:25:09 +01:00
parent b423998c36
commit 7d60ec73be
11 changed files with 42 additions and 31 deletions
+1 -1
View File
@@ -287,7 +287,7 @@ void GetFramebufferHeuristicInputs(FramebufferHeuristicParams *params, const GPU
}
VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const FramebufferHeuristicParams &params, u32 skipDrawReason) {
gstate_c.framebufChanged = false;
gstate_c.Clean(DIRTY_FRAMEBUF);
// Collect all parameters. This whole function has really become a cesspool of heuristics...
// but it appears that's what it takes, unless we emulate VRAM layout more accurately somehow.
+3
View File
@@ -87,6 +87,9 @@ enum : uint64_t {
DIRTY_ALL_UNIFORMS = 0x1FFFFFFFFFULL,
// Other dirty elements that aren't uniforms!
DIRTY_FRAMEBUF = 1ULL << 40,
// Now we can add further dirty flags that are not uniforms.
DIRTY_ALL = 0xFFFFFFFFFFFFFFFF
+1 -1
View File
@@ -1303,7 +1303,7 @@ namespace DX9 {
// TODO: It's really bad that we are calling SetRenderFramebuffer here with
// all the irrelevant state checking it'll use to decide what to do. Should
// do something more focused here.
SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
transformDraw_->Flush();
}
+7 -7
View File
@@ -754,7 +754,7 @@ void GPU_DX9::Execute_Prim(u32 op, u32 diff) {
}
// This also make skipping drawing very effective.
framebufferManagerDX9_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManagerDX9_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
drawEngine_.SetupVertexDecoder(gstate.vertType);
// Rough estimate, not sure what's correct.
@@ -801,7 +801,7 @@ void GPU_DX9::Execute_Prim(u32 op, u32 diff) {
void GPU_DX9::Execute_Bezier(u32 op, u32 diff) {
// This also make skipping drawing very effective.
framebufferManagerDX9_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManagerDX9_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
// TODO: Should this eat some cycles? Probably yes. Not sure if important.
return;
@@ -844,7 +844,7 @@ void GPU_DX9::Execute_Bezier(u32 op, u32 diff) {
void GPU_DX9::Execute_Spline(u32 op, u32 diff) {
// This also make skipping drawing very effective.
framebufferManagerDX9_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManagerDX9_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
// TODO: Should this eat some cycles? Probably yes. Not sure if important.
return;
@@ -889,7 +889,7 @@ void GPU_DX9::Execute_Spline(u32 op, u32 diff) {
}
void GPU_DX9::Execute_ViewportType(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
switch (op >> 24) {
case GE_CMD_VIEWPORTZSCALE:
@@ -900,17 +900,17 @@ void GPU_DX9::Execute_ViewportType(u32 op, u32 diff) {
}
void GPU_DX9::Execute_Region(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
void GPU_DX9::Execute_Scissor(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
void GPU_DX9::Execute_FramebufType(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
+1 -1
View File
@@ -1962,7 +1962,7 @@ void FramebufferManagerGLES::FlushBeforeCopy() {
// TODO: It's really bad that we are calling SetRenderFramebuffer here with
// all the irrelevant state checking it'll use to decide what to do. Should
// do something more focused here.
SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
transformDraw_->Flush();
}
+8 -8
View File
@@ -921,7 +921,7 @@ void GPU_GLES::Execute_Prim(u32 op, u32 diff) {
}
// This also makes skipping drawing very effective.
framebufferManagerGL_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManagerGL_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
drawEngine_.SetupVertexDecoder(gstate.vertType);
// Rough estimate, not sure what's correct.
@@ -989,7 +989,7 @@ void GPU_GLES::Execute_VertexTypeSkinning(u32 op, u32 diff) {
void GPU_GLES::Execute_Bezier(u32 op, u32 diff) {
// This also make skipping drawing very effective.
framebufferManagerGL_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManagerGL_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
// TODO: Should this eat some cycles? Probably yes. Not sure if important.
return;
@@ -1043,7 +1043,7 @@ void GPU_GLES::Execute_Bezier(u32 op, u32 diff) {
void GPU_GLES::Execute_Spline(u32 op, u32 diff) {
// This also make skipping drawing very effective.
framebufferManagerGL_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManagerGL_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
// TODO: Should this eat some cycles? Probably yes. Not sure if important.
return;
@@ -1111,27 +1111,27 @@ void GPU_GLES::Execute_Spline(u32 op, u32 diff) {
}
void GPU_GLES::Execute_Region(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
void GPU_GLES::Execute_Scissor(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
void GPU_GLES::Execute_FramebufType(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
void GPU_GLES::Execute_ViewportType(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
void GPU_GLES::Execute_ViewportZType(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
gstate_c.DirtyUniform(DIRTY_DEPTHRANGE);
}
+2 -2
View File
@@ -1071,7 +1071,7 @@ void GPUCommon::Execute_End(u32 op, u32 diff) {
void GPUCommon::Execute_Bezier(u32 op, u32 diff) {
// This also make skipping drawing very effective.
framebufferManager_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManager_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
// TODO: Should this eat some cycles? Probably yes. Not sure if important.
return;
@@ -1114,7 +1114,7 @@ void GPUCommon::Execute_Bezier(u32 op, u32 diff) {
void GPUCommon::Execute_Spline(u32 op, u32 diff) {
// This also make skipping drawing very effective.
framebufferManager_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManager_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
// TODO: Should this eat some cycles? Probably yes. Not sure if important.
return;
+1 -1
View File
@@ -219,7 +219,6 @@ void GPUStateCache::DoState(PointerWrap &p) {
textureChanged = TEXCHANGE_UPDATED;
textureFullAlpha = old.textureFullAlpha;
vertexFullAlpha = old.vertexFullAlpha;
framebufChanged = old.framebufChanged;
skipDrawReason = old.skipDrawReason;
uv = old.uv;
} else {
@@ -230,6 +229,7 @@ void GPUStateCache::DoState(PointerWrap &p) {
p.Do(textureChanged);
p.Do(textureFullAlpha);
p.Do(vertexFullAlpha);
bool framebufChanged; // legacy
p.Do(framebufChanged);
p.Do(skipDrawReason);
+9 -1
View File
@@ -492,9 +492,18 @@ struct GPUStateCache {
void DirtyUniform(u64 what) {
dirty |= what;
}
void Dirty(u64 what) {
dirty |= what;
}
void CleanUniforms() {
dirty &= ~DIRTY_ALL_UNIFORMS;
}
void Clean(u64 what) {
dirty &= ~what;
}
bool IsDirty(u64 what) const {
return (dirty & what) != 0ULL;
}
u32 featureFlags;
@@ -508,7 +517,6 @@ struct GPUStateCache {
bool textureFullAlpha;
bool textureSimpleAlpha;
bool vertexFullAlpha;
bool framebufChanged;
int skipDrawReason;
+1 -1
View File
@@ -1628,7 +1628,7 @@ void FramebufferManagerVulkan::FlushBeforeCopy() {
// TODO: It's really bad that we are calling SetRenderFramebuffer here with
// all the irrelevant state checking it'll use to decide what to do. Should
// do something more focused here.
SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
drawEngine_->Flush(curCmd_);
}
+8 -8
View File
@@ -778,7 +778,7 @@ void GPU_Vulkan::Execute_Prim(u32 op, u32 diff) {
}
// This also makes skipping drawing very effective.
framebufferManager_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManager_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
drawEngine_.SetupVertexDecoder(gstate.vertType);
@@ -829,7 +829,7 @@ void GPU_Vulkan::Execute_VertexType(u32 op, u32 diff) {
void GPU_Vulkan::Execute_Bezier(u32 op, u32 diff) {
// This also make skipping drawing very effective.
framebufferManager_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManager_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
// TODO: Should this eat some cycles? Probably yes. Not sure if important.
return;
@@ -872,7 +872,7 @@ void GPU_Vulkan::Execute_Bezier(u32 op, u32 diff) {
void GPU_Vulkan::Execute_Spline(u32 op, u32 diff) {
// This also make skipping drawing very effective.
framebufferManager_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
framebufferManager_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
// TODO: Should this eat some cycles? Probably yes. Not sure if important.
return;
@@ -917,27 +917,27 @@ void GPU_Vulkan::Execute_Spline(u32 op, u32 diff) {
}
void GPU_Vulkan::Execute_Region(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
void GPU_Vulkan::Execute_Scissor(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
void GPU_Vulkan::Execute_FramebufType(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
void GPU_Vulkan::Execute_ViewportType(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
void GPU_Vulkan::Execute_ViewportZType(u32 op, u32 diff) {
gstate_c.framebufChanged = true;
gstate_c.Dirty(DIRTY_FRAMEBUF);
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
gstate_c.DirtyUniform(DIRTY_DEPTHRANGE);
}