OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 } | 620 } |
621 } | 621 } |
622 state_stack_.pop_back(); | 622 state_stack_.pop_back(); |
623 } | 623 } |
624 | 624 |
625 void Renderer::SetRenderSurfaces(RenderSurface* surface, | 625 void Renderer::SetRenderSurfaces(RenderSurface* surface, |
626 RenderDepthStencilSurface* depth_surface) { | 626 RenderDepthStencilSurface* depth_surface) { |
627 if (surface != NULL || depth_surface != NULL) { | 627 if (surface != NULL || depth_surface != NULL) { |
628 SetRenderSurfacesPlatformSpecific(surface, depth_surface); | 628 SetRenderSurfacesPlatformSpecific(surface, depth_surface); |
629 current_render_surface_ = surface; | 629 current_render_surface_ = surface; |
| 630 current_depth_surface_ = depth_surface; |
630 if (surface) { | 631 if (surface) { |
631 render_width_ = surface->width(); | 632 render_width_ = surface->width(); |
632 render_height_ = surface->height(); | 633 render_height_ = surface->height(); |
633 } else { | 634 } else { |
634 render_width_ = depth_surface->width(); | 635 render_width_ = depth_surface->width(); |
635 render_height_ = depth_surface->height(); | 636 render_height_ = depth_surface->height(); |
636 } | 637 } |
637 } else { | 638 } else { |
638 SetBackBufferPlatformSpecific(); | 639 SetBackBufferPlatformSpecific(); |
639 current_render_surface_ = NULL; | 640 current_render_surface_ = NULL; |
| 641 current_depth_surface_ = NULL; |
640 render_width_ = width(); | 642 render_width_ = width(); |
641 render_height_ = height(); | 643 render_height_ = height(); |
642 } | 644 } |
643 // We must reset the viewport after each change in surfaces. | 645 // We must reset the viewport after each change in surfaces. |
644 SetViewport(viewport_, depth_range_); | 646 SetViewport(viewport_, depth_range_); |
645 } | 647 } |
646 | 648 |
647 void Renderer::GetRenderSurfaces(RenderSurface** surface, | 649 void Renderer::GetRenderSurfaces(RenderSurface** surface, |
648 RenderDepthStencilSurface** depth_surface) { | 650 RenderDepthStencilSurface** depth_surface) { |
649 DCHECK(surface); | 651 DCHECK(surface); |
650 DCHECK(depth_surface); | 652 DCHECK(depth_surface); |
651 *surface = current_render_surface_; | 653 *surface = current_render_surface_; |
652 *depth_surface = current_depth_surface_; | 654 *depth_surface = current_depth_surface_; |
653 } | 655 } |
654 | 656 |
655 bool Renderer::SafeToBindTexture(Texture* texture) const { | 657 bool Renderer::SafeToBindTexture(Texture* texture) const { |
656 if (current_render_surface_ && | 658 if (current_render_surface_ && |
657 current_render_surface_->texture() == texture) { | 659 current_render_surface_->texture() == texture) { |
658 return false; | 660 return false; |
659 } | 661 } |
660 | 662 |
661 return true; | 663 return true; |
662 } | 664 } |
663 | 665 |
664 } // namespace o3d | 666 } // namespace o3d |
OLD | NEW |