Unify RebindFramebuffer, mostly.

This commit is contained in:
Henrik Rydgård 2017-11-15 20:44:25 +01:00
parent 3e3214d54a
commit 23f7819329
9 changed files with 12 additions and 32 deletions

View File

@ -2103,6 +2103,16 @@ void FramebufferManagerCommon::DownloadFramebufferForClut(u32 fb_address, u32 lo
}
}
void FramebufferManagerCommon::RebindFramebuffer() {
if (currentRenderVfb_ && currentRenderVfb_->fbo) {
draw_->BindFramebufferAsRenderTarget(currentRenderVfb_->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP });
} else {
// Should this even happen?
draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::KEEP, Draw::RPAction::KEEP });
}
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE);
}
std::vector<FramebufferInfo> FramebufferManagerCommon::GetFramebufferList() {
std::vector<FramebufferInfo> list;

View File

@ -214,7 +214,7 @@ public:
return vfb;
}
}
virtual void RebindFramebuffer() = 0;
virtual void RebindFramebuffer();
std::vector<FramebufferInfo> GetFramebufferList();
void CopyDisplayToOutput();

View File

@ -459,8 +459,6 @@ void FramebufferManagerD3D11::BindPostShader(const PostShaderUniforms &uniforms)
context_->Unmap(postConstants_, 0);
context_->VSSetConstantBuffers(0, 1, &postConstants_); // Probably not necessary
context_->PSSetConstantBuffers(0, 1, &postConstants_);
gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE);
}
void FramebufferManagerD3D11::RebindFramebuffer() {

View File

@ -304,15 +304,6 @@ static const D3DVERTEXELEMENT9 g_FramebufferVertexElements[] = {
}
}
void FramebufferManagerDX9::RebindFramebuffer() {
if (currentRenderVfb_ && currentRenderVfb_->fbo) {
draw_->BindFramebufferAsRenderTarget(currentRenderVfb_->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP });
} else {
// Should this even happen?
draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::KEEP, Draw::RPAction::KEEP });
}
}
void FramebufferManagerDX9::Bind2DShader() {
device_->SetVertexDeclaration(pFramebufferVertexDecl);
device_->SetPixelShader(pFramebufferPixelShader);

View File

@ -66,8 +66,6 @@ public:
bool GetStencilbuffer(u32 fb_address, int fb_stride, GPUDebugBuffer &buffer) override;
bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override;
virtual void RebindFramebuffer() override;
LPDIRECT3DSURFACE9 GetOffscreenSurface(LPDIRECT3DSURFACE9 similarSurface, VirtualFramebuffer *vfb);
LPDIRECT3DSURFACE9 GetOffscreenSurface(D3DFORMAT fmt, u32 w, u32 h);

View File

@ -438,12 +438,7 @@ void FramebufferManagerGLES::DrawActiveTexture(float x, float y, float w, float
}
void FramebufferManagerGLES::RebindFramebuffer() {
if (currentRenderVfb_ && currentRenderVfb_->fbo) {
draw_->BindFramebufferAsRenderTarget(currentRenderVfb_->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP });
} else {
// Should this even happen?
draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::KEEP, Draw::RPAction::KEEP });
}
FramebufferManagerCommon::RebindFramebuffer();
if (g_Config.iRenderingMode == FB_NON_BUFFERED_MODE)
glstate.viewport.restore();
}

View File

@ -81,7 +81,6 @@ public:
bool NotifyStencilUpload(u32 addr, int size, bool skipZero = false) override;
bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override;
virtual void RebindFramebuffer() override;
protected:

View File

@ -367,16 +367,6 @@ void FramebufferManagerVulkan::BindPostShader(const PostShaderUniforms &uniforms
gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE);
}
void FramebufferManagerVulkan::RebindFramebuffer() {
if (currentRenderVfb_ && currentRenderVfb_->fbo) {
draw_->BindFramebufferAsRenderTarget(currentRenderVfb_->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP });
} else {
// Should this even happen?
draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::KEEP, Draw::RPAction::KEEP });
}
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE);
}
int FramebufferManagerVulkan::GetLineWidth() {
if (g_Config.iInternalResolution == 0) {
return std::max(1, (int)(renderWidth_ / 480));

View File

@ -78,7 +78,6 @@ public:
bool NotifyStencilUpload(u32 addr, int size, bool skipZero = false) override;
virtual void RebindFramebuffer() override;
VkImageView BindFramebufferAsColorTexture(int stage, VirtualFramebuffer *framebuffer, int flags);
// If within a render pass, this will just issue a regular clear. If beginning a new render pass,