gl_state_restorer.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_GL_GL_STATE_RESTORER_H_
  5. #define UI_GL_GL_STATE_RESTORER_H_
  6. #include "ui/gl/gl_export.h"
  7. namespace gpu {
  8. namespace gles2 {
  9. class GLES2Decoder;
  10. } // namespace gles2
  11. } // namespace gpu
  12. namespace gl {
  13. // An interface for Restoring GL State.
  14. // This will expand over time to provide an more optimizable implementation.
  15. class GL_EXPORT GLStateRestorer {
  16. public:
  17. GLStateRestorer();
  18. GLStateRestorer(const GLStateRestorer&) = delete;
  19. GLStateRestorer& operator=(const GLStateRestorer&) = delete;
  20. virtual ~GLStateRestorer();
  21. virtual bool IsInitialized() = 0;
  22. virtual void RestoreState(const GLStateRestorer* prev_state) = 0;
  23. virtual void RestoreAllTextureUnitAndSamplerBindings() = 0;
  24. virtual void RestoreActiveTexture() = 0;
  25. virtual void RestoreActiveTextureUnitBinding(unsigned int target) = 0;
  26. virtual void RestoreAllExternalTextureBindingsIfNeeded() = 0;
  27. virtual void RestoreFramebufferBindings() = 0;
  28. virtual void RestoreProgramBindings() = 0;
  29. virtual void RestoreBufferBinding(unsigned int target) = 0;
  30. virtual void RestoreVertexAttribArray(unsigned int index) = 0;
  31. virtual void PauseQueries() = 0;
  32. virtual void ResumeQueries() = 0;
  33. };
  34. } // namespace gl
  35. #endif // UI_GL_GL_STATE_RESTORER_H_