-
Notifications
You must be signed in to change notification settings - Fork 100
/
GL_EXT_scalar_block_layout.txt
151 lines (103 loc) · 5.2 KB
/
GL_EXT_scalar_block_layout.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
Name
EXT_scalar_block_layout
Name Strings
GL_EXT_scalar_block_layout
Contact
Tobias Hector (tobias.hector 'at' amd.com), AMD
Contributors
Jeff Bolz
Notice
Copyright (c) 2018 AMD, Inc.
Status
Draft.
Version
Last Modified Date: 03-Oct-2018
Revision: 4
Number
TBD
Dependencies
Written against SPIR-V 1.3.
Written against GLSL 4.6.
Written against Vulkan 1.1 with the VK_EXT_scalar_block_layout
extension.
This extension can be applied to OpenGL GLSL versions 1.40
(#version 140) and higher.
This extension can be applied to OpenGL ES ESSL versions 3.00
(#version 300) and higher.
This extension requires the GL_KHR_vulkan_glsl extension.
Overview
Adds a new block layout (scalar) for uniform, push constant, and storage
buffer blocks.
This new layout aligns values only to the scalar components of the block
and its composite members.
Additionally, this extension now allows uniform blocks to be decorated
with the std430 layout.
Add to Chapter 3 of the OpenGL Shading Language Specification
Including the following line in a shader will control the language
features described in this extension:
#extension GL_EXT_scalar_block_layout : <behavior>
Where <behavior> is as specified in section 3.3.
This new definition is added to the OpenGL Shading Language:
#define GL_EXT_scalar_block_layout 1
Add to Chapter 4 of the OpenGL Shading Language Specification
Modify the table at the end of the introduction to section "4.4 - Layout
Qualifiers" to add "scalar" to the list of layout qualifiers in the
first cell in the first row (containing shared/packed/std140/std430).
Modify section "4.4.5 - Uniform and Storage Block Qualifiers"
Add "scalar" to the list defining layout-qualifier-id.
Add "scalar" to the list of qualifiers overridden by the "std140"
and "std140" layout qualifiers.
Remove the sentence "The std430 qualifier is supported only for
shader storage blocks; a shader using the std430 qualifier on a
uniform block will fail to compile."
Add the following paragraph immediately after the paragraph starting
with "The std140 and std430 qualifiers override only...":
The _scalar_ qualifier overrides only the scalar, std140, and
std430 qualifiers; other qualifiers are inherited.
When the _scalar_ layout is used, a block will be laid out with
its members stored in monotonically increasing order based on
their location in the declaration.
Such a structure and each structure member have a base offset
and a base alignment, from which an aligned offset is computed
by rounding the base offset up to a multiple of the base
alignment.
The base offset of the first member of a structure is taken from
the aligned offset of the structure itself.
The base offset of all other structure members is derived by
taking the offset of the last basic machine unit consumed by the
previous member and adding one.
Each structure member is accessed in memory at its aligned
offset.
The members of a toplevel uniform or buffer block are laid out
by treating the block as a structure with a base offset of zero.
1. If the member is a scalar consuming N basic machine units, the base
alignment is N.
2. If the member is a vector, the base alignment is equal to that of its
components.
3. If the member is a matrix, the base alignment is equal to that of its
components.
4. If the member is an array, the base alignment is equal to that of its
elements.
5. If the member is a structure, the base alignment of the structure is
N, where N is the largest base alignment value of any of its members.
The individual members of this substructure are then assigned offsets
by applying this set of rules recursively, where the base offset of
the first member of the sub-structure is equal to the aligned offset
of the structure.
This matches the alignment and offset rules of the "Offset and
Stride Assignment" section of the interfaces chapter in the
Vulkan specification when VK_EXT_scalar_block_layout is
enabled.
Add "scalar" to the list of qualifiers that can only be declared at
global scope or on a block decoration.
Replace "std140 or std430" with "std140, std430, or scalar" in the
paragraphs discussing the _align_ and _offset_ qualifiers.
Issues
None
Revision History
Rev. Date Author Changes
---- ----------- ------- ----------------------------------------------
1 18-Sep-2018 TobiasH initial draft
2 18-Sep-2018 TobiasH added more explicit definition of _scalar_
3 03-Oct-2018 TobiasH Renamed to GL_EXT_scalar_block_layout
4 03-Oct-2018 TobiasH Allow std430 on uniform blocks, and fix typos