mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
D3D11: Fix Star Ocean again (wasn't clearing stencil properly)
This commit is contained in:
parent
3606111113
commit
5f6e0feacb
2 changed files with 20 additions and 27 deletions
|
@ -201,22 +201,12 @@ bool FramebufferManagerD3D11::NotifyStencilUpload(u32 addr, int size, bool skipZ
|
|||
D3D11_VIEWPORT vp{ 0.0f, 0.0f, (float)w, (float)h, 0.0f, 1.0f };
|
||||
context_->RSSetViewports(1, &vp);
|
||||
|
||||
float fw = dstBuffer->width;
|
||||
float fh = dstBuffer->height;
|
||||
|
||||
float coord[20] = {
|
||||
0.0f,0.0f,0.0f, 0.0f,0.0f,
|
||||
fw,0.0f,0.0f, u1,0.0f,
|
||||
0.0f,fh,0.0f, 0.0f,v1,
|
||||
fw,fh,0.0f, u1,v1,
|
||||
-1.0f, 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
1.0f, 1.0f, 0.0f, u1, 0.0f,
|
||||
-1.0f, -1.0f, 0.0f, 0.0f, v1,
|
||||
1.0f, -1.0f, 0.0f, u1, v1,
|
||||
};
|
||||
// I think all these calculations pretty much cancel out?
|
||||
float invDestW = 1.0f / (fw * 0.5f);
|
||||
float invDestH = 1.0f / (fh * 0.5f);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
coord[i * 5] = coord[i * 5] * invDestW - 1.0f;
|
||||
coord[i * 5 + 1] = -(coord[i * 5 + 1] * invDestH - 1.0f);
|
||||
}
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE map;
|
||||
context_->Map(quadBuffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
|
||||
|
|
|
@ -1291,21 +1291,24 @@ void D3D11DrawContext::BindFramebufferAsRenderTarget(Framebuffer *fbo, const Ren
|
|||
if (fbo) {
|
||||
D3D11Framebuffer *fb = (D3D11Framebuffer *)fbo;
|
||||
if (curRenderTargetView_ == fb->colorRTView && curDepthStencilView_ == fb->depthStencilRTView) {
|
||||
return;
|
||||
// No need to switch, but let's fallthrough to clear!
|
||||
} else {
|
||||
context_->OMSetRenderTargets(1, &fb->colorRTView, fb->depthStencilRTView);
|
||||
curRenderTargetView_ = fb->colorRTView;
|
||||
curDepthStencilView_ = fb->depthStencilRTView;
|
||||
curRTWidth_ = fb->width;
|
||||
curRTHeight_ = fb->height;
|
||||
}
|
||||
context_->OMSetRenderTargets(1, &fb->colorRTView, fb->depthStencilRTView);
|
||||
curRenderTargetView_ = fb->colorRTView;
|
||||
curDepthStencilView_ = fb->depthStencilRTView;
|
||||
curRTWidth_ = fb->width;
|
||||
curRTHeight_ = fb->height;
|
||||
} else {
|
||||
if (curRenderTargetView_ == bbRenderTargetView_ && curDepthStencilView_ == bbDepthStencilView_)
|
||||
return;
|
||||
context_->OMSetRenderTargets(1, &bbRenderTargetView_, bbDepthStencilView_);
|
||||
curRenderTargetView_ = bbRenderTargetView_;
|
||||
curDepthStencilView_ = bbDepthStencilView_;
|
||||
curRTWidth_ = bbWidth_;
|
||||
curRTHeight_ = bbHeight_;
|
||||
if (curRenderTargetView_ == bbRenderTargetView_ && curDepthStencilView_ == bbDepthStencilView_) {
|
||||
// No need to switch, but let's fallthrough to clear!
|
||||
} else {
|
||||
context_->OMSetRenderTargets(1, &bbRenderTargetView_, bbDepthStencilView_);
|
||||
curRenderTargetView_ = bbRenderTargetView_;
|
||||
curDepthStencilView_ = bbDepthStencilView_;
|
||||
curRTWidth_ = bbWidth_;
|
||||
curRTHeight_ = bbHeight_;
|
||||
}
|
||||
}
|
||||
if (rp.color == RPAction::CLEAR && curRenderTargetView_) {
|
||||
float cv[4]{};
|
||||
|
|
Loading…
Add table
Reference in a new issue