From 76cdd23bab561d8802233a3df14d7d7c99c4113c Mon Sep 17 00:00:00 2001 From: aignacio_sf <> Date: Sat, 10 Dec 2005 02:24:39 +0000 Subject: [PATCH] fix framebuffer_copy_to_ram function --- panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index 1fff7459ad..be6bf81278 100755 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -1527,7 +1527,7 @@ framebuffer_copy_to_ram(Texture *tex, int z, const DisplayRegion *dr, const Rend // first. D3DPOOL pool; - pool = D3DPOOL_SCRATCH; + pool = D3DPOOL_SYSTEMMEM; hr = _d3d_device->CreateOffscreenPlainSurface(w, h, _screen->_display_mode.Format, pool, &temp_surface, @@ -1542,17 +1542,18 @@ framebuffer_copy_to_ram(Texture *tex, int z, const DisplayRegion *dr, const Rend // Now we must copy from the backbuffer to our temporary surface. -/* ***** DX9 CopyRects */ -// hr = _d3d_device->CopyRects(backbuffer, &rect, 1, temp_surface, NULL); - hr = -1; +// DX8 VERSION hr = _d3d_device->CopyRects(backbuffer, &rect, 1, temp_surface, NULL); + hr = _d3d_device -> GetRenderTargetData (backbuffer, temp_surface); if (FAILED(hr)) { - dxgsg9_cat.error() << "CopyRects failed" << D3DERRORSTRING(hr); + dxgsg9_cat.error() << "GetRenderTargetData failed" << D3DERRORSTRING(hr); temp_surface->Release(); backbuffer->Release(); return false; } + copy_inverted = true; + RELEASE(backbuffer, dxgsg9, "backbuffer", RELEASE_ONCE); } else if (_cur_read_pixel_buffer & RenderBuffer::T_front) {