FastUIDraw
painter_item_shader.hpp
Go to the documentation of this file.
1 /*!
2  * \file painter_item_shader.hpp
3  * \brief file painter_item_shader.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 
19 
20 #ifndef FASTUIDRAW_PAINTER_ITEM_SHADER_HPP
21 #define FASTUIDRAW_PAINTER_ITEM_SHADER_HPP
24 
25 namespace fastuidraw
26 {
27 
28 /*!\addtogroup PainterShaders
29  * @{
30  */
31 
32  /*!
33  * \brief
34  * A PainterItemShader represents a shader to
35  * draw an item (typically a vertex and fragment
36  * shader pair).
37  */
39  {
40  public:
41  /*!
42  * Ctor for a PainterItemShader with no sub-shaders.
43  * \param cvg coverage shader for the PainterItemShader;
44  * the coverage shader, if present is to use
45  * the exact same \ref PainterItemShaderData
46  * value but render to the coverage buffer.
47  * The \ref PainterItemShader can then use
48  * those coverage values in its shader code.
49  */
50  explicit
53  PainterShader(),
54  m_coverage_shader(cvg)
55  {}
56 
57  /*!
58  * Ctor for creating a PainterItemShader which has multiple
59  * sub-shaders. The purpose of sub-shaders is for the
60  * case where multiple shaders almost same code and those
61  * code differences can be realized by examining a sub-shader
62  * ID.
63  * \param num_sub_shaders number of sub-shaders
64  * \param cvg coverage shader for the PainterItemShader;
65  * the coverage shader, if present is to use
66  * the exact same \ref PainterItemShaderData
67  * value but render to the coverage buffer.
68  * The \ref PainterItemShader can then use
69  * those coverage values in its shader code.
70  */
71  explicit
72  PainterItemShader(unsigned int num_sub_shaders,
75  PainterShader(num_sub_shaders),
76  m_coverage_shader(cvg)
77  {}
78 
79  /*!
80  * Ctor to create a PainterItemShader realized as a sub-shader
81  * of an existing PainterItemShader
82  * \param parent parent PainterItemShader that has sub-shaders
83  * \param sub_shader which sub-shader of the parent PainterItemShader
84  * \param cvg coverage shader for the PainterItemShader;
85  * the coverage shader, if present is to use
86  * the exact same \ref PainterItemShaderData
87  * value but render to the coverage buffer.
88  * The \ref PainterItemShader can then use
89  * those coverage values in its shader code.
90  */
92  unsigned int sub_shader,
95  PainterShader(parent, sub_shader),
96  m_coverage_shader(cvg)
97  {}
98 
99  /*!
100  * The coverage shader used by this \ref PainterItemShader;
101  * the coverage shader, if present is to use the exact same
102  * \ref PainterItemShaderData value but renders to the
103  * coverage buffer. The \ref PainterItemShader can then use
104  * those coverage values in its shader code.
105  */
107  coverage_shader(void) const
108  {
109  return m_coverage_shader;
110  }
111 
112  private:
114  };
115 
116 /*! @} */
117 }
118 
119 #endif
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
PainterItemShader(reference_counted_ptr< PainterItemShader > parent, unsigned int sub_shader, const reference_counted_ptr< PainterItemCoverageShader > &cvg=reference_counted_ptr< PainterItemCoverageShader >())
PainterItemShader(unsigned int num_sub_shaders, const reference_counted_ptr< PainterItemCoverageShader > &cvg=reference_counted_ptr< PainterItemCoverageShader >())
A PainterShader encapsulates how to draw or blend.
A wrapper over a pointer to implement reference counting.
const reference_counted_ptr< PainterItemCoverageShader > & coverage_shader(void) const
file painter_item_coverage_shader.hpp
file painter_shader.hpp
PainterItemShader(const reference_counted_ptr< PainterItemCoverageShader > &cvg=reference_counted_ptr< PainterItemCoverageShader >())
uint32_t sub_shader(void) const
const reference_counted_ptr< PainterShader > & parent(void) const
A PainterItemShader represents a shader to draw an item (typically a vertex and fragment shader pair)...