Fixes, state invalidation

This commit is contained in:
Henrik Rydgård
2022-08-03 22:23:07 +02:00
parent f8e0c09463
commit f84d2e9ba7
3 changed files with 9 additions and 8 deletions
+6 -4
View File
@@ -2390,6 +2390,7 @@ void FramebufferManagerCommon::ReadFramebufferToMemory(VirtualFramebuffer *vfb,
}
}
draw_->InvalidateCachedState();
textureCache_->ForgetLastTexture();
RebindFramebuffer("RebindFramebuffer - ReadFramebufferToMemory");
}
@@ -2444,6 +2445,7 @@ void FramebufferManagerCommon::DownloadFramebufferForClut(u32 fb_address, u32 lo
}
void FramebufferManagerCommon::RebindFramebuffer(const char *tag) {
draw_->InvalidateCachedState();
shaderManager_->DirtyLastShader();
if (currentRenderVfb_ && currentRenderVfb_->fbo) {
draw_->BindFramebufferAsRenderTarget(currentRenderVfb_->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::KEEP }, tag);
@@ -2599,8 +2601,8 @@ void FramebufferManagerCommon::BlitFramebuffer(VirtualFramebuffer *dst, int dstX
useCopy = false;
}
float srcXFactor = useBlit ? src->renderScaleFactor : 1.0f;
float srcYFactor = useBlit ? src->renderScaleFactor : 1.0f;
float srcXFactor = src->renderScaleFactor;
float srcYFactor = src->renderScaleFactor;
const int srcBpp = src->format == GE_FORMAT_8888 ? 4 : 2;
if (srcBpp != bpp && bpp != 0) {
srcXFactor = (srcXFactor * bpp) / srcBpp;
@@ -2610,8 +2612,8 @@ void FramebufferManagerCommon::BlitFramebuffer(VirtualFramebuffer *dst, int dstX
int srcY1 = srcY * srcYFactor;
int srcY2 = (srcY + h) * srcYFactor;
float dstXFactor = useBlit ? dst->renderScaleFactor : 1.0f;
float dstYFactor = useBlit ? dst->renderScaleFactor : 1.0f;
float dstXFactor = dst->renderScaleFactor;
float dstYFactor = dst->renderScaleFactor;
const int dstBpp = dst->format == GE_FORMAT_8888 ? 4 : 2;
if (dstBpp != bpp && bpp != 0) {
dstXFactor = (dstXFactor * bpp) / dstBpp;
+1 -3
View File
@@ -795,13 +795,11 @@ void PresentationCommon::CopyToOutput(OutputFlags flags, int uvRotation, float u
draw_->DrawIndexed(6, 0);
}
draw_->BindIndexBuffer(nullptr, 0);
DoRelease(srcFramebuffer_);
DoRelease(srcTexture_);
// Unbinds all textures and samplers too, needed since sometimes a MakePixelTexture is deleted etc.
draw_->BindPipeline(nullptr);
draw_->InvalidateCachedState();
previousUniforms_ = uniforms;
}
+2 -1
View File
@@ -322,8 +322,9 @@ bool FramebufferManagerCommon::PerformStencilUpload(u32 addr, int size, StencilU
draw_->BlitFramebuffer(blitFBO, 0, 0, w, h, dstBuffer->fbo, 0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight, Draw::FB_STENCIL_BIT, Draw::FB_BLIT_NEAREST, "NotifyStencilUpload_Blit");
RebindFramebuffer("RebindFramebuffer - Stencil");
}
tex->Release();
draw_->InvalidateCachedState();
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE);
return true;
}