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
807a0d9e
Commit
807a0d9e
authored
Dec 21, 2016
by
John Kessenich
Committed by
GitHub
Dec 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #640 from chaoc/modify-shader-ballot
Modify shader ballot extension by adding OpSubgroupReadInvocationKHR
parents
f48faec3
f200da86
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
6 deletions
+18
-6
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+12
-6
doc.cpp
SPIRV/doc.cpp
+5
-0
spirv.hpp
SPIRV/spirv.hpp
+1
-0
spv.shaderBallot.comp.out
Test/baseResults/spv.shaderBallot.comp.out
+0
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
807a0d9e
...
@@ -4131,7 +4131,8 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
...
@@ -4131,7 +4131,8 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
spv
::
Op
opCode
=
spv
::
OpNop
;
spv
::
Op
opCode
=
spv
::
OpNop
;
std
::
vector
<
spv
::
Id
>
spvGroupOperands
;
std
::
vector
<
spv
::
Id
>
spvGroupOperands
;
if
(
op
==
glslang
::
EOpBallot
||
op
==
glslang
::
EOpReadFirstInvocation
)
{
if
(
op
==
glslang
::
EOpBallot
||
op
==
glslang
::
EOpReadFirstInvocation
||
op
==
glslang
::
EOpReadInvocation
)
{
builder
.
addExtension
(
spv
::
E_SPV_KHR_shader_ballot
);
builder
.
addExtension
(
spv
::
E_SPV_KHR_shader_ballot
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
}
else
{
}
else
{
...
@@ -4171,7 +4172,7 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
...
@@ -4171,7 +4172,7 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
}
}
case
glslang
:
:
EOpReadInvocation
:
case
glslang
:
:
EOpReadInvocation
:
opCode
=
spv
::
Op
GroupBroadcast
;
opCode
=
spv
::
Op
SubgroupReadInvocationKHR
;
if
(
builder
.
isVectorType
(
typeId
))
if
(
builder
.
isVectorType
(
typeId
))
return
CreateInvocationsVectorOperation
(
opCode
,
typeId
,
operands
);
return
CreateInvocationsVectorOperation
(
opCode
,
typeId
,
operands
);
break
;
break
;
...
@@ -4283,13 +4284,15 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv
...
@@ -4283,13 +4284,15 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv
assert
(
op
==
spv
::
OpGroupFMin
||
op
==
spv
::
OpGroupUMin
||
op
==
spv
::
OpGroupSMin
||
assert
(
op
==
spv
::
OpGroupFMin
||
op
==
spv
::
OpGroupUMin
||
op
==
spv
::
OpGroupSMin
||
op
==
spv
::
OpGroupFMax
||
op
==
spv
::
OpGroupUMax
||
op
==
spv
::
OpGroupSMax
||
op
==
spv
::
OpGroupFMax
||
op
==
spv
::
OpGroupUMax
||
op
==
spv
::
OpGroupSMax
||
op
==
spv
::
OpGroupFAdd
||
op
==
spv
::
OpGroupIAdd
||
op
==
spv
::
OpGroupBroadcast
||
op
==
spv
::
OpGroupFAdd
||
op
==
spv
::
OpGroupIAdd
||
op
==
spv
::
OpGroupBroadcast
||
op
==
spv
::
OpSubgroupReadInvocationKHR
||
op
==
spv
::
OpGroupFMinNonUniformAMD
||
op
==
spv
::
OpGroupUMinNonUniformAMD
||
op
==
spv
::
OpGroupSMinNonUniformAMD
||
op
==
spv
::
OpGroupFMinNonUniformAMD
||
op
==
spv
::
OpGroupUMinNonUniformAMD
||
op
==
spv
::
OpGroupSMinNonUniformAMD
||
op
==
spv
::
OpGroupFMaxNonUniformAMD
||
op
==
spv
::
OpGroupUMaxNonUniformAMD
||
op
==
spv
::
OpGroupSMaxNonUniformAMD
||
op
==
spv
::
OpGroupFMaxNonUniformAMD
||
op
==
spv
::
OpGroupUMaxNonUniformAMD
||
op
==
spv
::
OpGroupSMaxNonUniformAMD
||
op
==
spv
::
OpGroupFAddNonUniformAMD
||
op
==
spv
::
OpGroupIAddNonUniformAMD
);
op
==
spv
::
OpGroupFAddNonUniformAMD
||
op
==
spv
::
OpGroupIAddNonUniformAMD
);
#else
#else
assert
(
op
==
spv
::
OpGroupFMin
||
op
==
spv
::
OpGroupUMin
||
op
==
spv
::
OpGroupSMin
||
assert
(
op
==
spv
::
OpGroupFMin
||
op
==
spv
::
OpGroupUMin
||
op
==
spv
::
OpGroupSMin
||
op
==
spv
::
OpGroupFMax
||
op
==
spv
::
OpGroupUMax
||
op
==
spv
::
OpGroupSMax
||
op
==
spv
::
OpGroupFMax
||
op
==
spv
::
OpGroupUMax
||
op
==
spv
::
OpGroupSMax
||
op
==
spv
::
OpGroupFAdd
||
op
==
spv
::
OpGroupIAdd
||
op
==
spv
::
OpGroupBroadcast
);
op
==
spv
::
OpGroupFAdd
||
op
==
spv
::
OpGroupIAdd
||
op
==
spv
::
OpGroupBroadcast
||
op
==
spv
::
OpSubgroupReadInvocationKHR
);
#endif
#endif
// Handle group invocation operations scalar by scalar.
// Handle group invocation operations scalar by scalar.
...
@@ -4309,13 +4312,16 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv
...
@@ -4309,13 +4312,16 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv
std
::
vector
<
unsigned
int
>
indexes
;
std
::
vector
<
unsigned
int
>
indexes
;
indexes
.
push_back
(
comp
);
indexes
.
push_back
(
comp
);
spv
::
Id
scalar
=
builder
.
createCompositeExtract
(
operands
[
0
],
scalarType
,
indexes
);
spv
::
Id
scalar
=
builder
.
createCompositeExtract
(
operands
[
0
],
scalarType
,
indexes
);
std
::
vector
<
spv
::
Id
>
spvGroupOperands
;
std
::
vector
<
spv
::
Id
>
spvGroupOperands
;
spvGroupOperands
.
push_back
(
builder
.
makeUintConstant
(
spv
::
ScopeSubgroup
));
if
(
op
==
spv
::
OpSubgroupReadInvocationKHR
)
{
if
(
op
==
spv
::
OpGroupBroadcast
)
{
spvGroupOperands
.
push_back
(
scalar
);
spvGroupOperands
.
push_back
(
operands
[
1
]);
}
else
if
(
op
==
spv
::
OpGroupBroadcast
)
{
spvGroupOperands
.
push_back
(
builder
.
makeUintConstant
(
spv
::
ScopeSubgroup
));
spvGroupOperands
.
push_back
(
scalar
);
spvGroupOperands
.
push_back
(
scalar
);
spvGroupOperands
.
push_back
(
operands
[
1
]);
spvGroupOperands
.
push_back
(
operands
[
1
]);
}
else
{
}
else
{
spvGroupOperands
.
push_back
(
builder
.
makeUintConstant
(
spv
::
ScopeSubgroup
));
spvGroupOperands
.
push_back
(
spv
::
GroupOperationReduce
);
spvGroupOperands
.
push_back
(
spv
::
GroupOperationReduce
);
spvGroupOperands
.
push_back
(
scalar
);
spvGroupOperands
.
push_back
(
scalar
);
}
}
...
...
SPIRV/doc.cpp
View file @
807a0d9e
...
@@ -1158,6 +1158,7 @@ const char* OpcodeString(int op)
...
@@ -1158,6 +1158,7 @@ const char* OpcodeString(int op)
case
4421
:
return
"OpSubgroupBallotKHR"
;
case
4421
:
return
"OpSubgroupBallotKHR"
;
case
4422
:
return
"OpSubgroupFirstInvocationKHR"
;
case
4422
:
return
"OpSubgroupFirstInvocationKHR"
;
case
4432
:
return
"OpSubgroupReadInvocationKHR"
;
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
case
5000
:
return
"OpGroupIAddNonUniformAMD"
;
case
5000
:
return
"OpGroupIAddNonUniformAMD"
;
...
@@ -2770,6 +2771,10 @@ void Parameterize()
...
@@ -2770,6 +2771,10 @@ void Parameterize()
InstructionDesc
[
OpSubgroupFirstInvocationKHR
].
operands
.
push
(
OperandId
,
"'Value'"
);
InstructionDesc
[
OpSubgroupFirstInvocationKHR
].
operands
.
push
(
OperandId
,
"'Value'"
);
InstructionDesc
[
OpSubgroupReadInvocationKHR
].
capabilities
.
push_back
(
CapabilityGroups
);
InstructionDesc
[
OpSubgroupReadInvocationKHR
].
operands
.
push
(
OperandId
,
"'Value'"
);
InstructionDesc
[
OpSubgroupReadInvocationKHR
].
operands
.
push
(
OperandId
,
"'Index'"
);
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
InstructionDesc
[
OpGroupIAddNonUniformAMD
].
capabilities
.
push_back
(
CapabilityGroups
);
InstructionDesc
[
OpGroupIAddNonUniformAMD
].
capabilities
.
push_back
(
CapabilityGroups
);
InstructionDesc
[
OpGroupIAddNonUniformAMD
].
operands
.
push
(
OperandScope
,
"'Execution'"
);
InstructionDesc
[
OpGroupIAddNonUniformAMD
].
operands
.
push
(
OperandScope
,
"'Execution'"
);
...
...
SPIRV/spirv.hpp
View file @
807a0d9e
...
@@ -905,6 +905,7 @@ enum Op {
...
@@ -905,6 +905,7 @@ enum Op {
OpImageSparseRead
=
320
,
OpImageSparseRead
=
320
,
OpSubgroupBallotKHR
=
4421
,
OpSubgroupBallotKHR
=
4421
,
OpSubgroupFirstInvocationKHR
=
4422
,
OpSubgroupFirstInvocationKHR
=
4422
,
OpSubgroupReadInvocationKHR
=
4432
,
OpMax
=
0x7fffffff
,
OpMax
=
0x7fffffff
,
};
};
...
...
Test/baseResults/spv.shaderBallot.comp.out
View file @
807a0d9e
This diff is collapsed.
Click to expand it.
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