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
e8cdec5e
Commit
e8cdec5e
authored
May 25, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Subgroup fixes: fragment 'in' must be flat, consistent version testing, per-stage corrections, etc.
This makes all tests work correctly.
parent
e7b51b03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
18 deletions
+133
-18
spv.specConstant.vert.out
Test/baseResults/spv.specConstant.vert.out
+3
-3
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+130
-15
No files found.
Test/baseResults/spv.specConstant.vert.out
View file @
e8cdec5e
...
@@ -13,7 +13,7 @@ Warning, version 400 is not yet complete; most version-specific features are pre
...
@@ -13,7 +13,7 @@ Warning, version 400 is not yet complete; most version-specific features are pre
Source GLSL 400
Source GLSL 400
Name 4 "main"
Name 4 "main"
Name 9 "arraySize"
Name 9 "arraySize"
Name 14 "foo(vf4[s21
53
];"
Name 14 "foo(vf4[s21
60
];"
Name 13 "p"
Name 13 "p"
Name 17 "builtin_spec_constant("
Name 17 "builtin_spec_constant("
Name 20 "color"
Name 20 "color"
...
@@ -104,10 +104,10 @@ Warning, version 400 is not yet complete; most version-specific features are pre
...
@@ -104,10 +104,10 @@ Warning, version 400 is not yet complete; most version-specific features are pre
Store 20(color) 46
Store 20(color) 46
48: 10 Load 22(ucol)
48: 10 Load 22(ucol)
Store 47(param) 48
Store 47(param) 48
49: 2 FunctionCall 14(foo(vf4[s21
53
];) 47(param)
49: 2 FunctionCall 14(foo(vf4[s21
60
];) 47(param)
Return
Return
FunctionEnd
FunctionEnd
14(foo(vf4[s21
53
];): 2 Function None 12
14(foo(vf4[s21
60
];): 2 Function None 12
13(p): 11(ptr) FunctionParameter
13(p): 11(ptr) FunctionParameter
15: Label
15: Label
54: 24(ptr) AccessChain 53(dupUcol) 23
54: 24(ptr) AccessChain 53(dupUcol) 23
...
...
glslang/MachineIndependent/Initialize.cpp
View file @
e8cdec5e
...
@@ -4449,17 +4449,30 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -4449,17 +4449,30 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
// GL_ARB_shader_ballot
// GL_ARB_shader_ballot
if
(
profile
!=
EEsProfile
&&
version
>=
450
)
{
if
(
profile
!=
EEsProfile
&&
version
>=
450
)
{
co
mmonBuiltins
.
append
(
co
nst
char
*
ballotDecls
=
"uniform uint gl_SubGroupSizeARB;"
"uniform uint gl_SubGroupSizeARB;"
"in uint gl_SubGroupInvocationARB;"
"in uint gl_SubGroupInvocationARB;"
"in uint64_t gl_SubGroupEqMaskARB;"
"in uint64_t gl_SubGroupEqMaskARB;"
"in uint64_t gl_SubGroupGeMaskARB;"
"in uint64_t gl_SubGroupGeMaskARB;"
"in uint64_t gl_SubGroupGtMaskARB;"
"in uint64_t gl_SubGroupGtMaskARB;"
"in uint64_t gl_SubGroupLeMaskARB;"
"in uint64_t gl_SubGroupLeMaskARB;"
"in uint64_t gl_SubGroupLtMaskARB;"
"in uint64_t gl_SubGroupLtMaskARB;"
"
\n
"
;
"
\n
"
);
const
char
*
fragmentBallotDecls
=
"uniform uint gl_SubGroupSizeARB;"
"flat in uint gl_SubGroupInvocationARB;"
"flat in uint64_t gl_SubGroupEqMaskARB;"
"flat in uint64_t gl_SubGroupGeMaskARB;"
"flat in uint64_t gl_SubGroupGtMaskARB;"
"flat in uint64_t gl_SubGroupLeMaskARB;"
"flat in uint64_t gl_SubGroupLtMaskARB;"
"
\n
"
;
stageBuiltins
[
EShLangVertex
]
.
append
(
ballotDecls
);
stageBuiltins
[
EShLangTessControl
]
.
append
(
ballotDecls
);
stageBuiltins
[
EShLangTessEvaluation
].
append
(
ballotDecls
);
stageBuiltins
[
EShLangGeometry
]
.
append
(
ballotDecls
);
stageBuiltins
[
EShLangCompute
]
.
append
(
ballotDecls
);
stageBuiltins
[
EShLangFragment
]
.
append
(
fragmentBallotDecls
);
}
}
if
((
profile
!=
EEsProfile
&&
version
>=
140
)
||
if
((
profile
!=
EEsProfile
&&
version
>=
140
)
||
...
@@ -4472,21 +4485,34 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -4472,21 +4485,34 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
// GL_KHR_shader_subgroup
// GL_KHR_shader_subgroup
if
(
spvVersion
.
vulkan
>=
100
)
{
if
(
spvVersion
.
vulkan
>=
100
)
{
commonBuiltins
.
append
(
const
char
*
ballotDecls
=
"mediump in uint gl_SubgroupSize;"
"in mediump uint gl_SubgroupSize;"
"mediump in uint gl_SubgroupInvocationID;"
"in mediump uint gl_SubgroupInvocationID;"
"highp in uvec4 gl_SubgroupEqMask;"
"in highp uvec4 gl_SubgroupEqMask;"
"highp in uvec4 gl_SubgroupGeMask;"
"in highp uvec4 gl_SubgroupGeMask;"
"highp in uvec4 gl_SubgroupGtMask;"
"in highp uvec4 gl_SubgroupGtMask;"
"highp in uvec4 gl_SubgroupLeMask;"
"in highp uvec4 gl_SubgroupLeMask;"
"highp in uvec4 gl_SubgroupLtMask;"
"in highp uvec4 gl_SubgroupLtMask;"
"
\n
"
;
"
\n
"
);
const
char
*
fragmentBallotDecls
=
"flat in mediump uint gl_SubgroupSize;"
"flat in mediump uint gl_SubgroupInvocationID;"
"flat in highp uvec4 gl_SubgroupEqMask;"
"flat in highp uvec4 gl_SubgroupGeMask;"
"flat in highp uvec4 gl_SubgroupGtMask;"
"flat in highp uvec4 gl_SubgroupLeMask;"
"flat in highp uvec4 gl_SubgroupLtMask;"
"
\n
"
;
stageBuiltins
[
EShLangVertex
]
.
append
(
ballotDecls
);
stageBuiltins
[
EShLangTessControl
]
.
append
(
ballotDecls
);
stageBuiltins
[
EShLangTessEvaluation
].
append
(
ballotDecls
);
stageBuiltins
[
EShLangGeometry
]
.
append
(
ballotDecls
);
stageBuiltins
[
EShLangCompute
]
.
append
(
ballotDecls
);
stageBuiltins
[
EShLangFragment
]
.
append
(
fragmentBallotDecls
);
stageBuiltins
[
EShLangCompute
].
append
(
stageBuiltins
[
EShLangCompute
].
append
(
"highp in uint gl_NumSubgroups;"
"highp in uint gl_NumSubgroups;"
"highp in uint gl_SubgroupID;"
"highp in uint gl_SubgroupID;"
"
\n
"
);
"
\n
"
);
}
}
...
@@ -5676,6 +5702,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -5676,6 +5702,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable
(
"gl_DrawIDARB"
,
EbvDrawId
,
symbolTable
);
BuiltInVariable
(
"gl_DrawIDARB"
,
EbvDrawId
,
symbolTable
);
}
}
// GL_ARB_shader_ballot
if
(
profile
!=
EEsProfile
)
{
if
(
profile
!=
EEsProfile
)
{
symbolTable
.
setVariableExtensions
(
"gl_SubGroupSizeARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupSizeARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupInvocationARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupInvocationARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
...
@@ -5699,12 +5726,33 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -5699,12 +5726,33 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
if
(
spvVersion
.
vulkan
>=
100
)
if
(
spvVersion
.
vulkan
>=
100
)
// 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
);
else
BuiltInVariable
(
"gl_SubGroupSizeARB"
,
EbvSubGroupSize
,
symbolTable
);
symbolTable
.
setFunctionExtensions
(
"anyInvocationARB"
,
1
,
&
E_GL_ARB_shader_group_vote
);
symbolTable
.
setFunctionExtensions
(
"anyInvocationARB"
,
1
,
&
E_GL_ARB_shader_group_vote
);
symbolTable
.
setFunctionExtensions
(
"allInvocationsARB"
,
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
);
symbolTable
.
setFunctionExtensions
(
"allInvocationsEqualARB"
,
1
,
&
E_GL_ARB_shader_group_vote
);
}
}
// GL_KHR_shader_subgroup
if
(
spvVersion
.
vulkan
>=
100
)
{
symbolTable
.
setVariableExtensions
(
"gl_SubgroupSize"
,
1
,
&
E_GL_KHR_shader_subgroup_basic
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupInvocationID"
,
1
,
&
E_GL_KHR_shader_subgroup_basic
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupEqMask"
,
1
,
&
E_GL_KHR_shader_subgroup_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupGeMask"
,
1
,
&
E_GL_KHR_shader_subgroup_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupGtMask"
,
1
,
&
E_GL_KHR_shader_subgroup_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupLeMask"
,
1
,
&
E_GL_KHR_shader_subgroup_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupLtMask"
,
1
,
&
E_GL_KHR_shader_subgroup_ballot
);
BuiltInVariable
(
"gl_SubgroupSize"
,
EbvSubgroupSize2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupInvocationID"
,
EbvSubgroupInvocation2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupEqMask"
,
EbvSubgroupEqMask2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupGeMask"
,
EbvSubgroupGeMask2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupGtMask"
,
EbvSubgroupGtMask2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupLeMask"
,
EbvSubgroupLeMask2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupLtMask"
,
EbvSubgroupLtMask2
,
symbolTable
);
}
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
if
(
profile
!=
EEsProfile
)
{
if
(
profile
!=
EEsProfile
)
{
symbolTable
.
setFunctionExtensions
(
"minInvocationsAMD"
,
1
,
&
E_GL_AMD_shader_ballot
);
symbolTable
.
setFunctionExtensions
(
"minInvocationsAMD"
,
1
,
&
E_GL_AMD_shader_ballot
);
...
@@ -6114,6 +6162,30 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -6114,6 +6162,30 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable
.
setVariableExtensions
(
"gl_ViewIndex"
,
1
,
&
E_GL_EXT_multiview
);
symbolTable
.
setVariableExtensions
(
"gl_ViewIndex"
,
1
,
&
E_GL_EXT_multiview
);
BuiltInVariable
(
"gl_ViewIndex"
,
EbvViewIndex
,
symbolTable
);
BuiltInVariable
(
"gl_ViewIndex"
,
EbvViewIndex
,
symbolTable
);
// GL_ARB_shader_ballot
if
(
profile
!=
EEsProfile
)
{
symbolTable
.
setVariableExtensions
(
"gl_SubGroupSizeARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupInvocationARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupEqMaskARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupGeMaskARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupGtMaskARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupLeMaskARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupLtMaskARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
BuiltInVariable
(
"gl_SubGroupInvocationARB"
,
EbvSubGroupInvocation
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupEqMaskARB"
,
EbvSubGroupEqMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupGeMaskARB"
,
EbvSubGroupGeMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupGtMaskARB"
,
EbvSubGroupGtMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupLeMaskARB"
,
EbvSubGroupLeMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupLtMaskARB"
,
EbvSubGroupLtMask
,
symbolTable
);
if
(
spvVersion
.
vulkan
>=
100
)
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
SpecialQualifier
(
"gl_SubGroupSizeARB"
,
EvqVaryingIn
,
EbvSubGroupSize
,
symbolTable
);
else
BuiltInVariable
(
"gl_SubGroupSizeARB"
,
EbvSubGroupSize
,
symbolTable
);
}
// GL_KHR_shader_subgroup
// GL_KHR_shader_subgroup
if
(
spvVersion
.
vulkan
>=
100
)
{
if
(
spvVersion
.
vulkan
>=
100
)
{
symbolTable
.
setVariableExtensions
(
"gl_SubgroupSize"
,
1
,
&
E_GL_KHR_shader_subgroup_basic
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupSize"
,
1
,
&
E_GL_KHR_shader_subgroup_basic
);
...
@@ -6221,6 +6293,49 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -6221,6 +6293,49 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable
.
setFunctionExtensions
(
"groupMemoryBarrier"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setFunctionExtensions
(
"groupMemoryBarrier"
,
1
,
&
E_GL_ARB_compute_shader
);
}
}
// GL_ARB_shader_ballot
if
(
profile
!=
EEsProfile
)
{
symbolTable
.
setVariableExtensions
(
"gl_SubGroupSizeARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupInvocationARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupEqMaskARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupGeMaskARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupGtMaskARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupLeMaskARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubGroupLtMaskARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
BuiltInVariable
(
"gl_SubGroupInvocationARB"
,
EbvSubGroupInvocation
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupEqMaskARB"
,
EbvSubGroupEqMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupGeMaskARB"
,
EbvSubGroupGeMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupGtMaskARB"
,
EbvSubGroupGtMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupLeMaskARB"
,
EbvSubGroupLeMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupLtMaskARB"
,
EbvSubGroupLtMask
,
symbolTable
);
if
(
spvVersion
.
vulkan
>=
100
)
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
SpecialQualifier
(
"gl_SubGroupSizeARB"
,
EvqVaryingIn
,
EbvSubGroupSize
,
symbolTable
);
else
BuiltInVariable
(
"gl_SubGroupSizeARB"
,
EbvSubGroupSize
,
symbolTable
);
}
// GL_ARB_shader_ballot
if
(
spvVersion
.
vulkan
>=
100
)
{
symbolTable
.
setVariableExtensions
(
"gl_SubgroupSize"
,
1
,
&
E_GL_KHR_shader_subgroup_basic
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupInvocationID"
,
1
,
&
E_GL_KHR_shader_subgroup_basic
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupEqMask"
,
1
,
&
E_GL_KHR_shader_subgroup_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupGeMask"
,
1
,
&
E_GL_KHR_shader_subgroup_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupGtMask"
,
1
,
&
E_GL_KHR_shader_subgroup_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupLeMask"
,
1
,
&
E_GL_KHR_shader_subgroup_ballot
);
symbolTable
.
setVariableExtensions
(
"gl_SubgroupLtMask"
,
1
,
&
E_GL_KHR_shader_subgroup_ballot
);
BuiltInVariable
(
"gl_SubgroupSize"
,
EbvSubgroupSize2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupInvocationID"
,
EbvSubgroupInvocation2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupEqMask"
,
EbvSubgroupEqMask2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupGeMask"
,
EbvSubgroupGeMask2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupGtMask"
,
EbvSubgroupGtMask2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupLeMask"
,
EbvSubgroupLeMask2
,
symbolTable
);
BuiltInVariable
(
"gl_SubgroupLtMask"
,
EbvSubgroupLtMask2
,
symbolTable
);
}
if
((
profile
!=
EEsProfile
&&
version
>=
140
)
||
if
((
profile
!=
EEsProfile
&&
version
>=
140
)
||
(
profile
==
EEsProfile
&&
version
>=
310
))
{
(
profile
==
EEsProfile
&&
version
>=
310
))
{
symbolTable
.
setVariableExtensions
(
"gl_DeviceIndex"
,
1
,
&
E_GL_EXT_device_group
);
symbolTable
.
setVariableExtensions
(
"gl_DeviceIndex"
,
1
,
&
E_GL_EXT_device_group
);
...
...
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