|
@@ -63,32 +63,6 @@ wdxGraphicsWindow8::
|
|
|
~wdxGraphicsWindow8() {
|
|
~wdxGraphicsWindow8() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: wdxGraphicsWindow8::make_current
|
|
|
|
|
-// Access: Public, Virtual
|
|
|
|
|
-// Description:
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-void wdxGraphicsWindow8::
|
|
|
|
|
-make_current() {
|
|
|
|
|
- PStatTimer timer(_make_current_pcollector);
|
|
|
|
|
-
|
|
|
|
|
- DXGraphicsStateGuardian8 *dxgsg;
|
|
|
|
|
- DCAST_INTO_V(dxgsg, _gsg);
|
|
|
|
|
- dxgsg->set_context(&_wcontext);
|
|
|
|
|
-
|
|
|
|
|
- // Now that we have made the context current to a window, we can
|
|
|
|
|
- // reset the GSG state if this is the first time it has been used.
|
|
|
|
|
- // (We can't just call reset() when we construct the GSG, because
|
|
|
|
|
- // reset() requires having a current context.)
|
|
|
|
|
- if (dxgsg->reset_if_new()) {
|
|
|
|
|
- // We should also fill in the buffer mask at this time, which adds
|
|
|
|
|
- // support for depth buffer or stencil buffer if the window
|
|
|
|
|
- // supports it. This assumes that the gsg will not be shared by
|
|
|
|
|
- // other windows with a different buffer mask.
|
|
|
|
|
- dxgsg->_buffer_mask |= _buffer_mask;
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: wdxGraphicsWindow8::begin_frame
|
|
// Function: wdxGraphicsWindow8::begin_frame
|
|
|
// Access: Public, Virtual
|
|
// Access: Public, Virtual
|
|
@@ -99,11 +73,12 @@ make_current() {
|
|
|
// should be skipped.
|
|
// should be skipped.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
bool wdxGraphicsWindow8::
|
|
bool wdxGraphicsWindow8::
|
|
|
-begin_frame() {
|
|
|
|
|
|
|
+begin_frame(FrameMode mode) {
|
|
|
begin_frame_spam();
|
|
begin_frame_spam();
|
|
|
if (_gsg == (GraphicsStateGuardian *)NULL) {
|
|
if (_gsg == (GraphicsStateGuardian *)NULL) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (_awaiting_restore) {
|
|
if (_awaiting_restore) {
|
|
|
// The fullscreen window was recently restored; we can't continue
|
|
// The fullscreen window was recently restored; we can't continue
|
|
|
// until the GSG says we can.
|
|
// until the GSG says we can.
|
|
@@ -112,18 +87,15 @@ begin_frame() {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
_awaiting_restore = false;
|
|
_awaiting_restore = false;
|
|
|
-
|
|
|
|
|
init_resized_window();
|
|
init_resized_window();
|
|
|
}
|
|
}
|
|
|
- auto_resize();
|
|
|
|
|
- if (needs_context()) {
|
|
|
|
|
- if (!make_context()) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
make_current();
|
|
make_current();
|
|
|
- begin_render_texture();
|
|
|
|
|
- clear_cube_map_selection();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (mode == FM_render) {
|
|
|
|
|
+ clear_cube_map_selection();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
bool return_val = _gsg->begin_frame();
|
|
bool return_val = _gsg->begin_frame();
|
|
|
_dxgsg->set_render_target();
|
|
_dxgsg->set_render_target();
|
|
|
return return_val;
|
|
return return_val;
|
|
@@ -137,17 +109,49 @@ begin_frame() {
|
|
|
// should do whatever finalization is required.
|
|
// should do whatever finalization is required.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void wdxGraphicsWindow8::
|
|
void wdxGraphicsWindow8::
|
|
|
-end_frame() {
|
|
|
|
|
|
|
+end_frame(FrameMode mode) {
|
|
|
|
|
+
|
|
|
end_frame_spam();
|
|
end_frame_spam();
|
|
|
nassertv(_gsg != (GraphicsStateGuardian *)NULL);
|
|
nassertv(_gsg != (GraphicsStateGuardian *)NULL);
|
|
|
|
|
+
|
|
|
|
|
+ if (mode == FM_render) {
|
|
|
|
|
+ copy_to_textures();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
_gsg->end_frame();
|
|
_gsg->end_frame();
|
|
|
- end_render_texture();
|
|
|
|
|
- copy_to_textures();
|
|
|
|
|
- trigger_flip();
|
|
|
|
|
- if (_one_shot) {
|
|
|
|
|
- prepare_for_deletion();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (mode == FM_render) {
|
|
|
|
|
+ trigger_flip();
|
|
|
|
|
+ if (_one_shot) {
|
|
|
|
|
+ prepare_for_deletion();
|
|
|
|
|
+ }
|
|
|
|
|
+ clear_cube_map_selection();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: wdxGraphicsWindow8::make_current
|
|
|
|
|
+// Access: Private
|
|
|
|
|
+// Description:
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+void wdxGraphicsWindow8::
|
|
|
|
|
+make_current() {
|
|
|
|
|
+ PStatTimer timer(_make_current_pcollector);
|
|
|
|
|
+
|
|
|
|
|
+ DXGraphicsStateGuardian8 *dxgsg;
|
|
|
|
|
+ DCAST_INTO_V(dxgsg, _gsg);
|
|
|
|
|
+ dxgsg->set_context(&_wcontext);
|
|
|
|
|
+
|
|
|
|
|
+ // Now that we have made the context current to a window, we can
|
|
|
|
|
+ // reset the GSG state if this is the first time it has been used.
|
|
|
|
|
+ // (We can't just call reset() when we construct the GSG, because
|
|
|
|
|
+ // reset() requires having a current context.)
|
|
|
|
|
+ if (dxgsg->reset_if_new()) {
|
|
|
|
|
+ // We should also fill in the buffer mask at this time, which adds
|
|
|
|
|
+ // support for depth buffer or stencil buffer if the window
|
|
|
|
|
+ // supports it. This assumes that the gsg will not be shared by
|
|
|
|
|
+ // other windows with a different buffer mask.
|
|
|
|
|
+ dxgsg->_buffer_mask |= _buffer_mask;
|
|
|
}
|
|
}
|
|
|
- clear_cube_map_selection();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|