diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-09 22:45:15 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-09 22:45:15 +0000 |
commit | f3edc51bfb87650346ec6f3a39086cbaded71c0b (patch) | |
tree | 2f42081d8bc54cd6a98fc5e2e1356e06e4a7e19f /o3d | |
parent | 672606d6d4197b45b4239249b53b4c386e26f5a7 (diff) | |
download | chromium_src-f3edc51bfb87650346ec6f3a39086cbaded71c0b.zip chromium_src-f3edc51bfb87650346ec6f3a39086cbaded71c0b.tar.gz chromium_src-f3edc51bfb87650346ec6f3a39086cbaded71c0b.tar.bz2 |
Make more stuff private in renderer
Review URL: http://codereview.chromium.org/199066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25805 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/core/cross/renderer.cc | 17 | ||||
-rw-r--r-- | o3d/core/cross/renderer.h | 65 | ||||
-rw-r--r-- | o3d/core/win/d3d9/renderer_d3d9.cc | 2 |
3 files changed, 47 insertions, 37 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; } } diff --git a/o3d/core/cross/renderer.h b/o3d/core/cross/renderer.h index 20c6086..df5bbd2 100644 --- a/o3d/core/cross/renderer.h +++ b/o3d/core/cross/renderer.h @@ -629,36 +629,10 @@ class Renderer { // Sets the client's size. Derived classes must call this on Init and Resize. void SetClientSize(int width, int height); - // The current render surfaces. NULL = no surface. - const RenderSurface* current_render_surface_; - const RenderDepthStencilSurface* current_depth_surface_; - bool current_render_surface_is_back_buffer_; - - Sampler::Ref error_sampler_; // sampler used when one is missing. - Texture::Ref error_texture_; // texture used when one is missing. - Texture::Ref fallback_error_texture_; // texture used when error_texture is - // null. - ParamObject::Ref error_object_; // holds params used for missing textures. - ParamSampler::Ref error_param_sampler_; // A Param for the error sampler. - - // Map of State Handlers. - StateHandlerMap state_handler_map_; - - // Stack of state params - ParamVectorArray state_param_stacks_; - - // Stack of state objects. - StateArray state_stack_; - - // State object holding the default state settings. - State::Ref default_state_; - - // A State object holding the settings required to be able to clear the - // back buffer. - State::Ref clear_back_buffer_state_; - - // Lost Resources Callbacks. - LostResourcesCallbackManager lost_resources_callback_manager_; + // Calls any registered lost resources callback. + void CallLostResourcesCallback() const { + lost_resources_callback_manager_.Run(); + } int dest_x_offset() const { return dest_x_offset_; @@ -693,6 +667,37 @@ class Renderer { ServiceImplementation<Renderer> service_; ServiceDependency<Features> features_; + // The current render surfaces. NULL = no surface. + const RenderSurface* current_render_surface_; + const RenderDepthStencilSurface* current_depth_surface_; + bool current_render_surface_is_back_buffer_; + + Sampler::Ref error_sampler_; // sampler used when one is missing. + Texture::Ref error_texture_; // texture used when one is missing. + Texture::Ref fallback_error_texture_; // texture used when error_texture is + // null. + ParamObject::Ref error_object_; // holds params used for missing textures. + ParamSampler::Ref error_param_sampler_; // A Param for the error sampler. + + // Map of State Handlers. + StateHandlerMap state_handler_map_; + + // Stack of state params + ParamVectorArray state_param_stacks_; + + // Stack of state objects. + StateArray state_stack_; + + // State object holding the default state settings. + State::Ref default_state_; + + // A State object holding the settings required to be able to clear the + // back buffer. + State::Ref clear_back_buffer_state_; + + // Lost Resources Callbacks. + LostResourcesCallbackManager lost_resources_callback_manager_; + // Current viewport setting. Float4 viewport_; diff --git a/o3d/core/win/d3d9/renderer_d3d9.cc b/o3d/core/win/d3d9/renderer_d3d9.cc index 6a92bb9..3c56994 100644 --- a/o3d/core/win/d3d9/renderer_d3d9.cc +++ b/o3d/core/win/d3d9/renderer_d3d9.cc @@ -1266,7 +1266,7 @@ void RendererD3D9::TestLostDevice() { // Direct3d tells us it is possible to reset the device now.. // So let's attempt a reset! if (ResetDevice()) { - lost_resources_callback_manager_.Run(); + CallLostResourcesCallback(); } } } |