瀏覽代碼

fix framebuffer_copy_to_ram function

aignacio_sf 20 年之前
父節點
當前提交
76cdd23bab
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

+ 6 - 5
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) {