diff options
author | backer@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-10 21:25:55 +0000 |
---|---|---|
committer | backer@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-10 21:25:55 +0000 |
commit | 21700451472d76b2b51fc181d127b95167b73fb3 (patch) | |
tree | 774377a127b79a4b12dbfe253f032850c196897c /ui/gl/scoped_binders.h | |
parent | 26b6336c8c915c96caacf67e05599a97cf1b0049 (diff) | |
download | chromium_src-21700451472d76b2b51fc181d127b95167b73fb3.zip chromium_src-21700451472d76b2b51fc181d127b95167b73fb3.tar.gz chromium_src-21700451472d76b2b51fc181d127b95167b73fb3.tar.bz2 |
GPU: Prefer to restore from decoder state rather than GL state when possible.
Some drivers are buggy. Wherever possible, use the decoder state restoration
for the Scoped{Texture,Framebuffer}Binders.
BUG=239509
Review URL: https://chromiumcodereview.appspot.com/15021011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199542 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl/scoped_binders.h')
-rw-r--r-- | ui/gl/scoped_binders.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/ui/gl/scoped_binders.h b/ui/gl/scoped_binders.h index c133673..dab7b31 100644 --- a/ui/gl/scoped_binders.h +++ b/ui/gl/scoped_binders.h @@ -5,9 +5,11 @@ #ifndef UI_GL_SCOPED_BINDERS_H_ #define UI_GL_SCOPED_BINDERS_H_ +#include "base/basictypes.h" #include "ui/gl/gl_export.h" -namespace ui { +namespace gfx { +class GLStateRestorer; class GL_EXPORT ScopedFrameBufferBinder { public: @@ -15,19 +17,34 @@ class GL_EXPORT ScopedFrameBufferBinder { ~ScopedFrameBufferBinder(); private: + // Whenever possible we prefer to use the current GLContext's + // GLStateRestorer to maximize driver compabitility. + GLStateRestorer* state_restorer_; + + // Failing that we use GL calls to save and restore state. int old_fbo_; + + DISALLOW_COPY_AND_ASSIGN(ScopedFrameBufferBinder); }; + class GL_EXPORT ScopedTextureBinder { public: ScopedTextureBinder(unsigned int target, unsigned int id); ~ScopedTextureBinder(); private: + // Whenever possible we prefer to use the current GLContext's + // GLStateRestorer to maximize driver compabitility. + GLStateRestorer* state_restorer_; + + // Failing that we use GL calls to save and restore state. int target_; int old_id_; + + DISALLOW_COPY_AND_ASSIGN(ScopedTextureBinder); }; -} // namespace ui +} // namespace gfx #endif // UI_GL_SCOPED_BINDERS_H_ |