5
5
#ifndef _NBL_BUILTIN_GLSL_VIRTUAL_GEOMETRY_DESCRIPTORS_INCLUDED_
6
6
#define _NBL_BUILTIN_GLSL_VIRTUAL_GEOMETRY_DESCRIPTORS_INCLUDED_
7
7
8
+
9
+
8
10
#ifndef _NBL_VG_USE_SSBO
9
11
12
+
10
13
#ifndef _NBL_VG_DESCRIPTOR_SET
11
14
#define _NBL_VG_DESCRIPTOR_SET 0
12
15
#endif
16
+
17
+ #ifndef _NBL_VG_UINT_BUFFERS
18
+ #define _NBL_VG_UINT_BUFFERS_BINDING 0
19
+ #define _NBL_VG_UINT_BUFFERS_COUNT 1
20
+ #endif
13
21
#ifndef _NBL_VG_FLOAT_BUFFERS
14
22
#define _NBL_VG_FLOAT_BUFFERS_BINDING 1
15
23
#define _NBL_VG_FLOAT_BUFFERS_COUNT 15
18
26
#define _NBL_VG_INT_BUFFERS_BINDING 2
19
27
#define _NBL_VG_INT_BUFFERS_COUNT 0
20
28
#endif
21
- #ifndef _NBL_VG_UINT_BUFFERS
22
- #define _NBL_VG_UINT_BUFFERS_BINDING 3
23
- #define _NBL_VG_UINT_BUFFERS_COUNT 0
24
- #endif
25
29
30
+ #if _NBL_VG_UINT_BUFFERS_COUNT
31
+ layout (set = _NBL_VG_DESCRIPTOR_SET, binding = _NBL_VG_UINT_BUFFERS_BINDING) uniform usamplerBuffer MeshPackedDataUintSample[_NBL_VG_UINT_BUFFERS_COUNT];
32
+ uvec3 nbl_glsl_VG_fetchTriangle(in uint baseVertex)
33
+ {
34
+ return texelFetch(MeshPackedDataUintSample[_NBL_VG_UINT_BUFFERS_COUNT- 1u],baseVertex).xyz;
35
+ }
36
+ #endif
26
37
#if _NBL_VG_FLOAT_BUFFERS_COUNT
27
38
layout (set = _NBL_VG_DESCRIPTOR_SET, binding = _NBL_VG_FLOAT_BUFFERS_BINDING) uniform samplerBuffer MeshPackedDataFloatSample[_NBL_VG_FLOAT_BUFFERS_COUNT];
28
39
#endif
29
40
#if _NBL_VG_INT_BUFFERS_COUNT
30
41
layout (set = _NBL_VG_DESCRIPTOR_SET, binding = _NBL_VG_INT_BUFFERS_BINDING) uniform isamplerBuffer MeshPackedDataIntSample[_NBL_VG_INT_BUFFERS_COUNT];
31
42
#endif
32
- #if _NBL_VG_UINT_BUFFERS_COUNT
33
- layout (set = _NBL_VG_DESCRIPTOR_SET, binding = _NBL_VG_UINT_BUFFERS_BINDING) uniform usamplerBuffer MeshPackedDataUintSample[_NBL_VG_UINT_BUFFERS_COUNT];
34
- #endif
43
+
35
44
36
45
#else // _NBL_VG_USE_SSBO
37
46
47
+
38
48
#ifndef _NBL_VG_SSBO_DESCRIPTOR_SET
39
49
#define _NBL_VG_SSBO_DESCRIPTOR_SET 0
40
50
#endif
41
- #ifndef _NBL_VG_USE_SSBO_UVEC4
42
- #ifndef _NBL_VG_SSBO_UVEC4_BINDING
43
- #define _NBL_VG_SSBO_UVEC4_BINDING 0
51
+
52
+ #ifndef _NBL_VG_USE_SSBO_UINT
53
+ #ifndef _NBL_VG_SSBO_UINT_BINDING
54
+ #define _NBL_VG_SSBO_UINT_BINDING 0
55
+ #endif
56
+ #endif
57
+ #ifndef _NBL_VG_USE_SSBO_UVEC2
58
+ #ifndef _NBL_VG_SSBO_UVEC2_BINDING
59
+ #define _NBL_VG_SSBO_UVEC2_BINDING 1
44
60
#endif
45
61
#endif
46
62
#ifndef _NBL_VG_USE_SSBO_UVEC3
47
63
#ifndef _NBL_VG_SSBO_UVEC3_BINDING
48
- #define _NBL_VG_SSBO_UVEC3_BINDING 1
64
+ #define _NBL_VG_SSBO_UVEC3_BINDING 2
49
65
#endif
50
66
#endif
51
- #ifndef _NBL_VG_USE_SSBO_UVEC2
52
- #ifndef _NBL_VG_SSBO_UVEC2_BINDING
53
- #define _NBL_VG_SSBO_UVEC2_BINDING 2
67
+ #ifndef _NBL_VG_USE_SSBO_UVEC4
68
+ #ifndef _NBL_VG_SSBO_UVEC4_BINDING
69
+ #define _NBL_VG_SSBO_UVEC4_BINDING 3
54
70
#endif
55
71
#endif
56
- #ifndef _NBL_VG_USE_SSBO_UINT
57
- #ifndef _NBL_VG_SSBO_UINT_BINDING
58
- #define _NBL_VG_SSBO_UINT_BINDING 3
72
+ #ifndef _NBL_VG_USE_SSBO_INDEX
73
+ #ifndef _NBL_VG_SSBO_INDEX_BINDING
74
+ #define _NBL_VG_SSBO_INDEX_BINDING 4
59
75
#endif
60
76
#endif
61
77
62
- #ifdef _NBL_VG_USE_SSBO_UVEC4
63
- layout (set = _NBL_VG_SSBO_DESCRIPTOR_SET, binding = _NBL_VG_SSBO_UVEC4_BINDING , std430) readonly buffer MeshPackedDataAsUvec4
78
+ #ifdef _NBL_VG_USE_SSBO_UINT
79
+ layout (set = _NBL_VG_SSBO_DESCRIPTOR_SET, binding = _NBL_VG_SSBO_UINT_BINDING , std430) readonly buffer MeshPackedDataAsUint
64
80
{
65
- uvec4 attribData[];
66
- } meshPackedDataUvec4Buffer;
81
+ uint attribData[];
82
+ } meshPackedDataUintBuffer;
83
+ #endif
84
+ #ifdef _NBL_VG_USE_SSBO_UVEC2
85
+ layout (set = _NBL_VG_SSBO_DESCRIPTOR_SET, binding = _NBL_VG_SSBO_UVEC2_BINDING, std430) readonly buffer MeshPackedDataAsUvec2
86
+ {
87
+ uvec2 attribData[];
88
+ } meshPackedDataUvec2Buffer;
67
89
#endif
68
90
#ifdef _NBL_VG_USE_SSBO_UVEC3
69
91
struct Packed_uvec3_t
70
92
{
71
- uint x,y, z;
93
+ uint x, y, z;
72
94
};
73
95
layout (set = _NBL_VG_SSBO_DESCRIPTOR_SET, binding = _NBL_VG_SSBO_UVEC3_BINDING, std430) readonly buffer MeshPackedDataAsUvec3
74
96
{
75
97
Packed_uvec3_t attribData[];
76
98
} meshPackedDataUvec3Buffer;
77
99
#endif
78
- #ifdef _NBL_VG_USE_SSBO_UVEC2
79
- layout (set = _NBL_VG_SSBO_DESCRIPTOR_SET, binding = _NBL_VG_SSBO_UVEC2_BINDING , std430) readonly buffer MeshPackedDataAsUvec2
100
+ #ifdef _NBL_VG_USE_SSBO_UVEC4
101
+ layout (set = _NBL_VG_SSBO_DESCRIPTOR_SET, binding = _NBL_VG_SSBO_UVEC4_BINDING , std430) readonly buffer MeshPackedDataAsUvec4
80
102
{
81
- uvec2 attribData[];
82
- } meshPackedDataUvec2Buffer ;
103
+ uvec4 attribData[];
104
+ } meshPackedDataUvec4Buffer ;
83
105
#endif
84
- #ifdef _NBL_VG_USE_SSBO_UINT
85
- layout (set = _NBL_VG_SSBO_DESCRIPTOR_SET, binding = _NBL_VG_SSBO_UINT_BINDING , std430) readonly buffer MeshPackedDataAsUint
106
+ #ifdef _NBL_VG_USE_SSBO_INDEX
107
+ layout (set = _NBL_VG_SSBO_DESCRIPTOR_SET, binding = _NBL_VG_SSBO_INDEX_BINDING , std430) readonly buffer TrianglePackedData
86
108
{
87
- uint attribData[];
88
- } meshPackedDataUintBuffer;
109
+ u16vec3 indices[];
110
+ } trianglePackedData;
111
+ uvec3 nbl_glsl_VG_fetchTriangle(in uint baseTriangle)
112
+ {
113
+ return uvec3 (trianglePackedData.indices[baseTriangle]);
114
+ }
89
115
#endif
90
116
117
+
91
118
#endif // _NBL_VG_USE_SSBO
92
119
120
+
121
+
93
122
#endif // _NBL_BUILTIN_GLSL_VIRTUAL_GEOMETRY_DESCRIPTORS_INCLUDED_
0 commit comments