d3d9: Log better when offscreen surface fails.

We're getting reporting that this is happening.
This commit is contained in:
Unknown W. Brackets 2015-06-21 12:50:02 -07:00
parent 33d8c3c1af
commit 2013034bd6
2 changed files with 10 additions and 6 deletions

View File

@ -588,9 +588,13 @@ namespace DX9 {
return fbo;
}
LPDIRECT3DSURFACE9 FramebufferManagerDX9::GetOffscreenSurface(LPDIRECT3DSURFACE9 similarSurface) {
D3DSURFACE_DESC desc;
similarSurface->GetDesc(&desc);
LPDIRECT3DSURFACE9 FramebufferManagerDX9::GetOffscreenSurface(LPDIRECT3DSURFACE9 similarSurface, VirtualFramebuffer *vfb) {
D3DSURFACE_DESC desc = {};
HRESULT hr = similarSurface->GetDesc(&desc);
if (FAILED(hr)) {
ERROR_LOG_REPORT(G3D, "Unable to get size for offscreen surface at %08x", vfb->fb_address);
return nullptr;
}
u64 key = ((u64)desc.Format << 32) | (desc.Width << 16) | desc.Height;
auto it = offscreenSurfaces_.find(key);
@ -1061,7 +1065,7 @@ namespace DX9 {
D3DSURFACE_DESC desc;
renderTarget->GetDesc(&desc);
LPDIRECT3DSURFACE9 offscreen = GetOffscreenSurface(renderTarget);
LPDIRECT3DSURFACE9 offscreen = GetOffscreenSurface(renderTarget, vfb);
if (offscreen) {
HRESULT hr = pD3Ddevice->GetRenderTargetData(renderTarget, offscreen);
if (SUCCEEDED(hr)) {
@ -1240,7 +1244,7 @@ namespace DX9 {
LPDIRECT3DSURFACE9 renderTarget = vfb->fbo ? fbo_get_color_for_read(vfb->fbo) : nullptr;
bool success = false;
if (renderTarget) {
LPDIRECT3DSURFACE9 offscreen = GetOffscreenSurface(renderTarget);
LPDIRECT3DSURFACE9 offscreen = GetOffscreenSurface(renderTarget, vfb);
if (offscreen) {
success = GetRenderTargetFramebuffer(renderTarget, offscreen, vfb->renderWidth, vfb->renderHeight, buffer);
}

View File

@ -90,7 +90,7 @@ public:
virtual void RebindFramebuffer() override;
FBO *GetTempFBO(u16 w, u16 h, FBOColorDepth depth = FBO_8888);
LPDIRECT3DSURFACE9 GetOffscreenSurface(LPDIRECT3DSURFACE9 similarSurface);
LPDIRECT3DSURFACE9 GetOffscreenSurface(LPDIRECT3DSURFACE9 similarSurface, VirtualFramebuffer *vfb);
protected:
virtual void DisableState() override;