• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2017 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // ClearMultiviewGL:
7 //   A helper for clearing multiview side-by-side and layered framebuffers.
8 //
9 
10 #ifndef LIBANGLE_RENDERER_GL_CLEARMULTIVIEWGL_H_
11 #define LIBANGLE_RENDERER_GL_CLEARMULTIVIEWGL_H_
12 
13 #include "angle_gl.h"
14 #include "libANGLE/Error.h"
15 #include "libANGLE/angletypes.h"
16 
17 namespace gl
18 {
19 class FramebufferState;
20 }  // namespace gl
21 
22 namespace rx
23 {
24 class FunctionsGL;
25 class StateManagerGL;
26 
27 class ClearMultiviewGL : angle::NonCopyable
28 {
29   public:
30     // Enum containing the different types of Clear* commands.
31     enum class ClearCommandType
32     {
33         Clear,
34         ClearBufferfv,
35         ClearBufferuiv,
36         ClearBufferiv,
37         ClearBufferfi
38     };
39 
40   public:
41     ClearMultiviewGL(const FunctionsGL *functions, StateManagerGL *stateManager);
42     ~ClearMultiviewGL();
43 
44     ClearMultiviewGL(const ClearMultiviewGL &rht) = delete;
45     ClearMultiviewGL &operator=(const ClearMultiviewGL &rht) = delete;
46     ClearMultiviewGL(ClearMultiviewGL &&rht)                 = delete;
47     ClearMultiviewGL &operator=(ClearMultiviewGL &&rht) = delete;
48 
49     void clearMultiviewFBO(const gl::FramebufferState &state,
50                            const gl::Rectangle &scissorBase,
51                            ClearCommandType clearCommandType,
52                            GLbitfield mask,
53                            GLenum buffer,
54                            GLint drawbuffer,
55                            const uint8_t *values,
56                            GLfloat depth,
57                            GLint stencil);
58     void initializeResources();
59 
60   private:
61     void attachTextures(const gl::FramebufferState &state, int layer);
62     void detachTextures(const gl::FramebufferState &state);
63     void clearLayeredFBO(const gl::FramebufferState &state,
64                          ClearCommandType clearCommandType,
65                          GLbitfield mask,
66                          GLenum buffer,
67                          GLint drawbuffer,
68                          const uint8_t *values,
69                          GLfloat depth,
70                          GLint stencil);
71     void genericClear(ClearCommandType clearCommandType,
72                       GLbitfield mask,
73                       GLenum buffer,
74                       GLint drawbuffer,
75                       const uint8_t *values,
76                       GLfloat depth,
77                       GLint stencil);
78 
79     const FunctionsGL *mFunctions;
80     StateManagerGL *mStateManager;
81 
82     GLuint mFramebuffer;
83 };
84 }  // namespace rx
85 
86 #endif  // LIBANGLE_RENDERER_GL_CLEARMULTIVIEWGL_H_