Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
934d11b6
Commit
934d11b6
authored
Jul 23, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GLSL 4.6: Implement shader group vote.
parent
941f3bbd
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
142 additions
and
10 deletions
+142
-10
450.vert
Test/450.vert
+5
-0
460.frag
Test/460.frag
+4
-0
460.vert
Test/460.vert
+4
-0
450.vert.out
Test/baseResults/450.vert.out
+11
-2
460.frag.out
Test/baseResults/460.frag.out
+24
-0
460.vert.out
Test/baseResults/460.vert.out
+26
-0
spv.460.comp.out
Test/baseResults/spv.460.comp.out
+33
-0
spv.460.comp
Test/spv.460.comp
+9
-0
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+25
-8
Spv.FromFile.cpp
gtests/Spv.FromFile.cpp
+1
-0
No files found.
Test/450.vert
View file @
934d11b6
...
@@ -39,5 +39,10 @@ void foo()
...
@@ -39,5 +39,10 @@ void foo()
atomicCounterCompSwap
(
aui
,
ui
,
ui
);
// ERROR, need 4.6
atomicCounterCompSwap
(
aui
,
ui
,
ui
);
// ERROR, need 4.6
int
a
=
gl_BaseVertex
+
gl_BaseInstance
+
gl_DrawID
;
// ERROR, need 4.6
int
a
=
gl_BaseVertex
+
gl_BaseInstance
+
gl_DrawID
;
// ERROR, need 4.6
bool
b1
;
anyInvocation
(
b1
);
// ERROR, need 4.6
allInvocations
(
b1
);
// ERROR, need 4.6
allInvocationsEqual
(
b1
);
// ERROR, need 4.6
}
}
;
// ERROR: no extraneous semicolons
;
// ERROR: no extraneous semicolons
Test/460.frag
View file @
934d11b6
...
@@ -10,4 +10,8 @@ in S s;
...
@@ -10,4 +10,8 @@ in S s;
void
main
()
void
main
()
{
{
interpolateAtCentroid
(
s
.
v
);
interpolateAtCentroid
(
s
.
v
);
bool
b1
;
b1
=
anyInvocation
(
b1
);
b1
=
allInvocations
(
b1
);
b1
=
allInvocationsEqual
(
b1
);
}
}
Test/460.vert
View file @
934d11b6
...
@@ -6,6 +6,10 @@ float f;;;
...
@@ -6,6 +6,10 @@ float f;;;
void
main
()
void
main
()
{
{
bool
b1
;
b1
=
anyInvocation
(
b1
);
b1
=
allInvocations
(
b1
);
b1
=
allInvocationsEqual
(
b1
);
}
}
;
;
;
;
Test/baseResults/450.vert.out
View file @
934d11b6
...
@@ -15,8 +15,11 @@ ERROR: 0:41: 'gl_BaseVertex' : undeclared identifier
...
@@ -15,8 +15,11 @@ ERROR: 0:41: 'gl_BaseVertex' : undeclared identifier
ERROR: 0:41: 'gl_BaseInstance' : undeclared identifier
ERROR: 0:41: 'gl_BaseInstance' : undeclared identifier
ERROR: 0:41: 'gl_DrawID' : undeclared identifier
ERROR: 0:41: 'gl_DrawID' : undeclared identifier
ERROR: 0:41: '=' : cannot convert from ' temp float' to ' temp int'
ERROR: 0:41: '=' : cannot convert from ' temp float' to ' temp int'
ERROR: 0:43: 'extraneous semicolon' : not supported for this version or the enabled extensions
ERROR: 0:44: 'anyInvocation' : no matching overloaded function found
ERROR: 17 compilation errors. No code generated.
ERROR: 0:45: 'allInvocations' : no matching overloaded function found
ERROR: 0:46: 'allInvocationsEqual' : no matching overloaded function found
ERROR: 0:48: 'extraneous semicolon' : not supported for this version or the enabled extensions
ERROR: 20 compilation errors. No code generated.
Shader version: 450
Shader version: 450
...
@@ -55,6 +58,12 @@ ERROR: node is still EOpNull!
...
@@ -55,6 +58,12 @@ ERROR: node is still EOpNull!
0:38 0.000000
0:38 0.000000
0:39 Constant:
0:39 Constant:
0:39 0.000000
0:39 0.000000
0:44 Constant:
0:44 0.000000
0:45 Constant:
0:45 0.000000
0:46 Constant:
0:46 0.000000
0:? Linker Objects
0:? Linker Objects
0:? 'anon@0' ( out block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' ( out block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'outb' ( smooth out bool)
0:? 'outb' ( smooth out bool)
...
...
Test/baseResults/460.frag.out
View file @
934d11b6
...
@@ -9,6 +9,18 @@ Shader version: 460
...
@@ -9,6 +9,18 @@ Shader version: 460
0:12 's' ( smooth in structure{ global float f, global 4-component vector of float v})
0:12 's' ( smooth in structure{ global float f, global 4-component vector of float v})
0:12 Constant:
0:12 Constant:
0:12 1 (const int)
0:12 1 (const int)
0:14 move second child to first child ( temp bool)
0:14 'b1' ( temp bool)
0:14 anyInvocation ( global bool)
0:14 'b1' ( temp bool)
0:15 move second child to first child ( temp bool)
0:15 'b1' ( temp bool)
0:15 allInvocations ( global bool)
0:15 'b1' ( temp bool)
0:16 move second child to first child ( temp bool)
0:16 'b1' ( temp bool)
0:16 allInvocationsEqual ( global bool)
0:16 'b1' ( temp bool)
0:? Linker Objects
0:? Linker Objects
0:? 's' ( smooth in structure{ global float f, global 4-component vector of float v})
0:? 's' ( smooth in structure{ global float f, global 4-component vector of float v})
...
@@ -26,6 +38,18 @@ Shader version: 460
...
@@ -26,6 +38,18 @@ Shader version: 460
0:12 's' ( smooth in structure{ global float f, global 4-component vector of float v})
0:12 's' ( smooth in structure{ global float f, global 4-component vector of float v})
0:12 Constant:
0:12 Constant:
0:12 1 (const int)
0:12 1 (const int)
0:14 move second child to first child ( temp bool)
0:14 'b1' ( temp bool)
0:14 anyInvocation ( global bool)
0:14 'b1' ( temp bool)
0:15 move second child to first child ( temp bool)
0:15 'b1' ( temp bool)
0:15 allInvocations ( global bool)
0:15 'b1' ( temp bool)
0:16 move second child to first child ( temp bool)
0:16 'b1' ( temp bool)
0:16 allInvocationsEqual ( global bool)
0:16 'b1' ( temp bool)
0:? Linker Objects
0:? Linker Objects
0:? 's' ( smooth in structure{ global float f, global 4-component vector of float v})
0:? 's' ( smooth in structure{ global float f, global 4-component vector of float v})
Test/baseResults/460.vert.out
View file @
934d11b6
...
@@ -3,6 +3,19 @@ Shader version: 460
...
@@ -3,6 +3,19 @@ Shader version: 460
0:? Sequence
0:? Sequence
0:7 Function Definition: main( ( global void)
0:7 Function Definition: main( ( global void)
0:7 Function Parameters:
0:7 Function Parameters:
0:? Sequence
0:10 move second child to first child ( temp bool)
0:10 'b1' ( temp bool)
0:10 anyInvocation ( global bool)
0:10 'b1' ( temp bool)
0:11 move second child to first child ( temp bool)
0:11 'b1' ( temp bool)
0:11 allInvocations ( global bool)
0:11 'b1' ( temp bool)
0:12 move second child to first child ( temp bool)
0:12 'b1' ( temp bool)
0:12 allInvocationsEqual ( global bool)
0:12 'b1' ( temp bool)
0:? Linker Objects
0:? Linker Objects
0:? 'i' ( global int)
0:? 'i' ( global int)
0:? 'f' ( global float)
0:? 'f' ( global float)
...
@@ -17,6 +30,19 @@ Shader version: 460
...
@@ -17,6 +30,19 @@ Shader version: 460
0:? Sequence
0:? Sequence
0:7 Function Definition: main( ( global void)
0:7 Function Definition: main( ( global void)
0:7 Function Parameters:
0:7 Function Parameters:
0:? Sequence
0:10 move second child to first child ( temp bool)
0:10 'b1' ( temp bool)
0:10 anyInvocation ( global bool)
0:10 'b1' ( temp bool)
0:11 move second child to first child ( temp bool)
0:11 'b1' ( temp bool)
0:11 allInvocations ( global bool)
0:11 'b1' ( temp bool)
0:12 move second child to first child ( temp bool)
0:12 'b1' ( temp bool)
0:12 allInvocationsEqual ( global bool)
0:12 'b1' ( temp bool)
0:? Linker Objects
0:? Linker Objects
0:? 'i' ( global int)
0:? 'i' ( global int)
0:? 'f' ( global float)
0:? 'f' ( global float)
...
...
Test/baseResults/spv.460.comp.out
0 → 100755
View file @
934d11b6
spv.460.comp
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 15
Capability Shader
Capability SubgroupVoteKHR
Extension "SPV_KHR_subgroup_vote"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 1 1 1
Source GLSL 460
Name 4 "main"
Name 8 "b1"
2: TypeVoid
3: TypeFunction 2
6: TypeBool
7: TypePointer Function 6(bool)
4(main): 2 Function None 3
5: Label
8(b1): 7(ptr) Variable Function
9: 6(bool) Load 8(b1)
10: 6(bool) SubgroupAnyKHR 9
Store 8(b1) 10
11: 6(bool) Load 8(b1)
12: 6(bool) SubgroupAllKHR 11
Store 8(b1) 12
13: 6(bool) Load 8(b1)
14: 6(bool) SubgroupAllEqualKHR 13
Store 8(b1) 14
Return
FunctionEnd
Test/spv.460.comp
0 → 100644
View file @
934d11b6
#version 460
void main()
{
bool b1;
b1 = anyInvocation(b1);
b1 = allInvocations(b1);
b1 = allInvocationsEqual(b1);
}
glslang/MachineIndependent/Initialize.cpp
View file @
934d11b6
...
@@ -1576,7 +1576,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -1576,7 +1576,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"
\n
"
);
"
\n
"
);
}
}
// GL_ARB_shader_group_vote
// GL_ARB_shader_group_vote
if
(
profile
!=
EEsProfile
&&
version
>=
430
)
{
if
(
profile
!=
EEsProfile
&&
version
>=
430
)
{
commonBuiltins
.
append
(
commonBuiltins
.
append
(
"bool anyInvocationARB(bool);"
"bool anyInvocationARB(bool);"
...
@@ -1586,6 +1586,15 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -1586,6 +1586,15 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"
\n
"
);
"
\n
"
);
}
}
if
(
profile
!=
EEsProfile
&&
version
>=
460
)
{
commonBuiltins
.
append
(
"bool anyInvocation(bool);"
"bool allInvocations(bool);"
"bool allInvocationsEqual(bool);"
"
\n
"
);
}
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
// GL_AMD_shader_ballot
// GL_AMD_shader_ballot
if
(
profile
!=
EEsProfile
&&
version
>=
450
)
{
if
(
profile
!=
EEsProfile
&&
version
>=
450
)
{
...
@@ -5273,9 +5282,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -5273,9 +5282,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
SpecialQualifier
(
"gl_SubGroupSizeARB"
,
EvqVaryingIn
,
EbvSubGroupSize
,
symbolTable
);
SpecialQualifier
(
"gl_SubGroupSizeARB"
,
EvqVaryingIn
,
EbvSubGroupSize
,
symbolTable
);
symbolTable
.
setFunctionExtensions
(
"anyInvocationARB"
,
1
,
&
E_GL_ARB_shader_group_vote
);
if
(
version
>=
430
)
{
symbolTable
.
setFunctionExtensions
(
"allInvocationsARB"
,
1
,
&
E_GL_ARB_shader_group_vote
);
symbolTable
.
setFunctionExtensions
(
"anyInvocationARB"
,
1
,
&
E_GL_ARB_shader_group_vote
);
symbolTable
.
setFunctionExtensions
(
"allInvocationsEqualARB"
,
1
,
&
E_GL_ARB_shader_group_vote
);
symbolTable
.
setFunctionExtensions
(
"allInvocationsARB"
,
1
,
&
E_GL_ARB_shader_group_vote
);
symbolTable
.
setFunctionExtensions
(
"allInvocationsEqualARB"
,
1
,
&
E_GL_ARB_shader_group_vote
);
}
}
}
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
...
@@ -6087,10 +6098,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -6087,10 +6098,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable
.
relateToOperator
(
"readInvocationARB"
,
EOpReadInvocation
);
symbolTable
.
relateToOperator
(
"readInvocationARB"
,
EOpReadInvocation
);
symbolTable
.
relateToOperator
(
"readFirstInvocationARB"
,
EOpReadFirstInvocation
);
symbolTable
.
relateToOperator
(
"readFirstInvocationARB"
,
EOpReadFirstInvocation
);
symbolTable
.
relateToOperator
(
"anyInvocationARB"
,
EOpAnyInvocation
);
if
(
version
>=
430
)
{
symbolTable
.
relateToOperator
(
"allInvocationsARB"
,
EOpAllInvocations
);
symbolTable
.
relateToOperator
(
"anyInvocationARB"
,
EOpAnyInvocation
);
symbolTable
.
relateToOperator
(
"allInvocationsEqualARB"
,
EOpAllInvocationsEqual
);
symbolTable
.
relateToOperator
(
"allInvocationsARB"
,
EOpAllInvocations
);
symbolTable
.
relateToOperator
(
"allInvocationsEqualARB"
,
EOpAllInvocationsEqual
);
}
if
(
version
>=
460
)
{
symbolTable
.
relateToOperator
(
"anyInvocation"
,
EOpAnyInvocation
);
symbolTable
.
relateToOperator
(
"allInvocations"
,
EOpAllInvocations
);
symbolTable
.
relateToOperator
(
"allInvocationsEqual"
,
EOpAllInvocationsEqual
);
}
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
symbolTable
.
relateToOperator
(
"minInvocationsAMD"
,
EOpMinInvocations
);
symbolTable
.
relateToOperator
(
"minInvocationsAMD"
,
EOpMinInvocations
);
symbolTable
.
relateToOperator
(
"maxInvocationsAMD"
,
EOpMaxInvocations
);
symbolTable
.
relateToOperator
(
"maxInvocationsAMD"
,
EOpMaxInvocations
);
...
...
gtests/Spv.FromFile.cpp
View file @
934d11b6
...
@@ -362,6 +362,7 @@ INSTANTIATE_TEST_CASE_P(
...
@@ -362,6 +362,7 @@ INSTANTIATE_TEST_CASE_P(
::
testing
::
ValuesIn
(
std
::
vector
<
std
::
string
>
({
::
testing
::
ValuesIn
(
std
::
vector
<
std
::
string
>
({
"spv.460.frag"
,
"spv.460.frag"
,
"spv.460.vert"
,
"spv.460.vert"
,
"spv.460.comp"
,
"spv.atomic.comp"
,
"spv.atomic.comp"
,
"spv.glFragColor.frag"
,
"spv.glFragColor.frag"
,
"spv.specConst.vert"
,
"spv.specConst.vert"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment