FastUIDraw
gpu_dirty_state.hpp
Go to the documentation of this file.
1 /*!
2  * \file gpu_dirty_state.hpp
3  * \brief file gpu_dirty_state.hpp
4  *
5  * Copyright 2018 by Intel.
6  *
7  * Contact: kevin.rogovin@gmail.com
8  *
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
16  *
17  */
18 
19 #ifndef FASTUIDRAW_GPU_DIRTY_STATE_HPP
20 #define FASTUIDRAW_GPU_DIRTY_STATE_HPP
21 
22 #include <stdint.h>
23 
24 namespace fastuidraw
25 {
26 /*!\addtogroup Utility
27  * @{
28  */
29  /*!
30  * Object to encapsulate GPU dirty state via bit-flags.
31  */
33  {
34  public:
35  /*!
36  * Enumeration to specify the bit-flags to specify
37  * dirty GPU state.
38  */
39  enum bit_flags
40  {
41  /*!
42  * If this bit is up, indicates that the shaders used
43  * by the GPU has changed.
44  */
45  shader = 1 << 0,
46 
47  /*!
48  * If this bit is up, indicates that the binding
49  * of the texture binding slots used by the shader
50  * of a PainterBackend derived class have changed.
51  * For example, in GL these changes are accompished
52  * by calling glBindTexture().
53  */
54  textures = 1 << 1,
55 
56  /*!
57  * If this bit is up, indicates that the binding
58  * of the image binding slots used by the shader
59  * of a PainterBackend derived class have changed.
60  * For example, in GL these changes are accompished
61  * by calling glBindImageTexture().
62  */
63  images = 1 << 2,
64 
65  /*!
66  * If this bit is up, indicates that the blend
67  * state of the GPU has changed.
68  */
69  blend_mode = 1 << 3,
70 
71  /*!
72  * If this bit is up, indicates that the bound
73  * render-target of the GPU has changed. For example,
74  * in GL changing the render-target is accomplished
75  * by glBindFramgebuffer() and/or glDrawBuffers().
76  */
77  render_target = 1 << 4,
78 
79  /*!
80  * If this bit is up, indicates that the viewport
81  * or scissor values have changed. For example, in GL
82  * this is accomplished by calling glViewport(),
83  * glScissor() or glEnable/glDisable() passing
84  * GL_SCISSOR_TEST.
85  */
86  viewport_scissor = 1 << 5,
87 
88  /*!
89  * If this bit is up, indicates that the source or format
90  * for index or vertex buffers has changed. For example,
91  * in GL, this can be accomplished by calling
92  * glBindVertexArray() or modifying the currently bound
93  * vertex array object.
94  */
96 
97  /*!
98  * If this bit is up, indicates that a constant buffer
99  * source has changed. For GL, these are UBOs. For example,
100  * in GL, this can be accomplished by calling glBindBuffer()
101  * with the binding target as GL_UNIFORM_BUFFER.
102  */
104 
105  /*!
106  * If this bit is up, indicates that a storage buffer
107  * source has changed. For GL, these are UBOs. For example,
108  * in GL, this can be accomplished by calling glBindBuffer()
109  * with the binding target as GL_SHADER_STORAGE_BUFFER.
110  */
111  storage_buffers = 1 << 8,
112 
113  /*!
114  * If this bit is up, the depth or stencil test has been
115  * modified.
116  */
117  depth_stencil = 1 << 9,
118 
119  /*!
120  * If this bit is up, the color, depth or stencil masks
121  * have changed. For example, in GL this is accomlished
122  * by called glColorMask() glDepthMask() or glStencilMask().
123  */
124  buffer_masks = 1 << 10,
125 
126  /*!
127  * If this bit is up, indicates that the HW clip planes
128  * has changed.
129  */
130  hw_clip = 1 << 11,
131 
132  /*!
133  * Specify that all state is dirty.
134  */
135  all = ~0u,
136  };
137 
138  /*!
139  * Ctor.
140  * \param flags bit field using \ref bit_flags to specify
141  * what portion of GPU state is firty
142  */
143  gpu_dirty_state(uint32_t flags = 0u):
144  m_flags(flags)
145  {}
146 
147  /*!
148  * Implicit cast-operator to uint32_t.
149  */
150  operator uint32_t() const { return m_flags; }
151 
152  /*!
153  * Implicit cast-operator to uint32_t.
154  */
155  operator uint32_t&() { return m_flags; }
156 
157  private:
158  uint32_t m_flags;
159  };
160 /*! @} */
161 }
162 
163 #endif
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
gpu_dirty_state(uint32_t flags=0u)