Skip to content

Commit 57e2519

Browse files
authored
Merge pull request KhronosGroup#2853 from ZhiqianXia/EndStreamPrimitive
EndStreamPrimitive not supported when there is #extension GL_ARB_gpu_shader5
2 parents b886419 + 364b169 commit 57e2519

File tree

6 files changed

+135
-11
lines changed

6 files changed

+135
-11
lines changed

Test/EndStreamPrimitive.geom

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#version 150 core
2+
#extension GL_ARB_gpu_shader5 : require
3+
layout(points) in;
4+
layout(points, max_vertices = 1) out;
5+
layout(stream=0) out float output1;
6+
layout(stream=0) out float output2;
7+
layout(stream=1) out float output3;
8+
layout(stream=1) out float output4;
9+
uniform uint stream;
10+
void main() {
11+
12+
output1 = 1.0;
13+
output2 = 2.0;
14+
EmitStreamVertex(0);
15+
EndStreamPrimitive(0);
16+
output3 = 3.0;
17+
output4 = 4.0;
18+
EmitStreamVertex(1);
19+
EndStreamPrimitive(1);
20+
}

Test/baseResults/150.geom.out

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
ERROR: 0:15: 'fromVertex' : block instance name redefinition
33
ERROR: 0:19: 'fromVertex' : redefinition
44
ERROR: 0:21: 'fooC' : block instance name redefinition
5-
ERROR: 0:29: 'EmitStreamVertex' : no matching overloaded function found
6-
ERROR: 0:30: 'EndStreamPrimitive' : no matching overloaded function found
5+
ERROR: 0:29: 'if the verison is 150 , the EmitStreamVertex and EndStreamPrimitive only support at extension GL_ARB_gpu_shader5' : required extension not requested: GL_ARB_gpu_shader5
6+
ERROR: 0:30: 'if the verison is 150 , the EmitStreamVertex and EndStreamPrimitive only support at extension GL_ARB_gpu_shader5' : required extension not requested: GL_ARB_gpu_shader5
77
ERROR: 0:44: 'stream' : can only be used on an output
88
ERROR: 0:45: 'stream' : can only be used on an output
99
ERROR: 0:46: 'stream' : can only be used on an output
@@ -49,10 +49,12 @@ ERROR: node is still EOpNull!
4949
0:27 Sequence
5050
0:27 EmitVertex ( global void)
5151
0:28 EndPrimitive ( global void)
52-
0:29 Constant:
53-
0:29 0.000000
54-
0:30 Constant:
55-
0:30 0.000000
52+
0:29 EmitStreamVertex ( global void)
53+
0:29 Constant:
54+
0:29 1 (const int)
55+
0:30 EndStreamPrimitive ( global void)
56+
0:30 Constant:
57+
0:30 0 (const int)
5658
0:32 move second child to first child ( temp 3-component vector of float)
5759
0:32 color: direct index for structure (layout( stream=0) out 3-component vector of float)
5860
0:32 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-component vector of float color})
@@ -190,10 +192,12 @@ ERROR: node is still EOpNull!
190192
0:27 Sequence
191193
0:27 EmitVertex ( global void)
192194
0:28 EndPrimitive ( global void)
193-
0:29 Constant:
194-
0:29 0.000000
195-
0:30 Constant:
196-
0:30 0.000000
195+
0:29 EmitStreamVertex ( global void)
196+
0:29 Constant:
197+
0:29 1 (const int)
198+
0:30 EndStreamPrimitive ( global void)
199+
0:30 Constant:
200+
0:30 0 (const int)
197201
0:32 move second child to first child ( temp 3-component vector of float)
198202
0:32 color: direct index for structure (layout( stream=0) out 3-component vector of float)
199203
0:32 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-component vector of float color})
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
EndStreamPrimitive.geom
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+
invocations = -1
7+
max_vertices = 1
8+
input primitive = points
9+
output primitive = points
10+
0:? Sequence
11+
0:10 Function Definition: main( ( global void)
12+
0:10 Function Parameters:
13+
0:12 Sequence
14+
0:12 move second child to first child ( temp float)
15+
0:12 'output1' (layout( stream=0) out float)
16+
0:12 Constant:
17+
0:12 1.000000
18+
0:13 move second child to first child ( temp float)
19+
0:13 'output2' (layout( stream=0) out float)
20+
0:13 Constant:
21+
0:13 2.000000
22+
0:14 EmitStreamVertex ( global void)
23+
0:14 Constant:
24+
0:14 0 (const int)
25+
0:15 EndStreamPrimitive ( global void)
26+
0:15 Constant:
27+
0:15 0 (const int)
28+
0:16 move second child to first child ( temp float)
29+
0:16 'output3' (layout( stream=1) out float)
30+
0:16 Constant:
31+
0:16 3.000000
32+
0:17 move second child to first child ( temp float)
33+
0:17 'output4' (layout( stream=1) out float)
34+
0:17 Constant:
35+
0:17 4.000000
36+
0:18 EmitStreamVertex ( global void)
37+
0:18 Constant:
38+
0:18 1 (const int)
39+
0:19 EndStreamPrimitive ( global void)
40+
0:19 Constant:
41+
0:19 1 (const int)
42+
0:? Linker Objects
43+
0:? 'output1' (layout( stream=0) out float)
44+
0:? 'output2' (layout( stream=0) out float)
45+
0:? 'output3' (layout( stream=1) out float)
46+
0:? 'output4' (layout( stream=1) out float)
47+
0:? 'stream' ( uniform uint)
48+
49+
50+
Linked geometry stage:
51+
52+
53+
Shader version: 150
54+
Requested GL_ARB_gpu_shader5
55+
invocations = 1
56+
max_vertices = 1
57+
input primitive = points
58+
output primitive = points
59+
0:? Sequence
60+
0:10 Function Definition: main( ( global void)
61+
0:10 Function Parameters:
62+
0:12 Sequence
63+
0:12 move second child to first child ( temp float)
64+
0:12 'output1' (layout( stream=0) out float)
65+
0:12 Constant:
66+
0:12 1.000000
67+
0:13 move second child to first child ( temp float)
68+
0:13 'output2' (layout( stream=0) out float)
69+
0:13 Constant:
70+
0:13 2.000000
71+
0:14 EmitStreamVertex ( global void)
72+
0:14 Constant:
73+
0:14 0 (const int)
74+
0:15 EndStreamPrimitive ( global void)
75+
0:15 Constant:
76+
0:15 0 (const int)
77+
0:16 move second child to first child ( temp float)
78+
0:16 'output3' (layout( stream=1) out float)
79+
0:16 Constant:
80+
0:16 3.000000
81+
0:17 move second child to first child ( temp float)
82+
0:17 'output4' (layout( stream=1) out float)
83+
0:17 Constant:
84+
0:17 4.000000
85+
0:18 EmitStreamVertex ( global void)
86+
0:18 Constant:
87+
0:18 1 (const int)
88+
0:19 EndStreamPrimitive ( global void)
89+
0:19 Constant:
90+
0:19 1 (const int)
91+
0:? Linker Objects
92+
0:? 'output1' (layout( stream=0) out float)
93+
0:? 'output2' (layout( stream=0) out float)
94+
0:? 'output3' (layout( stream=1) out float)
95+
0:? 'output4' (layout( stream=1) out float)
96+
0:? 'stream' ( uniform uint)
97+

glslang/MachineIndependent/Initialize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4270,7 +4270,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
42704270
//
42714271
//============================================================================
42724272

4273-
if (profile != EEsProfile && version >= 400) {
4273+
if (profile != EEsProfile && (version >= 400 || version == 150)) {
42744274
stageBuiltins[EShLangGeometry].append(
42754275
"void EmitStreamVertex(int);"
42764276
"void EndStreamPrimitive(int);"

glslang/MachineIndependent/ParseHelper.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,6 +2495,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
24952495

24962496
case EOpEmitStreamVertex:
24972497
case EOpEndStreamPrimitive:
2498+
if (version == 150)
2499+
requireExtensions(loc, 1, &E_GL_ARB_gpu_shader5, "if the verison is 150 , the EmitStreamVertex and EndStreamPrimitive only support at extension GL_ARB_gpu_shader5");
24982500
intermediate.setMultiStream();
24992501
break;
25002502

gtests/AST.FromFile.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ INSTANTIATE_TEST_SUITE_P(
292292
"GL_ARB_draw_instanced.vert",
293293
"GL_ARB_fragment_coord_conventions.vert",
294294
"BestMatchFunction.vert",
295+
"EndStreamPrimitive.geom",
295296
"floatBitsToInt.vert",
296297
})),
297298
FileNameAsCustomTestSuffix

0 commit comments

Comments
 (0)