From d149ca28bb52192a21fc708f1e3dcaf670bc5609 Mon Sep 17 00:00:00 2001 From: aignacio_sf <> Date: Wed, 14 Dec 2005 19:55:04 +0000 Subject: [PATCH] Fix framebuffer_copy_to_ram function. GetRenderTargetData function requires the target buffer size to be the same size as the backbuffer. --- panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index c7fb538947..d509f0b5b5 100755 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -1569,12 +1569,18 @@ framebuffer_copy_to_ram(Texture *tex, int z, const DisplayRegion *dr, const Rend // need to copy it to a temporary surface of the appropriate type // first. D3DPOOL pool; + D3DSURFACE_DESC surface_description; + + backbuffer -> GetDesc (&surface_description); pool = D3DPOOL_SYSTEMMEM; - hr = _d3d_device->CreateOffscreenPlainSurface(w, h, _screen->_display_mode.Format, - pool, - &temp_surface, - NULL); + hr = _d3d_device->CreateOffscreenPlainSurface( + surface_description.Width, + surface_description.Height, + surface_description.Format, + pool, + &temp_surface, + NULL); if (FAILED(hr)) { dxgsg9_cat.error() << "CreateImageSurface failed in copy_pixel_buffer()"