FastUIDraw
painter_header.hpp
Go to the documentation of this file.
1 /*!
2  * \file painter_header.hpp
3  * \brief file painter_header.hpp
4  *
5  * Copyright 2016 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 #ifndef FASTUIDRAW_PAINTER_HEADER_HPP
19 #define FASTUIDRAW_PAINTER_HEADER_HPP
20 
21 #include <fastuidraw/util/util.hpp>
22 #include <fastuidraw/util/vecN.hpp>
24 
25 namespace fastuidraw
26 {
27 /*!\addtogroup PainterBackend
28  * @{
29  */
30 
31  /*!
32  * \brief
33  * A PainterHeader represents the values of the header for
34  * the shaders to read to draw data. The header holds data
35  * that is common for all vertices and fragments for an
36  * item to draw, including with what shader and the data
37  * for the shader.
38  */
40  {
41  public:
42  enum
43  {
44  /*!
45  * When \ref m_blend_shader_data_location is set to
46  * \ref drawing_occluder, it indicates that the item
47  * being drawing is an occluder thus the color
48  * computation from the brush and item can be skipped.
49  */
51  };
52 
53  /*!
54  * \brief
55  * Enumerations specifying how the contents of a PainterHeader
56  * are packed into a data store buffer (PainterDraw::m_store),
57  * offsets are in units of uint32_t (not \ref uvec4).
58  */
59  enum offset_t
60  {
61  clip_equations_location_offset, /*!< offset to \ref m_clip_equations_location */
62  item_matrix_location_offset, /*!< offset to \ref m_item_matrix_location */
63  brush_shader_data_location_offset, /*!< offset to \ref m_brush_shader_data_location */
64  item_shader_data_location_offset, /*!< offset to \ref m_item_shader_data_location */
65  blend_shader_data_location_offset, /*!< offset to \ref m_blend_shader_data_location */
66  item_shader_offset, /*!< offset to \ref m_item_shader */
67  brush_shader_offset, /*!< offset to \ref m_brush_shader */
68  blend_shader_offset, /*!< offset to \ref m_blend_shader */
69  z_offset, /*!< offset to \ref m_z */
70  offset_to_deferred_coverage_x_offset, /*!< offset to \ref m_offset_to_deferred_coverage .x() */
71  offset_to_deferred_coverage_y_offset, /*!< offset to \ref m_offset_to_deferred_coverage .y() */
72  deferred_coverage_min_x_offset, /*!< offset to \ref m_deferred_coverage_min .x() */
73  deferred_coverage_min_y_offset, /*!< offset to \ref m_deferred_coverage_min .y() */
74  deferred_coverage_max_x_offset, /*!< offset to \ref m_deferred_coverage_max .x() */
75  deferred_coverage_max_y_offset, /*!< offset to \ref m_deferred_coverage_max .y() */
76 
77  /*!
78  * Offset to \ref m_brush_adjust_location
79  */
81 
82  header_size /*!< size of header */
83  };
84 
85  /*!
86  * The offset, in units of uvec4 tuples, to the
87  * location in the data store buffer (PainterDraw::m_store) for the
88  * clip equations. I.e. the PainterClipEquations value is stored
89  * (packed) at the location \code
90  * PainterDraw::m_store[m_clip_equations_location]
91  * \endcode
92  */
94 
95  /*!
96  * The location, in units of uvec4 tuples, to the
97  * location in the data store buffer (PainterDraw::m_store) for the
98  * item matrix. I.e. the PainterItemMatrix value is stored (packed)
99  * at the location
100  * \code
101  * PainterDraw::m_store[m_item_matrix_location]
102  * \endcode
103  */
105 
106  /*!
107  * The location, in units of uvec4 tuples, to the
108  * location in the data store buffer (PainterDraw::m_store) for the
109  * brush shader data. I.e. the data for a brush is stored (packed)
110  * at the location
111  * \code
112  * PainterDraw::m_store[m_brush_shader_data_location]
113  * \endcode
114  */
116 
117  /*!
118  * The location, in units of uvec4 tuples, to the
119  * location in the data store buffer (PainterDraw::m_store) for the
120  * item shader data. I.e. the PainterItemShaderData value is stored
121  * (packed) at the location
122  * \code
123  * PainterDraw::m_store[m_item_shader_data_location]
124  * \endcode
125  */
127 
128  /*!
129  * The location, in units of uvec4 tuples, to the
130  * location in the data store buffer (PainterDraw::m_store) for the
131  * blend shader data. I.e. the PainterBlendShaderData value
132  * is stored (packed) at the location
133  * \code
134  * PainterDraw::m_store[m_blend_shader_data_location]
135  * \endcode
136  * NOTE: if \ref m_blend_shader_data_location is \ref
137  * drawing_occluder this means that the item being drawing
138  * is an occluder thus the color computation from the brush
139  * and item can be skipped.
140  */
142 
143  /*!
144  * The ID of the item shader (i.e. PainterItemShader::ID()).
145  */
146  uint32_t m_item_shader;
147 
148  /*!
149  * The ID of the brush shader (i.e. PainterBrushShader::ID()).
150  */
151  uint32_t m_brush_shader;
152 
153  /*!
154  * The ID of the blend shader (i.e. PainterBlendShader::ID()).
155  */
156  uint32_t m_blend_shader;
157 
158  /*!
159  * The z-value to use for the item. The z-value is used
160  * by Painter to implement clipping and to prevent overdraw.
161  * This is the value by which to increment the z-value of
162  * the output of an item's vertex shader
163  */
164  int32_t m_z;
165 
166  /*!
167  * Offset in pixels from where to read the deferred coverage
168  * values.
169  */
171 
172  /*!
173  * Minimum value (in coverage buffer pixel coordinates)
174  * from which allowed to read the coverage buffer.
175  */
177 
178  /*!
179  * Maximum value (in coverage buffer pixel coordinates) from
180  * which allowed to read the coverage buffer.
181  */
183 
184  /*!
185  * If non-zero, indicates that the brush position is to be
186  * adjusted in vertex shading before being fed the the brush
187  * shading. When non-zero, is an offset, in units of
188  * uvec4 tuples, to the location in the data
189  * store buffer (PainterDraw::m_store) for the value encoded
190  * by a \ref PainterBrushAdjust packed at the location
191  * \code
192  * PainterDraw::m_store[m_clip_equations_location]
193  * \endcode
194  */
196 
197  /*!
198  * Pack the values of this PainterHeader
199  * \param dst place to which to pack data
200  */
201  void
202  pack_data(c_array<uvec4> dst) const;
203 
204  /*!
205  * Returns the length of the data needed to encode the data.
206  */
207  static
208  unsigned int
209  data_size(void)
210  {
212  }
213  };
214 
215 /*! @} */
216 }
217 
218 #endif
#define FASTUIDRAW_NUMBER_BLOCK4_NEEDED(X)
Definition: util.hpp:42
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
static unsigned int data_size(void)
file c_array.hpp
A PainterHeader represents the values of the header for the shaders to read to draw data...
offset_t
Enumerations specifying how the contents of a PainterHeader are packed into a data store buffer (Pain...
file util.hpp
A c_array is a wrapper over a C pointer with a size parameter to facilitate bounds checking and provi...
Definition: c_array.hpp:43
file vecN.hpp
void pack_data(c_array< uvec4 > dst) const