FastUIDraw
fastuidraw_painter_uniforms.glsl.hpp
Go to the documentation of this file.
1 /*!
2  * \file fastuidraw_painter_uniforms.glsl.hpp
3  * \brief file fastuidraw_painter_uniforms.glsl.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 /*!\addtogroup GLSLVertFragCode
20  * @{
21  */
22 #ifdef GLSL_DOXYGEN
23 
24  /*!
25  * \def FASTUIDRAW_PAINTER_NUMBER_CONTEXT_TEXTURES
26  * The maximum number of simutaneous bound textures that the shader
27  * supports, i.e. the value of \ref
28  * fastuidraw::PainterEngine::ConfigurationBase::number_context_textures().
29  */
30  #define FASTUIDRAW_PAINTER_NUMBER_CONTEXT_TEXTURES
31 
32  /*!
33  * The array of \ref fastuidraw::Image objects whose \ref fastuidraw::Image::type()
34  * has value \ref fastuidraw::Image::context_texture2d that are currently bound.
35  * For \ref fastuidraw::PainterBrush if it has such an image, it is always bound
36  * to fastuidraw_context_texture[0] and for \ref fastuidraw::PainterBrushShaderData,
37  * the i'th index into \ref fastuidraw::PainterBrushShaderData is bound to
38  * fastuidraw_context_texture[i]
39  */
41 
42  /*!
43  * \def FASTUIDRAW_SUPPORT_BINDLESS_TEXTURE
44  * If this macro is defined, then bindless texturing is supported.
45  * Bindless texturing allows one to create sampler object handles
46  * from 64-bit uint data. See \ref FASTUIDRAW_BINDLESS_HANDLE_UVEC2
47  * and \ref FASTUIDRAW_BINDLESS_HANDLE_128U for how the GLSL
48  * implementation realizes the 64-bit handle values.
49  */
50  #define FASTUIDRAW_SUPPORT_BINDLESS_TEXTURE
51 
52  /*!
53  * \def FASTUIDRAW_BINDLESS_HANDLE_UVEC2
54  * If this macro is defined, then bindless texturing is supported
55  * (see \ref FASTUIDRAW_SUPPORT_BINDLESS_TEXTURE) and the 64-bit
56  * handle from which to construct sampler handles is realized as
57  * a uvec2 where the low 32-bits are in the .x component and the
58  * high 32-bits are in the .y component.
59  */
60  #define FASTUIDRAW_BINDLESS_HANDLE_UVEC2
61 
62  /*!
63  * \def FASTUIDRAW_BINDLESS_HANDLE_128U
64  * If this macro is defined, then bindless texturing is supported
65  * (see \ref FASTUIDRAW_SUPPORT_BINDLESS_TEXTURE) and the 64-bit
66  * handle from which to construct sampler handles is realized as
67  * a uint64_t.
68  */
69  #define FASTUIDRAW_BINDLESS_HANDLE_128U
70 
71  /*!
72  * \def fastuidraw_fetch_data(X)
73  * Use this macro to fetch a single 128-bit value from the data
74  * store bufferrealized as a uvec4. To get floating point data,
75  * use the GLSL built-in function uintBitsToFloat().
76  * \param X offset into data store buffer
77  */
78  #define fastuidraw_fetch_data(X)
79 #endif
80 /*! @} */
81 
82 ///@cond
83 
84 ///////////////////////////////////////
85 // Painter Data Store
86 #ifdef FASTUIDRAW_PAINTER_USE_DATA_TBO
87 
88  FASTUIDRAW_LAYOUT_BINDING(FASTUIDRAW_PAINTER_STORE_BINDING) uniform usamplerBuffer fastuidraw_painterStore_tbo;
89  #define fastuidraw_fetch_data(block) texelFetch(fastuidraw_painterStore_tbo, int(block))
90 
91 #elif defined(FASTUIDRAW_PAINTER_USE_DATA_SSBO)
92 
93  FASTUIDRAW_LAYOUT_BINDING_ARGS(FASTUIDRAW_PAINTER_STORE_BINDING, std430) restrict readonly buffer fastuidraw_painterStore_ssbo
94  {
95  uvec4 fastuidraw_painterStore[];
96  };
97  #define fastuidraw_fetch_data(block) fastuidraw_painterStore[int(block)]
98 
99 #elif defined(FASTUIDRAW_PAINTER_USE_DATA_UBO)
100 
101  FASTUIDRAW_LAYOUT_BINDING_ARGS(FASTUIDRAW_PAINTER_STORE_BINDING, std140) uniform fastuidraw_painterStore_ubo
102  {
103  uvec4 fastuidraw_painterStore[FASTUIDRAW_PAINTER_DATA_STORE_ARRAY_SIZE];
104  };
105  #define fastuidraw_fetch_data(block) fastuidraw_painterStore[int(block)]
106 
107 #endif
108 
109 FASTUIDRAW_LAYOUT_BINDING(FASTUIDRAW_PAINTER_CONTEXT_TEXTURE_BINDING) uniform sampler2D fastuidraw_context_texture[FASTUIDRAW_PAINTER_NUMBER_CONTEXT_TEXTURES];
110 
111 ///@endcond
uniform sampler2D fastuidraw_context_texture[FASTUIDRAW_PAINTER_NUMBER_CONTEXT_TEXTURES]
vecN< uint32_t, 4 > uvec4
Definition: vecN.hpp:1290
#define FASTUIDRAW_PAINTER_NUMBER_CONTEXT_TEXTURES