FastUIDraw
painter_shader_data.hpp
Go to the documentation of this file.
1 /*!
2  * \file painter_shader_data.hpp
3  * \brief file painter_shader_data.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_SHADER_DATA_HPP
21 #define FASTUIDRAW_PAINTER_SHADER_DATA_HPP
22 
24 #include <fastuidraw/util/util.hpp>
26 
27 namespace fastuidraw
28 {
29 /*!\addtogroup PainterShaderData
30  * @{
31  */
32 
33  /*!
34  * \brief
35  * Common base class to \ref PainterItemShaderData,
36  * \ref PainterBrushShaderData and \ref
37  * PainterBlendShaderData to hold shader data for
38  * custom shaders.
39  */
41  {
42  public:
43  virtual
45  {}
46 
47  /*!
48  * To be implemented by a derived class to pack the
49  * data.
50  * \param dst location to which to pack the data
51  */
52  virtual
53  void
54  pack_data(c_array<uvec4> dst) const = 0;
55 
56  /*!
57  * To be implemented by a derived class to return
58  * the number of uvec4 blocks needed
59  * to pack the data.
60  */
61  virtual
62  unsigned int
63  data_size(void) const = 0;
64 
65  /*!
66  * To be optionally implemented by a derived class to
67  * save references to resources that need to be resident
68  * after packing. Default implementation does nothing.
69  * \param dst location to which to save resources.
70  */
71  virtual
72  void
74  {
75  FASTUIDRAWunused(dst);
76  }
77 
78  /*!
79  * To be optionally implemented by a derived class to
80  * return the number of resources that need to be resident
81  * after packing. Default implementation returns 0.
82  */
83  virtual
84  unsigned int
85  number_resources(void) const
86  {
87  return 0;
88  };
89  };
90 
91  /*!
92  * \brief
93  * PainterItemShaderData holds custom data for item shaders
94  */
96  {};
97 
98  /*!
99  * \brief
100  * PainterBlendShaderData holds custom data for blend shaders
101  */
103  {};
104 
105 /*! @} */
106 
107 } //namespace fastuidraw
108 
109 #endif
virtual void pack_data(c_array< uvec4 > dst) const =0
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
virtual unsigned int data_size(void) const =0
virtual unsigned int number_resources(void) const
A wrapper over a pointer to implement reference counting.
file c_array.hpp
#define FASTUIDRAWunused(X)
Definition: util.hpp:84
virtual void save_resources(c_array< reference_counted_ptr< const resource_base > > dst) const
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
PainterBlendShaderData holds custom data for blend shaders.
Class for which copy ctor and assignment operator are private functions.
Definition: util.hpp:505
Common base class to PainterItemShaderData, PainterBrushShaderData and PainterBlendShaderData to hold...
PainterItemShaderData holds custom data for item shaders.
file reference_counted.hpp