diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 52685b7e91..a0454b91a6 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -1090,10 +1090,10 @@ class ShowBase(DirectObject.DirectObject): # region (see the comment in setupRender2d, above). dr.setClearDepthActive(1) - # Make any texture reloads on the gui come up first, before - # textures on the rest of the scene, and before the default - # asynchronous animation load priority (100). - dr.setTextureReloadPriority(200) + # Make any texture reloads on the gui come up immediately. + # Temporary hasattr for old Pandas. + if hasattr(dr, 'setIncompleteRender'): + dr.setIncompleteRender(False) left, right, bottom, top = coords @@ -1136,7 +1136,8 @@ class ShowBase(DirectObject.DirectObject): # Unlike render2d, we don't clear the depth buffer for # render2dp. Caveat emptor. - dr.setTextureReloadPriority(250) + if hasattr(dr, 'setIncompleteRender'): + dr.setIncompleteRender(False) left, right, bottom, top = coords diff --git a/panda/src/display/displayRegion.I b/panda/src/display/displayRegion.I index a7996987ac..9946522021 100644 --- a/panda/src/display/displayRegion.I +++ b/panda/src/display/displayRegion.I @@ -186,6 +186,40 @@ get_clear_depth_between_eyes() const { return _clear_depth_between_eyes; } +//////////////////////////////////////////////////////////////////// +// Function: DisplayRegion::set_incomplete_render +// Access: Public +// Description: Sets the incomplete_render flag. When this is +// true, the frame will be rendered even if some of the +// geometry or textures in the scene are not available +// (e.g. they have been temporarily paged out). When +// this is false, the frame will be held up while this +// data is reloaded. +// +// This flag may also be set on the +// GraphicsStateGuardian. It will be considered true +// for a given DisplayRegion only if it is true on both +// the GSG and on the DisplayRegion. +// +// See GraphicsStateGuardian::set_incomplete_render() +// for more detail. +//////////////////////////////////////////////////////////////////// +INLINE void DisplayRegion:: +set_incomplete_render(bool incomplete_render) { + _incomplete_render = incomplete_render; +} + +//////////////////////////////////////////////////////////////////// +// Function: DisplayRegion::get_incomplete_render +// Access: Public, Virtual +// Description: Returns the incomplete_render flag. See +// set_incomplete_render(). +//////////////////////////////////////////////////////////////////// +INLINE bool DisplayRegion:: +get_incomplete_render() const { + return _incomplete_render; +} + //////////////////////////////////////////////////////////////////// // Function: DisplayRegion::set_texture_reload_priority // Access: Published diff --git a/panda/src/display/displayRegion.cxx b/panda/src/display/displayRegion.cxx index 798db4ef4b..ac136497fd 100644 --- a/panda/src/display/displayRegion.cxx +++ b/panda/src/display/displayRegion.cxx @@ -32,6 +32,7 @@ DisplayRegion:: DisplayRegion(GraphicsOutput *window) : _window(window), _clear_depth_between_eyes(true), + _incomplete_render(true), _texture_reload_priority(0), _cull_region_pcollector("Cull:Invalid"), _draw_region_pcollector("Draw:Invalid") @@ -50,6 +51,7 @@ DisplayRegion:: DisplayRegion(GraphicsOutput *window, float l, float r, float b, float t) : _window(window), _clear_depth_between_eyes(true), + _incomplete_render(true), _texture_reload_priority(0), _cull_region_pcollector("Cull:Invalid"), _draw_region_pcollector("Draw:Invalid") diff --git a/panda/src/display/displayRegion.h b/panda/src/display/displayRegion.h index d25e758eab..13f8f2e259 100644 --- a/panda/src/display/displayRegion.h +++ b/panda/src/display/displayRegion.h @@ -95,6 +95,9 @@ PUBLISHED: INLINE void set_clear_depth_between_eyes(bool clear_depth_between_eyes); INLINE bool get_clear_depth_between_eyes() const; + INLINE void set_incomplete_render(bool incomplete_render); + INLINE bool get_incomplete_render() const; + INLINE void set_texture_reload_priority(int texture_reload_priority); INLINE int get_texture_reload_priority() const; @@ -149,6 +152,7 @@ private: GraphicsOutput *_window; bool _clear_depth_between_eyes; + bool _incomplete_render; int _texture_reload_priority; // Ditto for the cull traverser. diff --git a/panda/src/display/graphicsStateGuardian.I b/panda/src/display/graphicsStateGuardian.I index f8ed10ecb1..16fcb9119f 100644 --- a/panda/src/display/graphicsStateGuardian.I +++ b/panda/src/display/graphicsStateGuardian.I @@ -137,6 +137,11 @@ needs_reset() const { // screens, to guarantee that all of your assets are // available by the time you take the loading screen // down. +// +// This flag may also be set individually on each +// DisplayRegion. It will be considered true for a +// given DisplayRegion only if it is true on both the +// GSG and on the DisplayRegion. //////////////////////////////////////////////////////////////////// INLINE void GraphicsStateGuardian:: set_incomplete_render(bool incomplete_render) { diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 7d79eb8ad5..3b1ab14012 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -1075,6 +1075,7 @@ prepare_display_region(DisplayRegionPipelineReader *dr, Lens::StereoChannel stereo_channel) { _current_display_region = dr->get_object(); _current_stereo_channel = stereo_channel; + _effective_incomplete_render = _incomplete_render && _current_display_region->get_incomplete_render(); _stereo_buffer_mask = ~0; diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index b32c022423..709600e17b 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -387,6 +387,7 @@ protected: bool _closing_gsg; bool _active; bool _incomplete_render; + bool _effective_incomplete_render; PT(Loader) _loader; PT(PreparedGraphicsObjects) _prepared_objects; diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx index fb751abf2d..bab25ce2df 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx @@ -300,7 +300,7 @@ upload_texture(DXTextureContext8 *dtc, bool force) { return false; } - if (_incomplete_render && !force) { + if (_effective_incomplete_render && !force) { bool has_image = _supports_compressed_texture ? tex->has_ram_image() : tex->has_uncompressed_ram_image(); if (!has_image && tex->might_have_ram_image() && tex->has_simple_ram_image() && diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index e07fb497dc..8e488ee1b1 100755 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -359,7 +359,7 @@ upload_texture(DXTextureContext9 *dtc, bool force) { dtc->update_data_size_bytes(0); dtc->mark_unloaded(); - if (_incomplete_render && !force) { + if (_effective_incomplete_render && !force) { bool has_image = _supports_compressed_texture ? tex->has_ram_image() : tex->has_uncompressed_ram_image(); if (!has_image && tex->might_have_ram_image() && tex->has_simple_ram_image() && diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 58f9569521..d1c4c557cd 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -6983,7 +6983,7 @@ bool CLP(GraphicsStateGuardian):: upload_texture(CLP(TextureContext) *gtc, bool force) { Texture *tex = gtc->get_texture(); - if (_incomplete_render && !force) { + if (_effective_incomplete_render && !force) { bool has_image = _supports_compressed_texture ? tex->has_ram_image() : tex->has_uncompressed_ram_image(); if (!has_image && tex->might_have_ram_image() && tex->has_simple_ram_image() && diff --git a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx index a8c3195160..505704ad33 100644 --- a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx +++ b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx @@ -2428,7 +2428,7 @@ bool TinyGraphicsStateGuardian:: upload_texture(TinyTextureContext *gtc, bool force) { Texture *tex = gtc->get_texture(); - if (_incomplete_render && !force) { + if (_effective_incomplete_render && !force) { if (!tex->has_ram_image() && tex->might_have_ram_image() && tex->has_simple_ram_image() && !_loader.is_null()) {