ParasiteBuffer's default_display_region needs size; fix offscreen rendering for dx8/9
This commit is contained in:
parent
48e09cda31
commit
555e319c28
|
|
@ -49,6 +49,7 @@ ParasiteBuffer(GraphicsOutput *host, const string &name,
|
|||
_x_size = x_size;
|
||||
_y_size = y_size;
|
||||
_has_size = true;
|
||||
_default_display_region->compute_pixels(_x_size, _y_size);
|
||||
|
||||
_is_valid = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -268,6 +268,10 @@ DXGraphicsStateGuardian7(const FrameBufferProperties &properties) :
|
|||
_cur_read_pixel_buffer=RenderBuffer::T_front;
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
nassertr(xo == 0 && yo==0 && w == pb->get_xsize() && h == pb->get_ysize(), false);
|
||||
|
|
|
|||
|
|
@ -396,6 +396,10 @@ DXGraphicsStateGuardian8(const FrameBufferProperties &properties) :
|
|||
|
||||
_cur_read_pixel_buffer=RenderBuffer::T_front;
|
||||
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;
|
||||
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;
|
||||
pb->set_xsize(w);
|
||||
|
|
@ -3240,7 +3244,7 @@ copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr) {
|
|||
nassertr(pb != NULL && dr != NULL, false);
|
||||
|
||||
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
|
||||
nassertr(xo == 0 && yo==0 && w == pb->get_xsize() && h == pb->get_ysize(), false);
|
||||
|
|
|
|||
|
|
@ -396,6 +396,10 @@ DXGraphicsStateGuardian9(const FrameBufferProperties &properties) :
|
|||
|
||||
_cur_read_pixel_buffer=RenderBuffer::T_front;
|
||||
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;
|
||||
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;
|
||||
pb->set_xsize(w);
|
||||
|
|
@ -3242,7 +3246,7 @@ copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr) {
|
|||
nassertr(pb != NULL && dr != NULL, false);
|
||||
|
||||
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
|
||||
nassertr(xo == 0 && yo==0 && w == pb->get_xsize() && h == pb->get_ysize(), false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue