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
02df206c
Commit
02df206c
authored
Sep 22, 2016
by
John Kessenich
Committed by
GitHub
Sep 22, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #516 from amdrexu/feature3
SPV: Implement the extension SPV_KHR_shader_ballot
parents
4455258a
51596644
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
475 additions
and
336 deletions
+475
-336
CMakeLists.txt
SPIRV/CMakeLists.txt
+1
-0
GLSL.ext.KHR.h
SPIRV/GLSL.ext.KHR.h
+51
-0
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+109
-50
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+2
-2
SpvBuilder.h
SPIRV/SpvBuilder.h
+2
-2
doc.cpp
SPIRV/doc.cpp
+18
-6
spv.shaderBallot.comp.out
Test/baseResults/spv.shaderBallot.comp.out
+288
-275
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+4
-1
No files found.
SPIRV/CMakeLists.txt
View file @
02df206c
...
@@ -13,6 +13,7 @@ set(SPVREMAP_SOURCES
...
@@ -13,6 +13,7 @@ set(SPVREMAP_SOURCES
set
(
HEADERS
set
(
HEADERS
spirv.hpp
spirv.hpp
GLSL.std.450.h
GLSL.std.450.h
GLSL.ext.KHR.h
GlslangToSpv.h
GlslangToSpv.h
Logger.h
Logger.h
SpvBuilder.h
SpvBuilder.h
...
...
SPIRV/GLSL.ext.KHR.h
0 → 100644
View file @
02df206c
/*
** Copyright (c) 2014-2016 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and/or associated documentation files (the "Materials"),
** to deal in the Materials without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Materials, and to permit persons to whom the
** Materials are furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Materials.
**
** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
** IN THE MATERIALS.
*/
#ifndef GLSLextKHR_H
#define GLSLextKHR_H
enum
BuiltIn
;
enum
Op
;
enum
Capability
;
static
const
int
GLSLextKHRVersion
=
100
;
static
const
int
GLSLextKHRRevision
=
1
;
// SPV_KHR_shader_ballot
static
const
char
*
const
E_SPV_KHR_shader_ballot
=
"SPV_KHR_shader_ballot"
;
static
const
BuiltIn
BuiltInSubgroupEqMaskKHR
=
static_cast
<
BuiltIn
>
(
4416
);
static
const
BuiltIn
BuiltInSubgroupGeMaskKHR
=
static_cast
<
BuiltIn
>
(
4417
);
static
const
BuiltIn
BuiltInSubgroupGtMaskKHR
=
static_cast
<
BuiltIn
>
(
4418
);
static
const
BuiltIn
BuiltInSubgroupLeMaskKHR
=
static_cast
<
BuiltIn
>
(
4419
);
static
const
BuiltIn
BuiltInSubgroupLtMaskKHR
=
static_cast
<
BuiltIn
>
(
4420
);
static
const
Op
OpSubgroupBallotKHR
=
static_cast
<
Op
>
(
4421
);
static
const
Op
OpSubgroupFirstInvocationKHR
=
static_cast
<
Op
>
(
4422
);
static
const
Capability
CapabilitySubgroupBallotKHR
=
static_cast
<
Capability
>
(
4423
);
#endif // #ifndef GLSLextKHR_H
SPIRV/GlslangToSpv.cpp
View file @
02df206c
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
#include "SpvBuilder.h"
#include "SpvBuilder.h"
namespace
spv
{
namespace
spv
{
#include "GLSL.std.450.h"
#include "GLSL.std.450.h"
#include "GLSL.ext.KHR.h"
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
#include "GLSL.ext.AMD.h"
#include "GLSL.ext.AMD.h"
#endif
#endif
...
@@ -154,7 +155,7 @@ protected:
...
@@ -154,7 +155,7 @@ protected:
spv
::
Id
createConversion
(
glslang
::
TOperator
op
,
spv
::
Decoration
precision
,
spv
::
Decoration
noContraction
,
spv
::
Id
destTypeId
,
spv
::
Id
operand
,
glslang
::
TBasicType
typeProxy
);
spv
::
Id
createConversion
(
glslang
::
TOperator
op
,
spv
::
Decoration
precision
,
spv
::
Decoration
noContraction
,
spv
::
Id
destTypeId
,
spv
::
Id
operand
,
glslang
::
TBasicType
typeProxy
);
spv
::
Id
makeSmearedConstant
(
spv
::
Id
constant
,
int
vectorSize
);
spv
::
Id
makeSmearedConstant
(
spv
::
Id
constant
,
int
vectorSize
);
spv
::
Id
createAtomicOperation
(
glslang
::
TOperator
op
,
spv
::
Decoration
precision
,
spv
::
Id
typeId
,
std
::
vector
<
spv
::
Id
>&
operands
,
glslang
::
TBasicType
typeProxy
);
spv
::
Id
createAtomicOperation
(
glslang
::
TOperator
op
,
spv
::
Decoration
precision
,
spv
::
Id
typeId
,
std
::
vector
<
spv
::
Id
>&
operands
,
glslang
::
TBasicType
typeProxy
);
spv
::
Id
createInvocationsOperation
(
glslang
::
TOperator
op
,
spv
::
Id
typeId
,
s
pv
::
Id
operand
,
glslang
::
TBasicType
typeProxy
);
spv
::
Id
createInvocationsOperation
(
glslang
::
TOperator
op
,
spv
::
Id
typeId
,
s
td
::
vector
<
spv
::
Id
>&
operands
,
glslang
::
TBasicType
typeProxy
);
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
spv
::
Id
CreateInvocationsVectorOperation
(
spv
::
Op
op
,
spv
::
Id
typeId
,
spv
::
Id
operand
);
spv
::
Id
CreateInvocationsVectorOperation
(
spv
::
Op
op
,
spv
::
Id
typeId
,
spv
::
Id
operand
);
#endif
#endif
...
@@ -521,16 +522,40 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
...
@@ -521,16 +522,40 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
case
glslang
:
:
EbvLocalInvocationId
:
return
spv
::
BuiltInLocalInvocationId
;
case
glslang
:
:
EbvLocalInvocationId
:
return
spv
::
BuiltInLocalInvocationId
;
case
glslang
:
:
EbvLocalInvocationIndex
:
return
spv
::
BuiltInLocalInvocationIndex
;
case
glslang
:
:
EbvLocalInvocationIndex
:
return
spv
::
BuiltInLocalInvocationIndex
;
case
glslang
:
:
EbvGlobalInvocationId
:
return
spv
::
BuiltInGlobalInvocationId
;
case
glslang
:
:
EbvGlobalInvocationId
:
return
spv
::
BuiltInGlobalInvocationId
;
case
glslang
:
:
EbvSubGroupSize
:
case
glslang
:
:
EbvSubGroupSize
:
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
return
spv
::
BuiltInSubgroupSize
;
case
glslang
:
:
EbvSubGroupInvocation
:
case
glslang
:
:
EbvSubGroupInvocation
:
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
return
spv
::
BuiltInSubgroupLocalInvocationId
;
case
glslang
:
:
EbvSubGroupEqMask
:
case
glslang
:
:
EbvSubGroupEqMask
:
builder
.
addExtension
(
spv
::
E_SPV_KHR_shader_ballot
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
return
spv
::
BuiltInSubgroupEqMaskKHR
;
case
glslang
:
:
EbvSubGroupGeMask
:
case
glslang
:
:
EbvSubGroupGeMask
:
builder
.
addExtension
(
spv
::
E_SPV_KHR_shader_ballot
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
return
spv
::
BuiltInSubgroupGeMaskKHR
;
case
glslang
:
:
EbvSubGroupGtMask
:
case
glslang
:
:
EbvSubGroupGtMask
:
builder
.
addExtension
(
spv
::
E_SPV_KHR_shader_ballot
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
return
spv
::
BuiltInSubgroupGtMaskKHR
;
case
glslang
:
:
EbvSubGroupLeMask
:
case
glslang
:
:
EbvSubGroupLeMask
:
builder
.
addExtension
(
spv
::
E_SPV_KHR_shader_ballot
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
return
spv
::
BuiltInSubgroupLeMaskKHR
;
case
glslang
:
:
EbvSubGroupLtMask
:
case
glslang
:
:
EbvSubGroupLtMask
:
// TODO: Add SPIR-V builtin ID.
builder
.
addExtension
(
spv
::
E_SPV_KHR_shader_ballot
);
logger
->
missingFunctionality
(
"shader ballot"
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
return
spv
::
BuiltInMax
;
return
spv
::
BuiltInSubgroupLtMaskKHR
;
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
case
glslang
:
:
EbvBaryCoordNoPersp
:
return
spv
::
BuiltInBaryCoordNoPerspAMD
;
case
glslang
:
:
EbvBaryCoordNoPersp
:
return
spv
::
BuiltInBaryCoordNoPerspAMD
;
case
glslang
:
:
EbvBaryCoordNoPerspCentroid
:
return
spv
::
BuiltInBaryCoordNoPerspCentroidAMD
;
case
glslang
:
:
EbvBaryCoordNoPerspCentroid
:
return
spv
::
BuiltInBaryCoordNoPerspCentroidAMD
;
...
@@ -3610,10 +3635,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
...
@@ -3610,10 +3635,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
case
glslang
:
:
EOpBallot
:
case
glslang
:
:
EOpBallot
:
case
glslang
:
:
EOpReadFirstInvocation
:
case
glslang
:
:
EOpReadFirstInvocation
:
logger
->
missingFunctionality
(
"shader ballot"
);
libCall
=
spv
::
GLSLstd450Bad
;
break
;
case
glslang
:
:
EOpAnyInvocation
:
case
glslang
:
:
EOpAnyInvocation
:
case
glslang
:
:
EOpAllInvocations
:
case
glslang
:
:
EOpAllInvocations
:
case
glslang
:
:
EOpAllInvocationsEqual
:
case
glslang
:
:
EOpAllInvocationsEqual
:
...
@@ -3625,7 +3646,11 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
...
@@ -3625,7 +3646,11 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
case
glslang
:
:
EOpMaxInvocationsNonUniform
:
case
glslang
:
:
EOpMaxInvocationsNonUniform
:
case
glslang
:
:
EOpAddInvocationsNonUniform
:
case
glslang
:
:
EOpAddInvocationsNonUniform
:
#endif
#endif
return
createInvocationsOperation
(
op
,
typeId
,
operand
,
typeProxy
);
{
std
::
vector
<
spv
::
Id
>
operands
;
operands
.
push_back
(
operand
);
return
createInvocationsOperation
(
op
,
typeId
,
operands
,
typeProxy
);
}
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
case
glslang
:
:
EOpMbcnt
:
case
glslang
:
:
EOpMbcnt
:
...
@@ -3959,113 +3984,149 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
...
@@ -3959,113 +3984,149 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
}
}
// Create group invocation operations.
// Create group invocation operations.
spv
::
Id
TGlslangToSpvTraverser
::
createInvocationsOperation
(
glslang
::
TOperator
op
,
spv
::
Id
typeId
,
s
pv
::
Id
operand
,
glslang
::
TBasicType
typeProxy
)
spv
::
Id
TGlslangToSpvTraverser
::
createInvocationsOperation
(
glslang
::
TOperator
op
,
spv
::
Id
typeId
,
s
td
::
vector
<
spv
::
Id
>&
operands
,
glslang
::
TBasicType
typeProxy
)
{
{
bool
isUnsigned
=
typeProxy
==
glslang
::
EbtUint
||
typeProxy
==
glslang
::
EbtUint64
;
bool
isUnsigned
=
typeProxy
==
glslang
::
EbtUint
||
typeProxy
==
glslang
::
EbtUint64
;
bool
isFloat
=
typeProxy
==
glslang
::
EbtFloat
||
typeProxy
==
glslang
::
EbtDouble
;
bool
isFloat
=
typeProxy
==
glslang
::
EbtFloat
||
typeProxy
==
glslang
::
EbtDouble
;
spv
::
Op
opCode
=
spv
::
OpNop
;
std
::
vector
<
spv
::
Id
>
spvGroupOperands
;
if
(
op
==
glslang
::
EOpBallot
||
op
==
glslang
::
EOpReadFirstInvocation
)
{
builder
.
addExtension
(
spv
::
E_SPV_KHR_shader_ballot
);
builder
.
addCapability
(
spv
::
CapabilitySubgroupBallotKHR
);
}
else
{
builder
.
addCapability
(
spv
::
CapabilityGroups
);
builder
.
addCapability
(
spv
::
CapabilityGroups
);
std
::
vector
<
spv
::
Id
>
operands
;
spvGroupOperands
.
push_back
(
builder
.
makeUintConstant
(
spv
::
ScopeSubgroup
));
operands
.
push_back
(
builder
.
makeUintConstant
(
spv
::
ScopeSubgroup
));
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
if
(
op
==
glslang
::
EOpMinInvocations
||
op
==
glslang
::
EOpMaxInvocations
||
op
==
glslang
::
EOpAddInvocations
||
if
(
op
==
glslang
::
EOpMinInvocations
||
op
==
glslang
::
EOpMaxInvocations
||
op
==
glslang
::
EOpAddInvocations
||
op
==
glslang
::
EOpMinInvocationsNonUniform
||
op
==
glslang
::
EOpMaxInvocationsNonUniform
||
op
==
glslang
::
EOpAddInvocationsNonUniform
)
op
==
glslang
::
EOpMinInvocationsNonUniform
||
op
==
glslang
::
EOpMaxInvocationsNonUniform
||
op
==
glslang
::
EOpAddInvocationsNonUniform
)
o
perands
.
push_back
(
spv
::
GroupOperationReduce
);
spvGroupO
perands
.
push_back
(
spv
::
GroupOperationReduce
);
#endif
#endif
operands
.
push_back
(
operand
);
}
for
(
auto
opIt
=
operands
.
begin
();
opIt
!=
operands
.
end
();
++
opIt
)
spvGroupOperands
.
push_back
(
*
opIt
);
switch
(
op
)
{
switch
(
op
)
{
case
glslang
:
:
EOpAnyInvocation
:
case
glslang
:
:
EOpAnyInvocation
:
opCode
=
spv
::
OpGroupAny
;
break
;
case
glslang
:
:
EOpAllInvocations
:
case
glslang
:
:
EOpAllInvocations
:
return
builder
.
createOp
(
op
==
glslang
::
EOpAnyInvocation
?
spv
::
OpGroupAny
:
spv
::
OpGroupAll
,
typeId
,
operands
)
;
opCode
=
spv
::
OpGroupAll
;
break
;
case
glslang
:
:
EOpAllInvocationsEqual
:
case
glslang
:
:
EOpAllInvocationsEqual
:
{
{
spv
::
Id
groupAll
=
builder
.
createOp
(
spv
::
OpGroupAll
,
typeId
,
o
perands
);
spv
::
Id
groupAll
=
builder
.
createOp
(
spv
::
OpGroupAll
,
typeId
,
spvGroupO
perands
);
spv
::
Id
groupAny
=
builder
.
createOp
(
spv
::
OpGroupAny
,
typeId
,
o
perands
);
spv
::
Id
groupAny
=
builder
.
createOp
(
spv
::
OpGroupAny
,
typeId
,
spvGroupO
perands
);
return
builder
.
createBinOp
(
spv
::
OpLogicalOr
,
typeId
,
groupAll
,
return
builder
.
createBinOp
(
spv
::
OpLogicalOr
,
typeId
,
groupAll
,
builder
.
createUnaryOp
(
spv
::
OpLogicalNot
,
typeId
,
groupAny
));
builder
.
createUnaryOp
(
spv
::
OpLogicalNot
,
typeId
,
groupAny
));
}
}
case
glslang
:
:
EOpReadInvocation
:
opCode
=
spv
::
OpGroupBroadcast
;
break
;
case
glslang
:
:
EOpReadFirstInvocation
:
opCode
=
spv
::
OpSubgroupFirstInvocationKHR
;
break
;
case
glslang
:
:
EOpBallot
:
{
// NOTE: According to the spec, the result type of "OpSubgroupBallotKHR" must be a 4 component vector of 32
// bit integer types. The GLSL built-in function "ballotARB()" assumes the maximum number of invocations in
// a subgroup is 64. Thus, we have to convert uvec4.xy to uint64_t as follow:
//
// result = Bitcast(SubgroupBallotKHR(Predicate).xy)
//
spv
::
Id
uintType
=
builder
.
makeUintType
(
32
);
spv
::
Id
uvec4Type
=
builder
.
makeVectorType
(
uintType
,
4
);
spv
::
Id
result
=
builder
.
createOp
(
spv
::
OpSubgroupBallotKHR
,
uvec4Type
,
spvGroupOperands
);
std
::
vector
<
spv
::
Id
>
components
;
components
.
push_back
(
builder
.
createCompositeExtract
(
result
,
uintType
,
0
));
components
.
push_back
(
builder
.
createCompositeExtract
(
result
,
uintType
,
1
));
spv
::
Id
uvec2Type
=
builder
.
makeVectorType
(
uintType
,
2
);
return
builder
.
createUnaryOp
(
spv
::
OpBitcast
,
typeId
,
builder
.
createCompositeConstruct
(
uvec2Type
,
components
));
}
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
case
glslang
:
:
EOpMinInvocations
:
case
glslang
:
:
EOpMinInvocations
:
case
glslang
:
:
EOpMaxInvocations
:
case
glslang
:
:
EOpMaxInvocations
:
case
glslang
:
:
EOpAddInvocations
:
case
glslang
:
:
EOpAddInvocations
:
{
spv
::
Op
spvOp
=
spv
::
OpNop
;
if
(
op
==
glslang
::
EOpMinInvocations
)
{
if
(
op
==
glslang
::
EOpMinInvocations
)
{
if
(
isFloat
)
if
(
isFloat
)
spvOp
=
spv
::
OpGroupFMin
;
opCode
=
spv
::
OpGroupFMin
;
else
{
else
{
if
(
isUnsigned
)
if
(
isUnsigned
)
spvOp
=
spv
::
OpGroupUMin
;
opCode
=
spv
::
OpGroupUMin
;
else
else
spvOp
=
spv
::
OpGroupSMin
;
opCode
=
spv
::
OpGroupSMin
;
}
}
}
else
if
(
op
==
glslang
::
EOpMaxInvocations
)
{
}
else
if
(
op
==
glslang
::
EOpMaxInvocations
)
{
if
(
isFloat
)
if
(
isFloat
)
spvOp
=
spv
::
OpGroupFMax
;
opCode
=
spv
::
OpGroupFMax
;
else
{
else
{
if
(
isUnsigned
)
if
(
isUnsigned
)
spvOp
=
spv
::
OpGroupUMax
;
opCode
=
spv
::
OpGroupUMax
;
else
else
spvOp
=
spv
::
OpGroupSMax
;
opCode
=
spv
::
OpGroupSMax
;
}
}
}
else
{
}
else
{
if
(
isFloat
)
if
(
isFloat
)
spvOp
=
spv
::
OpGroupFAdd
;
opCode
=
spv
::
OpGroupFAdd
;
else
else
spvOp
=
spv
::
OpGroupIAdd
;
opCode
=
spv
::
OpGroupIAdd
;
}
}
if
(
builder
.
isVectorType
(
typeId
))
if
(
builder
.
isVectorType
(
typeId
))
return
CreateInvocationsVectorOperation
(
spvOp
,
typeId
,
operand
);
return
CreateInvocationsVectorOperation
(
opCode
,
typeId
,
operands
[
0
]);
else
return
builder
.
createOp
(
spvOp
,
typeId
,
operands
);
break
;
}
case
glslang
:
:
EOpMinInvocationsNonUniform
:
case
glslang
:
:
EOpMinInvocationsNonUniform
:
case
glslang
:
:
EOpMaxInvocationsNonUniform
:
case
glslang
:
:
EOpMaxInvocationsNonUniform
:
case
glslang
:
:
EOpAddInvocationsNonUniform
:
case
glslang
:
:
EOpAddInvocationsNonUniform
:
{
spv
::
Op
spvOp
=
spv
::
OpNop
;
if
(
op
==
glslang
::
EOpMinInvocationsNonUniform
)
{
if
(
op
==
glslang
::
EOpMinInvocationsNonUniform
)
{
if
(
isFloat
)
if
(
isFloat
)
spvOp
=
spv
::
OpGroupFMinNonUniformAMD
;
opCode
=
spv
::
OpGroupFMinNonUniformAMD
;
else
{
else
{
if
(
isUnsigned
)
if
(
isUnsigned
)
spvOp
=
spv
::
OpGroupUMinNonUniformAMD
;
opCode
=
spv
::
OpGroupUMinNonUniformAMD
;
else
else
spvOp
=
spv
::
OpGroupSMinNonUniformAMD
;
opCode
=
spv
::
OpGroupSMinNonUniformAMD
;
}
}
}
}
else
if
(
op
==
glslang
::
EOpMaxInvocationsNonUniform
)
{
else
if
(
op
==
glslang
::
EOpMaxInvocationsNonUniform
)
{
if
(
isFloat
)
if
(
isFloat
)
spvOp
=
spv
::
OpGroupFMaxNonUniformAMD
;
opCode
=
spv
::
OpGroupFMaxNonUniformAMD
;
else
{
else
{
if
(
isUnsigned
)
if
(
isUnsigned
)
spvOp
=
spv
::
OpGroupUMaxNonUniformAMD
;
opCode
=
spv
::
OpGroupUMaxNonUniformAMD
;
else
else
spvOp
=
spv
::
OpGroupSMaxNonUniformAMD
;
opCode
=
spv
::
OpGroupSMaxNonUniformAMD
;
}
}
}
}
else
{
else
{
if
(
isFloat
)
if
(
isFloat
)
spvOp
=
spv
::
OpGroupFAddNonUniformAMD
;
opCode
=
spv
::
OpGroupFAddNonUniformAMD
;
else
else
spvOp
=
spv
::
OpGroupIAddNonUniformAMD
;
opCode
=
spv
::
OpGroupIAddNonUniformAMD
;
}
}
if
(
builder
.
isVectorType
(
typeId
))
if
(
builder
.
isVectorType
(
typeId
))
return
CreateInvocationsVectorOperation
(
spvOp
,
typeId
,
operand
);
return
CreateInvocationsVectorOperation
(
opCode
,
typeId
,
operands
[
0
]);
else
return
builder
.
createOp
(
spvOp
,
typeId
,
operands
);
break
;
}
#endif
#endif
default
:
default
:
logger
->
missingFunctionality
(
"invocation operation"
);
logger
->
missingFunctionality
(
"invocation operation"
);
return
spv
::
NoResult
;
return
spv
::
NoResult
;
}
}
assert
(
opCode
!=
spv
::
OpNop
);
return
builder
.
createOp
(
opCode
,
typeId
,
spvGroupOperands
);
}
}
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
...
@@ -4256,9 +4317,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
...
@@ -4256,9 +4317,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
break
;
break
;
case
glslang
:
:
EOpReadInvocation
:
case
glslang
:
:
EOpReadInvocation
:
logger
->
missingFunctionality
(
"shader ballot"
);
return
createInvocationsOperation
(
op
,
typeId
,
operands
,
typeProxy
);
libCall
=
spv
::
GLSLstd450Bad
;
break
;
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
case
glslang
:
:
EOpSwizzleInvocations
:
case
glslang
:
:
EOpSwizzleInvocations
:
...
@@ -4825,7 +4884,7 @@ spv::Id TGlslangToSpvTraverser::getExtBuiltins(const char* name)
...
@@ -4825,7 +4884,7 @@ spv::Id TGlslangToSpvTraverser::getExtBuiltins(const char* name)
if
(
extBuiltinMap
.
find
(
name
)
!=
extBuiltinMap
.
end
())
if
(
extBuiltinMap
.
find
(
name
)
!=
extBuiltinMap
.
end
())
return
extBuiltinMap
[
name
];
return
extBuiltinMap
[
name
];
else
{
else
{
builder
.
addExtension
s
(
name
);
builder
.
addExtension
(
name
);
spv
::
Id
extBuiltins
=
builder
.
import
(
name
);
spv
::
Id
extBuiltins
=
builder
.
import
(
name
);
extBuiltinMap
[
name
]
=
extBuiltins
;
extBuiltinMap
[
name
]
=
extBuiltins
;
return
extBuiltins
;
return
extBuiltins
;
...
...
SPIRV/SpvBuilder.cpp
View file @
02df206c
...
@@ -2318,9 +2318,9 @@ void Builder::dump(std::vector<unsigned int>& out) const
...
@@ -2318,9 +2318,9 @@ void Builder::dump(std::vector<unsigned int>& out) const
capInst
.
dump
(
out
);
capInst
.
dump
(
out
);
}
}
for
(
int
e
=
0
;
e
<
(
int
)
extensions
.
size
();
++
e
)
{
for
(
auto
it
=
extensions
.
cbegin
();
it
!=
extensions
.
cend
();
++
it
)
{
Instruction
extInst
(
0
,
0
,
OpExtension
);
Instruction
extInst
(
0
,
0
,
OpExtension
);
extInst
.
addStringOperand
(
extensions
[
e
]
);
extInst
.
addStringOperand
(
*
it
);
extInst
.
dump
(
out
);
extInst
.
dump
(
out
);
}
}
...
...
SPIRV/SpvBuilder.h
View file @
02df206c
...
@@ -71,7 +71,7 @@ public:
...
@@ -71,7 +71,7 @@ public:
sourceVersion
=
version
;
sourceVersion
=
version
;
}
}
void
addSourceExtension
(
const
char
*
ext
)
{
sourceExtensions
.
push_back
(
ext
);
}
void
addSourceExtension
(
const
char
*
ext
)
{
sourceExtensions
.
push_back
(
ext
);
}
void
addExtension
s
(
const
char
*
ext
)
{
extensions
.
push_back
(
ext
);
}
void
addExtension
(
const
char
*
ext
)
{
extensions
.
insert
(
ext
);
}
Id
import
(
const
char
*
);
Id
import
(
const
char
*
);
void
setMemoryModel
(
spv
::
AddressingModel
addr
,
spv
::
MemoryModel
mem
)
void
setMemoryModel
(
spv
::
AddressingModel
addr
,
spv
::
MemoryModel
mem
)
{
{
...
@@ -552,7 +552,7 @@ public:
...
@@ -552,7 +552,7 @@ public:
SourceLanguage
source
;
SourceLanguage
source
;
int
sourceVersion
;
int
sourceVersion
;
std
::
vector
<
const
char
*>
extensions
;
std
::
set
<
const
char
*>
extensions
;
std
::
vector
<
const
char
*>
sourceExtensions
;
std
::
vector
<
const
char
*>
sourceExtensions
;
AddressingModel
addressModel
;
AddressingModel
addressModel
;
MemoryModel
memoryModel
;
MemoryModel
memoryModel
;
...
...
SPIRV/doc.cpp
View file @
02df206c
...
@@ -45,14 +45,15 @@
...
@@ -45,14 +45,15 @@
#include <cstring>
#include <cstring>
#include <algorithm>
#include <algorithm>
#ifdef AMD_EXTENSIONS
namespace
spv
{
namespace
spv
{
extern
"C"
{
extern
"C"
{
// Include C-based headers that don't have a namespace
// Include C-based headers that don't have a namespace
#include "GLSL.ext.KHR.h"
#ifdef AMD_EXTENSIONS
#include "GLSL.ext.AMD.h"
#include "GLSL.ext.AMD.h"
#endif
}
}
}
}
#endif
namespace
spv
{
namespace
spv
{
...
@@ -312,6 +313,12 @@ const char* BuiltInString(int builtIn)
...
@@ -312,6 +313,12 @@ const char* BuiltInString(int builtIn)
case
BuiltInCeiling
:
case
BuiltInCeiling
:
default:
return
"Bad"
;
default:
return
"Bad"
;
case
4416
:
return
"SubgroupEqMaskKHR"
;
case
4417
:
return
"SubgroupGeMaskKHR"
;
case
4418
:
return
"SubgroupGtMaskKHR"
;
case
4419
:
return
"SubgroupLeMaskKHR"
;
case
4420
:
return
"SubgroupLtMaskKHR"
;
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
case
4992
:
return
"BaryCoordNoPerspAMD"
;
case
4992
:
return
"BaryCoordNoPerspAMD"
;
case
4993
:
return
"BaryCoordNoPerspCentroidAMD"
;
case
4993
:
return
"BaryCoordNoPerspCentroidAMD"
;
...
@@ -799,6 +806,8 @@ const char* CapabilityString(int info)
...
@@ -799,6 +806,8 @@ const char* CapabilityString(int info)
case
CapabilityCeiling
:
case
CapabilityCeiling
:
default:
return
"Bad"
;
default:
return
"Bad"
;
case
4423
:
return
"SubgroupBallotKHR"
;
}
}
}
}
...
@@ -1131,6 +1140,9 @@ const char* OpcodeString(int op)
...
@@ -1131,6 +1140,9 @@ const char* OpcodeString(int op)
default:
default:
return
"Bad"
;
return
"Bad"
;
case
4421
:
return
"OpSubgroupBallotKHR"
;
case
4422
:
return
"OpSubgroupFirstInvocationKHR"
;
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
case
5000
:
return
"OpGroupIAddNonUniformAMD"
;
case
5000
:
return
"OpGroupIAddNonUniformAMD"
;
case
5001
:
return
"OpGroupFAddNonUniformAMD"
;
case
5001
:
return
"OpGroupFAddNonUniformAMD"
;
...
@@ -1146,11 +1158,7 @@ const char* OpcodeString(int op)
...
@@ -1146,11 +1158,7 @@ const char* OpcodeString(int op)
// The set of objects that hold all the instruction/operand
// The set of objects that hold all the instruction/operand
// parameterization information.
// parameterization information.
#ifdef AMD_EXTENSIONS
InstructionParameters
InstructionDesc
[
OpCodeMask
+
1
];
InstructionParameters
InstructionDesc
[
OpCodeMask
+
1
];
#else
InstructionParameters
InstructionDesc
[
OpcodeCeiling
];
#endif
OperandParameters
ExecutionModeOperands
[
ExecutionModeCeiling
];
OperandParameters
ExecutionModeOperands
[
ExecutionModeCeiling
];
OperandParameters
DecorationOperands
[
DecorationCeiling
];
OperandParameters
DecorationOperands
[
DecorationCeiling
];
...
@@ -2742,6 +2750,10 @@ void Parameterize()
...
@@ -2742,6 +2750,10 @@ void Parameterize()
InstructionDesc
[
OpEnqueueMarker
].
operands
.
push
(
OperandId
,
"'Wait Events'"
);
InstructionDesc
[
OpEnqueueMarker
].
operands
.
push
(
OperandId
,
"'Wait Events'"
);
InstructionDesc
[
OpEnqueueMarker
].
operands
.
push
(
OperandId
,
"'Ret Event'"
);
InstructionDesc
[
OpEnqueueMarker
].
operands
.
push
(
OperandId
,
"'Ret Event'"
);
InstructionDesc
[
OpSubgroupBallotKHR
].
operands
.
push
(
OperandId
,
"'Predicate'"
);
InstructionDesc
[
OpSubgroupFirstInvocationKHR
].
operands
.
push
(
OperandId
,
"'Value'"
);
#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'"
);
...
...
Test/baseResults/spv.shaderBallot.comp.out
View file @
02df206c
...
@@ -5,16 +5,18 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -5,16 +5,18 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Linked compute stage:
Linked compute stage:
Missing functionality: shader ballot
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by 24
1
// Id's are bound by 24
5
Capability Shader
Capability Shader
Capability Int64
Capability Int64
Capability Groups
Capability SubgroupBallotKHR
Extension "SPV_KHR_shader_ballot"
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 10
22 24 27 30 33
EntryPoint GLCompute 4 "main" 10
12 21 23 26 29 32
ExecutionMode 4 LocalSize 8 8 1
ExecutionMode 4 LocalSize 8 8 1
Source GLSL 450
Source GLSL 450
SourceExtension "GL_ARB_gpu_shader_int64"
SourceExtension "GL_ARB_gpu_shader_int64"
...
@@ -22,293 +24,304 @@ Missing functionality: shader ballot
...
@@ -22,293 +24,304 @@ Missing functionality: shader ballot
Name 4 "main"
Name 4 "main"
Name 8 "invocation"
Name 8 "invocation"
Name 10 "gl_SubGroupInvocationARB"
Name 10 "gl_SubGroupInvocationARB"
Name 13 "gl_SubGroupSizeARB"
Name 12 "gl_SubGroupSizeARB"
Name 20 "relMask"
Name 19 "relMask"
Name 22 "gl_SubGroupEqMaskARB"
Name 21 "gl_SubGroupEqMaskARB"
Name 24 "gl_SubGroupGeMaskARB"
Name 23 "gl_SubGroupGeMaskARB"
Name 27 "gl_SubGroupGtMaskARB"
Name 26 "gl_SubGroupGtMaskARB"
Name 30 "gl_SubGroupLeMaskARB"
Name 29 "gl_SubGroupLeMaskARB"
Name 33 "gl_SubGroupLtMaskARB"
Name 32 "gl_SubGroupLtMaskARB"
Name 48 "Buffers"
Name 52 "Buffers"
MemberName 48(Buffers) 0 "f4"
MemberName 52(Buffers) 0 "f4"
MemberName 48(Buffers) 1 "i4"
MemberName 52(Buffers) 1 "i4"
MemberName 48(Buffers) 2 "u4"
MemberName 52(Buffers) 2 "u4"
Name 51 "data"
Name 55 "data"
MemberDecorate 48(Buffers) 0 Offset 0
Decorate 10(gl_SubGroupInvocationARB) BuiltIn SubgroupLocalInvocationId
MemberDecorate 48(Buffers) 1 Offset 16
Decorate 12(gl_SubGroupSizeARB) BuiltIn SubgroupSize
MemberDecorate 48(Buffers) 2 Offset 32
Decorate 21(gl_SubGroupEqMaskARB) BuiltIn SubgroupEqMaskKHR
Decorate 48(Buffers) BufferBlock
Decorate 23(gl_SubGroupGeMaskARB) BuiltIn SubgroupGeMaskKHR
Decorate 51(data) DescriptorSet 0
Decorate 26(gl_SubGroupGtMaskARB) BuiltIn SubgroupGtMaskKHR
Decorate 51(data) Binding 0
Decorate 29(gl_SubGroupLeMaskARB) BuiltIn SubgroupLeMaskKHR
Decorate 240 BuiltIn WorkgroupSize
Decorate 32(gl_SubGroupLtMaskARB) BuiltIn SubgroupLtMaskKHR
MemberDecorate 52(Buffers) 0 Offset 0
MemberDecorate 52(Buffers) 1 Offset 16
MemberDecorate 52(Buffers) 2 Offset 32
Decorate 52(Buffers) BufferBlock
Decorate 55(data) DescriptorSet 0
Decorate 55(data) Binding 0
Decorate 244 BuiltIn WorkgroupSize
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeInt 32 0
6: TypeInt 32 0
7: TypePointer Function 6(int)
7: TypePointer Function 6(int)
9: TypePointer Input 6(int)
9: TypePointer Input 6(int)
10(gl_SubGroupInvocationARB): 9(ptr) Variable Input
10(gl_SubGroupInvocationARB): 9(ptr) Variable Input
12: TypePointer UniformConstant 6(int)
12(gl_SubGroupSizeARB): 9(ptr) Variable Input
13(gl_SubGroupSizeARB): 12(ptr) Variable UniformConstant
15: 6(int) Constant 4
1
6: 6(int) Constant 4
1
7: TypeInt 64 0
18: Type
Int 64 0
18: Type
Pointer Function 17(int)
19: TypePointer Function 18
(int)
20: TypePointer Input 17
(int)
21: TypePointer Input 18(int)
21(gl_SubGroupEqMaskARB): 20(ptr) Variable Input
2
2(gl_SubGroupEqMaskARB): 21
(ptr) Variable Input
2
3(gl_SubGroupGeMaskARB): 20
(ptr) Variable Input
2
4(gl_SubGroupGeMaskARB): 21
(ptr) Variable Input
2
6(gl_SubGroupGtMaskARB): 20
(ptr) Variable Input
2
7(gl_SubGroupGtMaskARB): 21
(ptr) Variable Input
2
9(gl_SubGroupLeMaskARB): 20
(ptr) Variable Input
3
0(gl_SubGroupLeMaskARB): 21
(ptr) Variable Input
3
2(gl_SubGroupLtMaskARB): 20
(ptr) Variable Input
33(gl_SubGroupLtMaskARB): 21(ptr) Variable Input
36: TypeBool
37:
TypeBool
37:
36(bool) ConstantTrue
38:
37(bool) ConstantTrue
38:
TypeVector 6(int) 4
4
3: TypeFloat 3
2
4
2: TypeVector 6(int)
2
4
4: TypeVector 43(float) 4
4
8: TypeFloat 32
4
5: TypeInt 32 1
4
9: TypeVector 48(float) 4
46: TypeVector 45(int) 4
50: TypeInt 32 1
47: TypeVector 6
(int) 4
51: TypeVector 50
(int) 4
48(Buffers): TypeStruct 44(fvec4) 46(ivec4) 47
(ivec4)
52(Buffers): TypeStruct 49(fvec4) 51(ivec4) 38
(ivec4)
49: TypeArray 48(Buffers) 16
53: TypeArray 52(Buffers) 15
5
0: TypePointer Uniform 49
5
4: TypePointer Uniform 53
5
1(data): 50
(ptr) Variable Uniform
5
5(data): 54
(ptr) Variable Uniform
5
3: 45
(int) Constant 0
5
7: 50
(int) Constant 0
5
4
: 6(int) Constant 0
5
8
: 6(int) Constant 0
5
5: TypePointer Uniform 43
(float)
5
9: TypePointer Uniform 48
(float)
6
2: 45(int) Constant 1
6
3: 6(int) Constant 3
6
3: TypeVector 43(float) 2
6
7: 50(int) Constant 1
6
4: TypePointer Uniform 44(fvec4)
6
8: TypeVector 48(float) 2
74: 45(int) Constant 2
69: TypePointer Uniform 49(fvec4)
7
5: TypeVector 43(float) 3
7
9: 50(int) Constant 2
8
5: 45(int) Constant
3
8
0: TypeVector 48(float)
3
9
2: TypePointer Uniform 45(int)
9
0: 50(int) Constant 3
9
9: TypeVector 45(int) 2
9
7: TypePointer Uniform 50(int)
10
0: TypePointer Uniform 46(ivec4)
10
4: TypeVector 50(int) 2
1
10: TypeVector 45(int) 3
1
05: TypePointer Uniform 51(ivec4)
1
26: TypePointer Uniform 6(int)
1
15: TypeVector 50(int) 3
13
3: TypeVector 6(int) 2
13
1: TypePointer Uniform 6(int)
13
4: TypePointer Uniform 47
(ivec4)
13
8: TypePointer Uniform 38
(ivec4)
14
4
: TypeVector 6(int) 3
14
8
: TypeVector 6(int) 3
2
38
: 6(int) Constant 8
2
42
: 6(int) Constant 8
2
39
: 6(int) Constant 1
2
43
: 6(int) Constant 1
24
0: 144(ivec3) ConstantComposite 238 238 239
24
4: 148(ivec3) ConstantComposite 242 242 243
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
8(invocation): 7(ptr) Variable Function
8(invocation): 7(ptr) Variable Function
20(relMask): 19
(ptr) Variable Function
19(relMask): 18
(ptr) Variable Function
11: 6(int) Load 10(gl_SubGroupInvocationARB)
11: 6(int) Load 10(gl_SubGroupInvocationARB)
14: 6(int) Load 13(gl_SubGroupSizeARB)
13: 6(int) Load 12(gl_SubGroupSizeARB)
15: 6(int) IAdd 11 14
14: 6(int) IAdd 11 13
17: 6(int) UMod 15 16
16: 6(int) UMod 14 15
Store 8(invocation) 17
Store 8(invocation) 16
23: 18(int) Load 22(gl_SubGroupEqMaskARB)
22: 17(int) Load 21(gl_SubGroupEqMaskARB)
25: 18(int) Load 24(gl_SubGroupGeMaskARB)
24: 17(int) Load 23(gl_SubGroupGeMaskARB)
26: 18(int) IAdd 23 25
25: 17(int) IAdd 22 24
28: 18(int) Load 27(gl_SubGroupGtMaskARB)
27: 17(int) Load 26(gl_SubGroupGtMaskARB)
29: 18(int) IAdd 26 28
28: 17(int) IAdd 25 27
31: 18(int) Load 30(gl_SubGroupLeMaskARB)
30: 17(int) Load 29(gl_SubGroupLeMaskARB)
32: 18(int) IAdd 29 31
31: 17(int) IAdd 28 30
34: 18(int) Load 33(gl_SubGroupLtMaskARB)
33: 17(int) Load 32(gl_SubGroupLtMaskARB)
35: 18(int) IAdd 32 34
34: 17(int) IAdd 31 33
Store 20(relMask) 35
Store 19(relMask) 34
36: 18(int) Load 20(relMask)
35: 17(int) Load 19(relMask)
39: 18(int) ExtInst 1(GLSL.std.450) 0(Unknown) 38
39: 38(ivec4) SubgroupBallotKHR 37
40: 37(bool) IEqual 36 39
40: 6(int) CompositeExtract 39 0
SelectionMerge 42 None
41: 6(int) CompositeExtract 39 1
BranchConditional 40 41 159
43: 42(ivec2) CompositeConstruct 40 41
41: Label
44: 17(int) Bitcast 43
52: 6(int) Load 8(invocation)
45: 36(bool) IEqual 35 44
56: 55(ptr) AccessChain 51(data) 53 53 54
SelectionMerge 47 None
57: 43(float) Load 56
BranchConditional 45 46 163
58: 6(int) Load 8(invocation)
46: Label
59: 43(float) ExtInst 1(GLSL.std.450) 0(Unknown) 57 58
56: 6(int) Load 8(invocation)
60: 55(ptr) AccessChain 51(data) 52 53 54
60: 59(ptr) AccessChain 55(data) 57 57 58
Store 60 59
61: 48(float) Load 60
61: 6(int) Load 8(invocation)
62: 6(int) Load 8(invocation)
65: 64(ptr) AccessChain 51(data) 62 53
64: 48(float) GroupBroadcast 63 61 62
66: 44(fvec4) Load 65
65: 59(ptr) AccessChain 55(data) 56 57 58
67: 63(fvec2) VectorShuffle 66 66 0 1
Store 65 64
68: 6(int) Load 8(invocation)
66: 6(int) Load 8(invocation)
69: 63(fvec2) ExtInst 1(GLSL.std.450) 0(Unknown) 67 68
70: 69(ptr) AccessChain 55(data) 67 57
70: 64(ptr) AccessChain 51(data) 61 53
71: 49(fvec4) Load 70
71: 44(fvec4) Load 70
72: 68(fvec2) VectorShuffle 71 71 0 1
72: 44(fvec4) VectorShuffle 71 69 4 5 2 3
Store 70 72
73: 6(int) Load 8(invocation)
73: 6(int) Load 8(invocation)
7
6: 64(ptr) AccessChain 51(data) 74 5
3
7
4: 68(fvec2) GroupBroadcast 63 72 7
3
7
7: 44(fvec4) Load 76
7
5: 69(ptr) AccessChain 55(data) 66 57
7
8: 75(fvec3) VectorShuffle 77 77 0 1 2
7
6: 49(fvec4) Load 75
7
9: 6(int) Load 8(invocation)
7
7: 49(fvec4) VectorShuffle 76 74 4 5 2 3
80: 75(fvec3) ExtInst 1(GLSL.std.450) 0(Unknown) 78 79
Store 75 77
81: 64(ptr) AccessChain 51(data) 73 53
78: 6(int) Load 8(invocation)
8
2: 44(fvec4) Load 81
8
1: 69(ptr) AccessChain 55(data) 79 57
8
3: 44(fvec4) VectorShuffle 82 80 4 5 6 3
8
2: 49(fvec4) Load 81
Store 81 83
83: 80(fvec3) VectorShuffle 82 82 0 1 2
84: 6(int) Load 8(invocation)
84: 6(int) Load 8(invocation)
8
6: 64(ptr) AccessChain 51(data) 85 53
8
5: 80(fvec3) GroupBroadcast 63 83 84
8
7: 44(fvec4) Load 86
8
6: 69(ptr) AccessChain 55(data) 78 57
8
8: 6(int) Load 8(invocation)
8
7: 49(fvec4) Load 86
8
9: 44(fvec4) ExtInst 1(GLSL.std.450) 0(Unknown) 87 88
8
8: 49(fvec4) VectorShuffle 87 85 4 5 6 3
90: 64(ptr) AccessChain 51(data) 84 53
Store 86 88
Store 90 89
89: 6(int) Load 8(invocation)
91:
6(int) Load 8(invocation)
91:
69(ptr) AccessChain 55(data) 90 57
9
3: 92(ptr) AccessChain 51(data) 53 62 54
9
2: 49(fvec4) Load 91
9
4: 45(int) Load 93
9
3: 6(int) Load 8(invocation)
9
5: 6(int) Load 8(invocation)
9
4: 49(fvec4) GroupBroadcast 63 92 93
9
6: 45(int) ExtInst 1(GLSL.std.450) 0(Unknown) 94 95
9
5: 69(ptr) AccessChain 55(data) 89 57
97: 92(ptr) AccessChain 51(data) 91 62 5
4
Store 95 9
4
Store 97 96
96: 6(int) Load 8(invocation)
98:
6(int) Load 8(invocation)
98:
97(ptr) AccessChain 55(data) 57 67 58
101: 100(ptr) AccessChain 51(data) 62 62
99: 50(int) Load 98
10
2: 46(ivec4) Load 101
10
0: 6(int) Load 8(invocation)
10
3: 99(ivec2) VectorShuffle 102 102 0 1
10
1: 50(int) GroupBroadcast 63 99 100
10
4: 6(int) Load 8(invocation)
10
2: 97(ptr) AccessChain 55(data) 96 67 58
105: 99(ivec2) ExtInst 1(GLSL.std.450) 0(Unknown) 103 104
Store 102 101
10
6: 100(ptr) AccessChain 51(data) 98 62
10
3: 6(int) Load 8(invocation)
10
7: 46(ivec4) Load 106
10
6: 105(ptr) AccessChain 55(data) 67 67
10
8: 46(ivec4) VectorShuffle 107 105 4 5 2 3
10
7: 51(ivec4) Load 106
Store 106 108
108: 104(ivec2) VectorShuffle 107 107 0 1
109: 6(int) Load 8(invocation)
109: 6(int) Load 8(invocation)
111: 100(ptr) AccessChain 51(data) 74 62
110: 104(ivec2) GroupBroadcast 63 108 109
112: 46(ivec4) Load 111
111: 105(ptr) AccessChain 55(data) 103 67
113: 110(ivec3) VectorShuffle 112 112 0 1 2
112: 51(ivec4) Load 111
113: 51(ivec4) VectorShuffle 112 110 4 5 2 3
Store 111 113
114: 6(int) Load 8(invocation)
114: 6(int) Load 8(invocation)
115: 110(ivec3) ExtInst 1(GLSL.std.450) 0(Unknown) 113 114
116: 105(ptr) AccessChain 55(data) 79 67
116: 100(ptr) AccessChain 51(data) 109 62
117: 51(ivec4) Load 116
117: 46(ivec4) Load 116
118: 115(ivec3) VectorShuffle 117 117 0 1 2
118: 46(ivec4) VectorShuffle 117 115 4 5 6 3
Store 116 118
119: 6(int) Load 8(invocation)
119: 6(int) Load 8(invocation)
120:
100(ptr) AccessChain 51(data) 85 62
120:
115(ivec3) GroupBroadcast 63 118 119
121:
46(ivec4) Load 120
121:
105(ptr) AccessChain 55(data) 114 67
122:
6(int) Load 8(invocation)
122:
51(ivec4) Load 121
123:
46(ivec4) ExtInst 1(GLSL.std.450) 0(Unknown) 121 122
123:
51(ivec4) VectorShuffle 122 120 4 5 6 3
124: 100(ptr) AccessChain 51(data) 119 62
Store 121 123
Store 124 123
124: 6(int) Load 8(invocation)
125:
6(int) Load 8(invocation)
125:
105(ptr) AccessChain 55(data) 90 67
12
7: 126(ptr) AccessChain 51(data) 53 74 54
12
6: 51(ivec4) Load 125
12
8: 6(int) Load 127
12
7: 6(int) Load 8(invocation)
12
9: 6(int) Load 8(invocation)
12
8: 51(ivec4) GroupBroadcast 63 126 127
1
30: 6(int) ExtInst 1(GLSL.std.450) 0(Unknown) 128 129
1
29: 105(ptr) AccessChain 55(data) 124 67
131: 126(ptr) AccessChain 51(data) 125 74 54
Store 129 128
Store 131 130
130: 6(int) Load 8(invocation)
132:
6(int) Load 8(invocation)
132:
131(ptr) AccessChain 55(data) 57 79 58
13
5: 134(ptr) AccessChain 51(data) 62 74
13
3: 6(int) Load 132
13
6: 47(ivec4) Load 135
13
4: 6(int) Load 8(invocation)
13
7: 133(ivec2) VectorShuffle 136 136 0 1
13
5: 6(int) GroupBroadcast 63 133 134
13
8: 6(int) Load 8(invocation)
13
6: 131(ptr) AccessChain 55(data) 130 79 58
139: 133(ivec2) ExtInst 1(GLSL.std.450) 0(Unknown) 137 138
Store 136 135
1
40: 134(ptr) AccessChain 51(data) 132 74
1
37: 6(int) Load 8(invocation)
1
41: 47(ivec4) Load 140
1
39: 138(ptr) AccessChain 55(data) 67 79
14
2: 47(ivec4) VectorShuffle 141 139 4 5 2 3
14
0: 38(ivec4) Load 139
Store 140 142
141: 42(ivec2) VectorShuffle 140 140 0 1
14
3
: 6(int) Load 8(invocation)
14
2
: 6(int) Load 8(invocation)
14
5: 134(ptr) AccessChain 51(data) 74 74
14
3: 42(ivec2) GroupBroadcast 63 141 142
14
6: 47(ivec4) Load 145
14
4: 138(ptr) AccessChain 55(data) 137 79
14
7: 144(ivec3) VectorShuffle 146 146 0 1 2
14
5: 38(ivec4) Load 144
14
8: 6(int) Load 8(invocation)
14
6: 38(ivec4) VectorShuffle 145 143 4 5 2 3
149: 144(ivec3) ExtInst 1(GLSL.std.450) 0(Unknown) 147 148
Store 144 146
1
50: 134(ptr) AccessChain 51(data) 143 74
1
47: 6(int) Load 8(invocation)
1
51: 47(ivec4) Load 150
1
49: 138(ptr) AccessChain 55(data) 79 79
15
2: 47(ivec4) VectorShuffle 151 149 4 5 6 3
15
0: 38(ivec4) Load 149
Store 150 15
2
151: 148(ivec3) VectorShuffle 150 150 0 1
2
15
3
: 6(int) Load 8(invocation)
15
2
: 6(int) Load 8(invocation)
15
4: 134(ptr) AccessChain 51(data) 85 74
15
3: 148(ivec3) GroupBroadcast 63 151 152
15
5: 47(ivec4) Load 154
15
4: 138(ptr) AccessChain 55(data) 147 79
15
6: 6(int) Load 8(invocation)
15
5: 38(ivec4) Load 154
15
7: 47(ivec4) ExtInst 1(GLSL.std.450) 0(Unknown) 155 156
15
6: 38(ivec4) VectorShuffle 155 153 4 5 6 3
158: 134(ptr) AccessChain 51(data) 153 74
Store 154 156
Store 158 157
157: 6(int) Load 8(invocation)
Branch 42
158: 138(ptr) AccessChain 55(data) 90 79
159:
Label
159:
38(ivec4) Load 158
160: 6(int) Load 8(invocation)
160: 6(int) Load 8(invocation)
161: 55(ptr) AccessChain 51(data) 53 53 54
161: 38(ivec4) GroupBroadcast 63 159 160
162: 43(float) Load 161
162: 138(ptr) AccessChain 55(data) 157 79
163: 43(float) ExtInst 1(GLSL.std.450) 0(Unknown) 162
Store 162 161
164: 55(ptr) AccessChain 51(data) 160 53 54
Branch 47
Store 164 163
163: Label
165: 6(int) Load 8(invocation)
164: 6(int) Load 8(invocation)
166: 64(ptr) AccessChain 51(data) 62 53
165: 59(ptr) AccessChain 55(data) 57 57 58
167: 44(fvec4) Load 166
166: 48(float) Load 165
168: 63(fvec2) VectorShuffle 167 167 0 1
167: 48(float) SubgroupFirstInvocationKHR 166
169: 63(fvec2) ExtInst 1(GLSL.std.450) 0(Unknown) 168
168: 59(ptr) AccessChain 55(data) 164 57 58
170: 64(ptr) AccessChain 51(data) 165 53
Store 168 167
171: 44(fvec4) Load 170
169: 6(int) Load 8(invocation)
172: 44(fvec4) VectorShuffle 171 169 4 5 2 3
170: 69(ptr) AccessChain 55(data) 67 57
Store 170 172
171: 49(fvec4) Load 170
173: 6(int) Load 8(invocation)
172: 68(fvec2) VectorShuffle 171 171 0 1
174: 64(ptr) AccessChain 51(data) 74 53
173: 68(fvec2) SubgroupFirstInvocationKHR 172
175: 44(fvec4) Load 174
174: 69(ptr) AccessChain 55(data) 169 57
176: 75(fvec3) VectorShuffle 175 175 0 1 2
175: 49(fvec4) Load 174
177: 75(fvec3) ExtInst 1(GLSL.std.450) 0(Unknown) 176
176: 49(fvec4) VectorShuffle 175 173 4 5 2 3
178: 64(ptr) AccessChain 51(data) 173 53
Store 174 176
179: 44(fvec4) Load 178
177: 6(int) Load 8(invocation)
180: 44(fvec4) VectorShuffle 179 177 4 5 6 3
178: 69(ptr) AccessChain 55(data) 79 57
Store 178 180
179: 49(fvec4) Load 178
181: 6(int) Load 8(invocation)
180: 80(fvec3) VectorShuffle 179 179 0 1 2
182: 64(ptr) AccessChain 51(data) 85 53
181: 80(fvec3) SubgroupFirstInvocationKHR 180
183: 44(fvec4) Load 182
182: 69(ptr) AccessChain 55(data) 177 57
184: 44(fvec4) ExtInst 1(GLSL.std.450) 0(Unknown) 183
183: 49(fvec4) Load 182
185: 64(ptr) AccessChain 51(data) 181 53
184: 49(fvec4) VectorShuffle 183 181 4 5 6 3
Store 185 184
Store 182 184
186: 6(int) Load 8(invocation)
185: 6(int) Load 8(invocation)
187: 92(ptr) AccessChain 51(data) 53 62 54
186: 69(ptr) AccessChain 55(data) 90 57
188: 45(int) Load 187
187: 49(fvec4) Load 186
189: 45(int) ExtInst 1(GLSL.std.450) 0(Unknown) 188
188: 49(fvec4) SubgroupFirstInvocationKHR 187
190: 92(ptr) AccessChain 51(data) 186 62 54
189: 69(ptr) AccessChain 55(data) 185 57
Store 190 189
Store 189 188
191: 6(int) Load 8(invocation)
190: 6(int) Load 8(invocation)
192: 100(ptr) AccessChain 51(data) 62 62
191: 97(ptr) AccessChain 55(data) 57 67 58
193: 46(ivec4) Load 192
192: 50(int) Load 191
194: 99(ivec2) VectorShuffle 193 193 0 1
193: 50(int) SubgroupFirstInvocationKHR 192
195: 99(ivec2) ExtInst 1(GLSL.std.450) 0(Unknown) 194
194: 97(ptr) AccessChain 55(data) 190 67 58
196: 100(ptr) AccessChain 51(data) 191 62
Store 194 193
197: 46(ivec4) Load 196
195: 6(int) Load 8(invocation)
198: 46(ivec4) VectorShuffle 197 195 4 5 2 3
196: 105(ptr) AccessChain 55(data) 67 67
Store 196 198
197: 51(ivec4) Load 196
199: 6(int) Load 8(invocation)
198: 104(ivec2) VectorShuffle 197 197 0 1
200: 100(ptr) AccessChain 51(data) 74 62
199: 104(ivec2) SubgroupFirstInvocationKHR 198
201: 46(ivec4) Load 200
200: 105(ptr) AccessChain 55(data) 195 67
202: 110(ivec3) VectorShuffle 201 201 0 1 2
201: 51(ivec4) Load 200
203: 110(ivec3) ExtInst 1(GLSL.std.450) 0(Unknown) 202
202: 51(ivec4) VectorShuffle 201 199 4 5 2 3
204: 100(ptr) AccessChain 51(data) 199 62
Store 200 202
205: 46(ivec4) Load 204
203: 6(int) Load 8(invocation)
206: 46(ivec4) VectorShuffle 205 203 4 5 6 3
204: 105(ptr) AccessChain 55(data) 79 67
Store 204 206
205: 51(ivec4) Load 204
207: 6(int) Load 8(invocation)
206: 115(ivec3) VectorShuffle 205 205 0 1 2
208: 100(ptr) AccessChain 51(data) 85 62
207: 115(ivec3) SubgroupFirstInvocationKHR 206
209: 46(ivec4) Load 208
208: 105(ptr) AccessChain 55(data) 203 67
210: 46(ivec4) ExtInst 1(GLSL.std.450) 0(Unknown) 209
209: 51(ivec4) Load 208
211: 100(ptr) AccessChain 51(data) 207 62
210: 51(ivec4) VectorShuffle 209 207 4 5 6 3
Store 211 210
Store 208 210
212: 6(int) Load 8(invocation)
211: 6(int) Load 8(invocation)
213: 126(ptr) AccessChain 51(data) 53 74 54
212: 105(ptr) AccessChain 55(data) 90 67
214: 6(int) Load 213
213: 51(ivec4) Load 212
215: 6(int) ExtInst 1(GLSL.std.450) 0(Unknown) 214
214: 51(ivec4) SubgroupFirstInvocationKHR 213
216: 126(ptr) AccessChain 51(data) 212 74 54
215: 105(ptr) AccessChain 55(data) 211 67
Store 216 215
Store 215 214
217: 6(int) Load 8(invocation)
216: 6(int) Load 8(invocation)
218: 134(ptr) AccessChain 51(data) 62 74
217: 131(ptr) AccessChain 55(data) 57 79 58
219: 47(ivec4) Load 218
218: 6(int) Load 217
220: 133(ivec2) VectorShuffle 219 219 0 1
219: 6(int) SubgroupFirstInvocationKHR 218
221: 133(ivec2) ExtInst 1(GLSL.std.450) 0(Unknown) 220
220: 131(ptr) AccessChain 55(data) 216 79 58
222: 134(ptr) AccessChain 51(data) 217 74
Store 220 219
223: 47(ivec4) Load 222
221: 6(int) Load 8(invocation)
224: 47(ivec4) VectorShuffle 223 221 4 5 2 3
222: 138(ptr) AccessChain 55(data) 67 79
Store 222 224
223: 38(ivec4) Load 222
225: 6(int) Load 8(invocation)
224: 42(ivec2) VectorShuffle 223 223 0 1
226: 134(ptr) AccessChain 51(data) 74 74
225: 42(ivec2) SubgroupFirstInvocationKHR 224
227: 47(ivec4) Load 226
226: 138(ptr) AccessChain 55(data) 221 79
228: 144(ivec3) VectorShuffle 227 227 0 1 2
227: 38(ivec4) Load 226
229: 144(ivec3) ExtInst 1(GLSL.std.450) 0(Unknown) 228
228: 38(ivec4) VectorShuffle 227 225 4 5 2 3
230: 134(ptr) AccessChain 51(data) 225 74
Store 226 228
231: 47(ivec4) Load 230
229: 6(int) Load 8(invocation)
232: 47(ivec4) VectorShuffle 231 229 4 5 6 3
230: 138(ptr) AccessChain 55(data) 79 79
Store 230 232
231: 38(ivec4) Load 230
233: 6(int) Load 8(invocation)
232: 148(ivec3) VectorShuffle 231 231 0 1 2
234: 134(ptr) AccessChain 51(data) 85 74
233: 148(ivec3) SubgroupFirstInvocationKHR 232
235: 47(ivec4) Load 234
234: 138(ptr) AccessChain 55(data) 229 79
236: 47(ivec4) ExtInst 1(GLSL.std.450) 0(Unknown) 235
235: 38(ivec4) Load 234
237: 134(ptr) AccessChain 51(data) 233 74
236: 38(ivec4) VectorShuffle 235 233 4 5 6 3
Store 237 236
Store 234 236
Branch 42
237: 6(int) Load 8(invocation)
42: Label
238: 138(ptr) AccessChain 55(data) 90 79
239: 38(ivec4) Load 238
240: 38(ivec4) SubgroupFirstInvocationKHR 239
241: 138(ptr) AccessChain 55(data) 237 79
Store 241 240
Branch 47
47: Label
Return
Return
FunctionEnd
FunctionEnd
glslang/MachineIndependent/Initialize.cpp
View file @
02df206c
...
@@ -3862,7 +3862,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -3862,7 +3862,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable
.
setFunctionExtensions
(
"readInvocationARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setFunctionExtensions
(
"readInvocationARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setFunctionExtensions
(
"readFirstInvocationARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
symbolTable
.
setFunctionExtensions
(
"readFirstInvocationARB"
,
1
,
&
E_GL_ARB_shader_ballot
);
BuiltInVariable
(
"gl_SubGroupSizeARB"
,
EbvSubGroupSize
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupInvocationARB"
,
EbvSubGroupInvocation
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupInvocationARB"
,
EbvSubGroupInvocation
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupEqMaskARB"
,
EbvSubGroupEqMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupEqMaskARB"
,
EbvSubGroupEqMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupGeMaskARB"
,
EbvSubGroupGeMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupGeMaskARB"
,
EbvSubGroupGeMask
,
symbolTable
);
...
@@ -3870,6 +3869,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -3870,6 +3869,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable
(
"gl_SubGroupLeMaskARB"
,
EbvSubGroupLeMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupLeMaskARB"
,
EbvSubGroupLeMask
,
symbolTable
);
BuiltInVariable
(
"gl_SubGroupLtMaskARB"
,
EbvSubGroupLtMask
,
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
);
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
);
...
...
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