Skip to content

Commit

Permalink
EndStreamPrimitive not supported when there is #extension GL_ARB_gpu_…
Browse files Browse the repository at this point in the history
…shader5

Signed-off-by: ZhiqianXia <[email protected]>
  • Loading branch information
ZhiqianXia committed Jan 4, 2022
1 parent df609a0 commit 1b01aaa
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 11 deletions.
20 changes: 20 additions & 0 deletions Test/EndStreamPrimitive.geom
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#version 150 core
#extension GL_ARB_gpu_shader5 : require
layout(points) in;
layout(points, max_vertices = 1) out;
layout(stream=0) out float output1;
layout(stream=0) out float output2;
layout(stream=1) out float output3;
layout(stream=1) out float output4;
uniform uint stream;
void main() {

output1 = 1.0;
output2 = 2.0;
EmitStreamVertex(0);
EndStreamPrimitive(0);
output3 = 3.0;
output4 = 4.0;
EmitStreamVertex(1);
EndStreamPrimitive(1);
}
24 changes: 14 additions & 10 deletions Test/baseResults/150.geom.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
ERROR: 0:15: 'fromVertex' : block instance name redefinition
ERROR: 0:19: 'fromVertex' : redefinition
ERROR: 0:21: 'fooC' : block instance name redefinition
ERROR: 0:29: 'EmitStreamVertex' : no matching overloaded function found
ERROR: 0:30: 'EndStreamPrimitive' : no matching overloaded function found
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
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
ERROR: 0:44: 'stream' : can only be used on an output
ERROR: 0:45: 'stream' : can only be used on an output
ERROR: 0:46: 'stream' : can only be used on an output
Expand Down Expand Up @@ -49,10 +49,12 @@ ERROR: node is still EOpNull!
0:27 Sequence
0:27 EmitVertex ( global void)
0:28 EndPrimitive ( global void)
0:29 Constant:
0:29 0.000000
0:30 Constant:
0:30 0.000000
0:29 EmitStreamVertex ( global void)
0:29 Constant:
0:29 1 (const int)
0:30 EndStreamPrimitive ( global void)
0:30 Constant:
0:30 0 (const int)
0:32 move second child to first child ( temp 3-component vector of float)
0:32 color: direct index for structure (layout( stream=0) out 3-component vector of float)
0:32 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-component vector of float color})
Expand Down Expand Up @@ -190,10 +192,12 @@ ERROR: node is still EOpNull!
0:27 Sequence
0:27 EmitVertex ( global void)
0:28 EndPrimitive ( global void)
0:29 Constant:
0:29 0.000000
0:30 Constant:
0:30 0.000000
0:29 EmitStreamVertex ( global void)
0:29 Constant:
0:29 1 (const int)
0:30 EndStreamPrimitive ( global void)
0:30 Constant:
0:30 0 (const int)
0:32 move second child to first child ( temp 3-component vector of float)
0:32 color: direct index for structure (layout( stream=0) out 3-component vector of float)
0:32 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-component vector of float color})
Expand Down
97 changes: 97 additions & 0 deletions Test/baseResults/EndStreamPrimitive.geom.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
EndStreamPrimitive.geom
WARNING: 0:2: '#extension' : extension is only partially supported: GL_ARB_gpu_shader5

Shader version: 150
Requested GL_ARB_gpu_shader5
invocations = -1
max_vertices = 1
input primitive = points
output primitive = points
0:? Sequence
0:10 Function Definition: main( ( global void)
0:10 Function Parameters:
0:12 Sequence
0:12 move second child to first child ( temp float)
0:12 'output1' (layout( stream=0) out float)
0:12 Constant:
0:12 1.000000
0:13 move second child to first child ( temp float)
0:13 'output2' (layout( stream=0) out float)
0:13 Constant:
0:13 2.000000
0:14 EmitStreamVertex ( global void)
0:14 Constant:
0:14 0 (const int)
0:15 EndStreamPrimitive ( global void)
0:15 Constant:
0:15 0 (const int)
0:16 move second child to first child ( temp float)
0:16 'output3' (layout( stream=1) out float)
0:16 Constant:
0:16 3.000000
0:17 move second child to first child ( temp float)
0:17 'output4' (layout( stream=1) out float)
0:17 Constant:
0:17 4.000000
0:18 EmitStreamVertex ( global void)
0:18 Constant:
0:18 1 (const int)
0:19 EndStreamPrimitive ( global void)
0:19 Constant:
0:19 1 (const int)
0:? Linker Objects
0:? 'output1' (layout( stream=0) out float)
0:? 'output2' (layout( stream=0) out float)
0:? 'output3' (layout( stream=1) out float)
0:? 'output4' (layout( stream=1) out float)
0:? 'stream' ( uniform uint)


Linked geometry stage:


Shader version: 150
Requested GL_ARB_gpu_shader5
invocations = 1
max_vertices = 1
input primitive = points
output primitive = points
0:? Sequence
0:10 Function Definition: main( ( global void)
0:10 Function Parameters:
0:12 Sequence
0:12 move second child to first child ( temp float)
0:12 'output1' (layout( stream=0) out float)
0:12 Constant:
0:12 1.000000
0:13 move second child to first child ( temp float)
0:13 'output2' (layout( stream=0) out float)
0:13 Constant:
0:13 2.000000
0:14 EmitStreamVertex ( global void)
0:14 Constant:
0:14 0 (const int)
0:15 EndStreamPrimitive ( global void)
0:15 Constant:
0:15 0 (const int)
0:16 move second child to first child ( temp float)
0:16 'output3' (layout( stream=1) out float)
0:16 Constant:
0:16 3.000000
0:17 move second child to first child ( temp float)
0:17 'output4' (layout( stream=1) out float)
0:17 Constant:
0:17 4.000000
0:18 EmitStreamVertex ( global void)
0:18 Constant:
0:18 1 (const int)
0:19 EndStreamPrimitive ( global void)
0:19 Constant:
0:19 1 (const int)
0:? Linker Objects
0:? 'output1' (layout( stream=0) out float)
0:? 'output2' (layout( stream=0) out float)
0:? 'output3' (layout( stream=1) out float)
0:? 'output4' (layout( stream=1) out float)
0:? 'stream' ( uniform uint)

2 changes: 1 addition & 1 deletion glslang/MachineIndependent/Initialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4270,7 +4270,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
//
//============================================================================

if (profile != EEsProfile && version >= 400) {
if (profile != EEsProfile && (version >= 400 || version == 150)) {
stageBuiltins[EShLangGeometry].append(
"void EmitStreamVertex(int);"
"void EndStreamPrimitive(int);"
Expand Down
2 changes: 2 additions & 0 deletions glslang/MachineIndependent/ParseHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2495,6 +2495,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan

case EOpEmitStreamVertex:
case EOpEndStreamPrimitive:
if (version == 150)
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");
intermediate.setMultiStream();
break;

Expand Down
1 change: 1 addition & 0 deletions gtests/AST.FromFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ INSTANTIATE_TEST_SUITE_P(
"GL_ARB_draw_instanced.vert",
"GL_ARB_fragment_coord_conventions.vert",
"BestMatchFunction.vert",
"EndStreamPrimitive.geom"
})),
FileNameAsCustomTestSuffix
);
Expand Down

0 comments on commit 1b01aaa

Please sign in to comment.