Преглед на файлове

ParasiteBuffer's default_display_region needs size; fix offscreen rendering for dx8/9

David Rose преди 21 години
родител
ревизия
555e319c28

+ 1 - 0
panda/src/display/parasiteBuffer.cxx

@@ -49,6 +49,7 @@ ParasiteBuffer(GraphicsOutput *host, const string &name,
   _x_size = x_size;
   _x_size = x_size;
   _y_size = y_size;
   _y_size = y_size;
   _has_size = true;
   _has_size = true;
+  _default_display_region->compute_pixels(_x_size, _y_size);
 
 
   _is_valid = true;
   _is_valid = true;
 
 

+ 5 - 1
panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx

@@ -268,6 +268,10 @@ DXGraphicsStateGuardian7(const FrameBufferProperties &properties) :
     _cur_read_pixel_buffer=RenderBuffer::T_front;
     _cur_read_pixel_buffer=RenderBuffer::T_front;
 
 
     set_color_clear_value(_color_clear_value);
     set_color_clear_value(_color_clear_value);
+
+    // DirectX drivers seem to consistently invert the texture when
+    // they copy framebuffer-to-texture.  Ok.
+    _copy_texture_inverted = true;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -3563,7 +3567,7 @@ copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr) {
     nassertr(pb != NULL && dr != NULL, false);
     nassertr(pb != NULL && dr != NULL, false);
 
 
     int xo, yo, w, h;
     int xo, yo, w, h;
-    dr->get_region_pixels(xo, yo, w, h);
+    dr->get_region_pixels_i(xo, yo, w, h);
 
 
     // only handled simple case
     // only handled simple case
     nassertr(xo == 0 && yo==0 && w == pb->get_xsize() && h == pb->get_ysize(), false);
     nassertr(xo == 0 && yo==0 && w == pb->get_xsize() && h == pb->get_ysize(), false);

+ 6 - 2
panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx

@@ -396,6 +396,10 @@ DXGraphicsStateGuardian8(const FrameBufferProperties &properties) :
 
 
     _cur_read_pixel_buffer=RenderBuffer::T_front;
     _cur_read_pixel_buffer=RenderBuffer::T_front;
     set_color_clear_value(_color_clear_value);
     set_color_clear_value(_color_clear_value);
+
+    // DirectX drivers seem to consistently invert the texture when
+    // they copy framebuffer-to-texture.  Ok.
+    _copy_texture_inverted = true;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -3148,7 +3152,7 @@ copy_texture(Texture *tex, const DisplayRegion *dr) {
 
 
   HRESULT hr;
   HRESULT hr;
   int xo, yo, w, h;
   int xo, yo, w, h;
-  dr->get_region_pixels(xo, yo, w, h);
+  dr->get_region_pixels_i(xo, yo, w, h);
 
 
   PixelBuffer *pb = tex->_pbuffer;
   PixelBuffer *pb = tex->_pbuffer;
   pb->set_xsize(w);
   pb->set_xsize(w);
@@ -3240,7 +3244,7 @@ copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr) {
     nassertr(pb != NULL && dr != NULL, false);
     nassertr(pb != NULL && dr != NULL, false);
 
 
     int xo, yo, w, h;
     int xo, yo, w, h;
-    dr->get_region_pixels(xo, yo, w, h);
+    dr->get_region_pixels_i(xo, yo, w, h);
 
 
     // only handled simple case
     // only handled simple case
     nassertr(xo == 0 && yo==0 && w == pb->get_xsize() && h == pb->get_ysize(), false);
     nassertr(xo == 0 && yo==0 && w == pb->get_xsize() && h == pb->get_ysize(), false);

+ 6 - 2
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -396,6 +396,10 @@ DXGraphicsStateGuardian9(const FrameBufferProperties &properties) :
 
 
     _cur_read_pixel_buffer=RenderBuffer::T_front;
     _cur_read_pixel_buffer=RenderBuffer::T_front;
     set_color_clear_value(_color_clear_value);
     set_color_clear_value(_color_clear_value);
+
+    // DirectX drivers seem to consistently invert the texture when
+    // they copy framebuffer-to-texture.  Ok.
+    _copy_texture_inverted = true;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -3145,7 +3149,7 @@ copy_texture(Texture *tex, const DisplayRegion *dr) {
 
 
   HRESULT hr;
   HRESULT hr;
   int xo, yo, w, h;
   int xo, yo, w, h;
-  dr->get_region_pixels(xo, yo, w, h);
+  dr->get_region_pixels_i(xo, yo, w, h);
 
 
   PixelBuffer *pb = tex->_pbuffer;
   PixelBuffer *pb = tex->_pbuffer;
   pb->set_xsize(w);
   pb->set_xsize(w);
@@ -3242,7 +3246,7 @@ copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr) {
     nassertr(pb != NULL && dr != NULL, false);
     nassertr(pb != NULL && dr != NULL, false);
 
 
     int xo, yo, w, h;
     int xo, yo, w, h;
-    dr->get_region_pixels(xo, yo, w, h);
+    dr->get_region_pixels_i(xo, yo, w, h);
 
 
     // only handled simple case
     // only handled simple case
     nassertr(xo == 0 && yo==0 && w == pb->get_xsize() && h == pb->get_ysize(), false);
     nassertr(xo == 0 && yo==0 && w == pb->get_xsize() && h == pb->get_ysize(), false);