summaryrefslogtreecommitdiffstats
path: root/o3d/core/cross/renderer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'o3d/core/cross/renderer.cc')
-rw-r--r--o3d/core/cross/renderer.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/o3d/core/cross/renderer.cc b/o3d/core/cross/renderer.cc
index fde2727..ff640b7 100644
--- a/o3d/core/cross/renderer.cc
+++ b/o3d/core/cross/renderer.cc
@@ -99,12 +99,12 @@ bool Renderer::IsForceSoftwareRenderer() {
}
Renderer::Renderer(ServiceLocator* service_locator)
- : current_render_surface_(NULL),
- current_depth_surface_(NULL),
- current_render_surface_is_back_buffer_(true),
- service_locator_(service_locator),
+ : service_locator_(service_locator),
service_(service_locator, this),
features_(service_locator),
+ current_render_surface_(NULL),
+ current_depth_surface_(NULL),
+ current_render_surface_is_back_buffer_(true),
viewport_(0.0f, 0.0f, 1.0f, 1.0f),
depth_range_(0.0f, 1.0f),
write_mask_(0xf),
@@ -251,9 +251,8 @@ void Renderer::SetClientSize(int width, int height) {
bool Renderer::StartRendering() {
DCHECK_GE(start_depth_, 0);
- ++start_depth_;
bool result = true;
- if (start_depth_ == 1) {
+ if (start_depth_ == 0) {
++render_frame_count_;
rendering_ = true;
transforms_culled_ = 0;
@@ -277,6 +276,9 @@ bool Renderer::StartRendering() {
}
}
}
+ if (result) {
+ ++start_depth_;
+ }
return result;
}
@@ -308,6 +310,9 @@ void Renderer::FinishRendering() {
if (start_depth_ == 0) {
ApplyDirtyStates();
PlatformSpecificFinishRendering();
+ // Don't hold pointers to these when we are finished rendering.
+ current_render_surface_ = NULL;
+ current_depth_surface_ = NULL;
rendering_ = false;
}
}