Skip to content

Commit 364b169

Browse files
authored
Merge branch 'master' into EndStreamPrimitive
2 parents 1b01aaa + bd6e3fb commit 364b169

12 files changed

+334
-21
lines changed

LICENSE.txt

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ GPL 3 with special bison exception
337337
================================================================================
338338
--------------------------------------------------------------------------------
339339

340-
The preprocessor has the core licenses stated above, plus an additional licence:
340+
The preprocessor has the core licenses stated above, plus additional licences:
341341

342342
/****************************************************************************\
343343
Copyright (c) 2002, NVIDIA Corporation.
@@ -382,3 +382,29 @@ NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
382382
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
383383
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
384384
\****************************************************************************/
385+
386+
/*
387+
** Copyright (c) 2014-2016 The Khronos Group Inc.
388+
**
389+
** Permission is hereby granted, free of charge, to any person obtaining a copy
390+
** of this software and/or associated documentation files (the "Materials"),
391+
** to deal in the Materials without restriction, including without limitation
392+
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
393+
** and/or sell copies of the Materials, and to permit persons to whom the
394+
** Materials are furnished to do so, subject to the following conditions:
395+
**
396+
** The above copyright notice and this permission notice shall be included in
397+
** all copies or substantial portions of the Materials.
398+
**
399+
** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
400+
** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
401+
** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
402+
**
403+
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
404+
** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
405+
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
406+
** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
407+
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
408+
** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
409+
** IN THE MATERIALS.
410+
*/

SPIRV/SpvBuilder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,11 @@ Id Builder::makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& opera
433433
Instruction* type;
434434
for (int t = 0; t < (int)groupedTypes[opcode].size(); ++t) {
435435
type = groupedTypes[opcode][t];
436-
if (type->getNumOperands() != operands.size())
436+
if (static_cast<size_t>(type->getNumOperands()) != operands.size())
437437
continue; // Number mismatch, find next
438438

439439
bool match = true;
440-
for (int op = 0; match && op < operands.size(); ++op) {
440+
for (size_t op = 0; match && op < operands.size(); ++op) {
441441
match = (operands[op].isId ? type->getIdOperand(op) : type->getImmediateOperand(op)) == operands[op].word;
442442
}
443443
if (match)
@@ -446,7 +446,7 @@ Id Builder::makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& opera
446446

447447
// not found, make it
448448
type = new Instruction(getUniqueId(), NoType, opcode);
449-
for (int op = 0; op < operands.size(); ++op) {
449+
for (size_t op = 0; op < operands.size(); ++op) {
450450
if (operands[op].isId)
451451
type->addIdOperand(operands[op].word);
452452
else

Test/baseResults/150.frag.out

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ ERROR: 0:53: 'double' : Reserved word.
88
ERROR: 0:53: 'double' : not supported for this version or the enabled extensions
99
ERROR: 0:53: 'double' : must be qualified as flat in
1010
ERROR: 0:57: '=' : cannot convert from ' global double' to ' global int'
11-
ERROR: 0:80: 'floatBitsToInt' : required extension not requested: GL_ARB_shader_bit_encoding
11+
ERROR: 0:80: 'floatBitsToInt' : required extension not requested: Possible extensions include:
12+
GL_ARB_shader_bit_encoding
13+
GL_ARB_gpu_shader5
1214
ERROR: 0:100: 'packSnorm2x16' : required extension not requested: GL_ARB_shading_language_packing
1315
ERROR: 0:114: 'textureQueryLOD' : required extension not requested: GL_ARB_texture_query_lod
1416
ERROR: 0:115: 'textureQueryLOD' : required extension not requested: GL_ARB_texture_query_lod
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
floatBitsToInt.vert
2+
WARNING: 0:2: '#extension' : extension is only partially supported: GL_ARB_gpu_shader5
3+
4+
Shader version: 150
5+
Requested GL_ARB_gpu_shader5
6+
0:? Sequence
7+
0:6 Function Definition: main( ( global void)
8+
0:6 Function Parameters:
9+
0:8 Sequence
10+
0:8 move second child to first child ( temp 4-component vector of float)
11+
0:8 'result' ( smooth out 4-component vector of float)
12+
0:8 Constant:
13+
0:8 1.000000
14+
0:8 1.000000
15+
0:8 1.000000
16+
0:8 1.000000
17+
0:9 Sequence
18+
0:9 move second child to first child ( temp int)
19+
0:9 'ret_val' ( temp int)
20+
0:9 floatBitsToInt ( global int)
21+
0:9 'value' ( uniform float)
22+
0:10 Test condition and select ( temp void)
23+
0:10 Condition
24+
0:10 Compare Not Equal ( temp bool)
25+
0:10 'expected_value' ( uniform int)
26+
0:10 'ret_val' ( temp int)
27+
0:10 true case
28+
0:10 Sequence
29+
0:10 move second child to first child ( temp 4-component vector of float)
30+
0:10 'result' ( smooth out 4-component vector of float)
31+
0:10 Constant:
32+
0:10 0.000000
33+
0:10 0.000000
34+
0:10 0.000000
35+
0:10 0.000000
36+
0:12 switch
37+
0:12 condition
38+
0:12 'gl_VertexID' ( gl_VertexId int VertexId)
39+
0:12 body
40+
0:12 Sequence
41+
0:13 case: with expression
42+
0:13 Constant:
43+
0:13 0 (const int)
44+
0:? Sequence
45+
0:13 move second child to first child ( temp 4-component vector of float)
46+
0:13 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position)
47+
0:13 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance})
48+
0:13 Constant:
49+
0:13 0 (const uint)
50+
0:13 Constant:
51+
0:13 -1.000000
52+
0:13 1.000000
53+
0:13 0.000000
54+
0:13 1.000000
55+
0:13 Branch: Break
56+
0:14 case: with expression
57+
0:14 Constant:
58+
0:14 1 (const int)
59+
0:? Sequence
60+
0:14 move second child to first child ( temp 4-component vector of float)
61+
0:14 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position)
62+
0:14 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance})
63+
0:14 Constant:
64+
0:14 0 (const uint)
65+
0:14 Constant:
66+
0:14 1.000000
67+
0:14 1.000000
68+
0:14 0.000000
69+
0:14 1.000000
70+
0:14 Branch: Break
71+
0:15 case: with expression
72+
0:15 Constant:
73+
0:15 2 (const int)
74+
0:? Sequence
75+
0:15 move second child to first child ( temp 4-component vector of float)
76+
0:15 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position)
77+
0:15 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance})
78+
0:15 Constant:
79+
0:15 0 (const uint)
80+
0:15 Constant:
81+
0:15 -1.000000
82+
0:15 -1.000000
83+
0:15 0.000000
84+
0:15 1.000000
85+
0:15 Branch: Break
86+
0:16 case: with expression
87+
0:16 Constant:
88+
0:16 3 (const int)
89+
0:? Sequence
90+
0:16 move second child to first child ( temp 4-component vector of float)
91+
0:16 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position)
92+
0:16 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance})
93+
0:16 Constant:
94+
0:16 0 (const uint)
95+
0:16 Constant:
96+
0:16 1.000000
97+
0:16 -1.000000
98+
0:16 0.000000
99+
0:16 1.000000
100+
0:16 Branch: Break
101+
0:? Linker Objects
102+
0:? 'expected_value' ( uniform int)
103+
0:? 'value' ( uniform float)
104+
0:? 'result' ( smooth out 4-component vector of float)
105+
0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance})
106+
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
107+
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
108+
109+
110+
Linked vertex stage:
111+
112+
113+
Shader version: 150
114+
Requested GL_ARB_gpu_shader5
115+
0:? Sequence
116+
0:6 Function Definition: main( ( global void)
117+
0:6 Function Parameters:
118+
0:8 Sequence
119+
0:8 move second child to first child ( temp 4-component vector of float)
120+
0:8 'result' ( smooth out 4-component vector of float)
121+
0:8 Constant:
122+
0:8 1.000000
123+
0:8 1.000000
124+
0:8 1.000000
125+
0:8 1.000000
126+
0:9 Sequence
127+
0:9 move second child to first child ( temp int)
128+
0:9 'ret_val' ( temp int)
129+
0:9 floatBitsToInt ( global int)
130+
0:9 'value' ( uniform float)
131+
0:10 Test condition and select ( temp void)
132+
0:10 Condition
133+
0:10 Compare Not Equal ( temp bool)
134+
0:10 'expected_value' ( uniform int)
135+
0:10 'ret_val' ( temp int)
136+
0:10 true case
137+
0:10 Sequence
138+
0:10 move second child to first child ( temp 4-component vector of float)
139+
0:10 'result' ( smooth out 4-component vector of float)
140+
0:10 Constant:
141+
0:10 0.000000
142+
0:10 0.000000
143+
0:10 0.000000
144+
0:10 0.000000
145+
0:12 switch
146+
0:12 condition
147+
0:12 'gl_VertexID' ( gl_VertexId int VertexId)
148+
0:12 body
149+
0:12 Sequence
150+
0:13 case: with expression
151+
0:13 Constant:
152+
0:13 0 (const int)
153+
0:? Sequence
154+
0:13 move second child to first child ( temp 4-component vector of float)
155+
0:13 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position)
156+
0:13 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance})
157+
0:13 Constant:
158+
0:13 0 (const uint)
159+
0:13 Constant:
160+
0:13 -1.000000
161+
0:13 1.000000
162+
0:13 0.000000
163+
0:13 1.000000
164+
0:13 Branch: Break
165+
0:14 case: with expression
166+
0:14 Constant:
167+
0:14 1 (const int)
168+
0:? Sequence
169+
0:14 move second child to first child ( temp 4-component vector of float)
170+
0:14 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position)
171+
0:14 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance})
172+
0:14 Constant:
173+
0:14 0 (const uint)
174+
0:14 Constant:
175+
0:14 1.000000
176+
0:14 1.000000
177+
0:14 0.000000
178+
0:14 1.000000
179+
0:14 Branch: Break
180+
0:15 case: with expression
181+
0:15 Constant:
182+
0:15 2 (const int)
183+
0:? Sequence
184+
0:15 move second child to first child ( temp 4-component vector of float)
185+
0:15 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position)
186+
0:15 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance})
187+
0:15 Constant:
188+
0:15 0 (const uint)
189+
0:15 Constant:
190+
0:15 -1.000000
191+
0:15 -1.000000
192+
0:15 0.000000
193+
0:15 1.000000
194+
0:15 Branch: Break
195+
0:16 case: with expression
196+
0:16 Constant:
197+
0:16 3 (const int)
198+
0:? Sequence
199+
0:16 move second child to first child ( temp 4-component vector of float)
200+
0:16 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position)
201+
0:16 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance})
202+
0:16 Constant:
203+
0:16 0 (const uint)
204+
0:16 Constant:
205+
0:16 1.000000
206+
0:16 -1.000000
207+
0:16 0.000000
208+
0:16 1.000000
209+
0:16 Branch: Break
210+
0:? Linker Objects
211+
0:? 'expected_value' ( uniform int)
212+
0:? 'value' ( uniform float)
213+
0:? 'result' ( smooth out 4-component vector of float)
214+
0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance})
215+
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
216+
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
217+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
xfbUnsizedArray.error.tese
2+
ERROR: 0:4: 'xfb_offset' : unsized array in buffer 0
3+
ERROR: 1 compilation errors. No code generated.
4+
5+
6+
Shader version: 430
7+
Requested GL_ARB_enhanced_layouts
8+
in xfb mode
9+
input primitive = isolines
10+
vertex spacing = none
11+
triangle order = none
12+
using point mode
13+
ERROR: node is still EOpNull!
14+
0:6 Function Definition: main( ( global void)
15+
0:6 Function Parameters:
16+
0:? Linker Objects
17+
0:? 'unsized' (layout( xfb_buffer=0 xfb_offset=0) out unsized 1-element array of 4-component vector of float)
18+
19+
20+
Linked tessellation evaluation stage:
21+
22+
23+
Shader version: 430
24+
Requested GL_ARB_enhanced_layouts
25+
in xfb mode
26+
input primitive = isolines
27+
vertex spacing = equal_spacing
28+
triangle order = ccw
29+
using point mode
30+
ERROR: node is still EOpNull!
31+
0:6 Function Definition: main( ( global void)
32+
0:6 Function Parameters:
33+
0:? Linker Objects
34+
0:? 'unsized' (layout( xfb_buffer=0 xfb_offset=0) out 1-element array of 4-component vector of float)
35+

Test/floatBitsToInt.vert

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#version 150
2+
#extension GL_ARB_gpu_shader5 : require
3+
uniform int expected_value;
4+
uniform float value;
5+
out vec4 result;
6+
void main()
7+
{
8+
result = vec4(1.0, 1.0, 1.0, 1.0);
9+
int ret_val = floatBitsToInt(value);
10+
if (expected_value != ret_val){ result = vec4(0.0, 0.0, 0.0, 0.0); }
11+
12+
switch (gl_VertexID) {
13+
case 0: gl_Position = vec4(-1.0, 1.0, 0.0, 1.0); break;
14+
case 1: gl_Position = vec4( 1.0, 1.0, 0.0, 1.0); break;
15+
case 2: gl_Position = vec4(-1.0,-1.0, 0.0, 1.0); break;
16+
case 3: gl_Position = vec4( 1.0,-1.0, 0.0, 1.0); break;
17+
}
18+
}

Test/xfbUnsizedArray.error.tese

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#version 430 core
2+
#extension GL_ARB_enhanced_layouts : require
3+
layout(isolines, point_mode) in;
4+
layout (xfb_offset = 0) out vec4 unsized[]; // error: unsized array
5+
6+
void main()
7+
{
8+
}

glslang/MachineIndependent/Initialize.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8353,10 +8353,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
83538353
}
83548354

83558355
if (profile != EEsProfile && version < 330 ) {
8356-
symbolTable.setFunctionExtensions("floatBitsToInt", 1, &E_GL_ARB_shader_bit_encoding);
8357-
symbolTable.setFunctionExtensions("floatBitsToUint", 1, &E_GL_ARB_shader_bit_encoding);
8358-
symbolTable.setFunctionExtensions("intBitsToFloat", 1, &E_GL_ARB_shader_bit_encoding);
8359-
symbolTable.setFunctionExtensions("uintBitsToFloat", 1, &E_GL_ARB_shader_bit_encoding);
8356+
const char* bitsConvertExt[2] = {E_GL_ARB_shader_bit_encoding, E_GL_ARB_gpu_shader5};
8357+
symbolTable.setFunctionExtensions("floatBitsToInt", 2, bitsConvertExt);
8358+
symbolTable.setFunctionExtensions("floatBitsToUint", 2, bitsConvertExt);
8359+
symbolTable.setFunctionExtensions("intBitsToFloat", 2, bitsConvertExt);
8360+
symbolTable.setFunctionExtensions("uintBitsToFloat", 2, bitsConvertExt);
83608361
}
83618362

83628363
if (profile != EEsProfile && version < 430 ) {

glslang/MachineIndependent/ParseHelper.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6212,11 +6212,13 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
62126212

62136213
#ifndef GLSLANG_WEB
62146214
if (qualifier.hasXfbOffset() && qualifier.hasXfbBuffer()) {
6215-
int repeated = intermediate.addXfbBufferOffset(type);
6216-
if (repeated >= 0)
6217-
error(loc, "overlapping offsets at", "xfb_offset", "offset %d in buffer %d", repeated, qualifier.layoutXfbBuffer);
6218-
if (type.isUnsizedArray())
6215+
if (type.isUnsizedArray()) {
62196216
error(loc, "unsized array", "xfb_offset", "in buffer %d", qualifier.layoutXfbBuffer);
6217+
} else {
6218+
int repeated = intermediate.addXfbBufferOffset(type);
6219+
if (repeated >= 0)
6220+
error(loc, "overlapping offsets at", "xfb_offset", "offset %d in buffer %d", repeated, qualifier.layoutXfbBuffer);
6221+
}
62206222

62216223
// "The offset must be a multiple of the size of the first component of the first
62226224
// qualified variable or block member, or a compile-time error results. Further, if applied to an aggregate

glslang/MachineIndependent/linkValidate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
18021802
return size;
18031803
}
18041804

1805-
int numComponents;
1805+
int numComponents {0};
18061806
if (type.isScalar())
18071807
numComponents = 1;
18081808
else if (type.isVector())

0 commit comments

Comments
 (0)