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
142cb87f
Unverified
Commit
142cb87f
authored
Oct 30, 2020
by
John Kessenich
Committed by
GitHub
Oct 30, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2387 from BNieuwenhuizen/nonuniform
NonUniform SPIR-V fixes.
parents
740ae9f6
8eb0bdce
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
145 additions
and
93 deletions
+145
-93
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+18
-19
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+3
-1
SpvBuilder.h
SPIRV/SpvBuilder.h
+2
-1
spv.nonuniform.frag.out
Test/baseResults/spv.nonuniform.frag.out
+116
-72
spv.nonuniform.frag
Test/spv.nonuniform.frag
+6
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
142cb87f
...
@@ -2308,7 +2308,8 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
...
@@ -2308,7 +2308,8 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
// The result of operation is always stored, but conditionally the
// The result of operation is always stored, but conditionally the
// consumed result. The consumed result is always an r-value.
// consumed result. The consumed result is always an r-value.
builder
.
accessChainStore
(
result
);
builder
.
accessChainStore
(
result
,
TranslateNonUniformDecoration
(
node
->
getOperand
()
->
getType
().
getQualifier
()));
builder
.
clearAccessChain
();
builder
.
clearAccessChain
();
if
(
node
->
getOp
()
==
glslang
::
EOpPreIncrement
||
if
(
node
->
getOp
()
==
glslang
::
EOpPreIncrement
||
node
->
getOp
()
==
glslang
::
EOpPreDecrement
)
node
->
getOp
()
==
glslang
::
EOpPreDecrement
)
...
@@ -2384,6 +2385,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
...
@@ -2384,6 +2385,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
spv
::
Id
invertedType
=
spv
::
NoType
;
// to use to override the natural type of the node
spv
::
Id
invertedType
=
spv
::
NoType
;
// to use to override the natural type of the node
std
::
vector
<
spv
::
Builder
::
AccessChain
>
complexLvalues
;
// for holding swizzling l-values too complex for
std
::
vector
<
spv
::
Builder
::
AccessChain
>
complexLvalues
;
// for holding swizzling l-values too complex for
// SPIR-V, for an out parameter
// SPIR-V, for an out parameter
std
::
vector
<
glslang
::
TQualifier
>
complexLValueQualifiers
;
std
::
vector
<
spv
::
Id
>
temporaryLvalues
;
// temporaries to pass, as proxies for complexLValues
std
::
vector
<
spv
::
Id
>
temporaryLvalues
;
// temporaries to pass, as proxies for complexLValues
auto
resultType
=
[
&
invertedType
,
&
node
,
this
](){
return
invertedType
!=
spv
::
NoType
?
auto
resultType
=
[
&
invertedType
,
&
node
,
this
](){
return
invertedType
!=
spv
::
NoType
?
...
@@ -2627,6 +2629,10 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
...
@@ -2627,6 +2629,10 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
else
else
constructed
=
builder
.
createConstructor
(
precision
,
arguments
,
resultType
());
constructed
=
builder
.
createConstructor
(
precision
,
arguments
,
resultType
());
if
(
node
->
getType
().
getQualifier
().
isNonUniform
())
{
builder
.
addDecoration
(
constructed
,
spv
::
DecorationNonUniformEXT
);
}
builder
.
clearAccessChain
();
builder
.
clearAccessChain
();
builder
.
setAccessChainRValue
(
constructed
);
builder
.
setAccessChainRValue
(
constructed
);
...
@@ -3001,6 +3007,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
...
@@ -3001,6 +3007,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
// receive the result, and must later swizzle that into the original
// receive the result, and must later swizzle that into the original
// l-value.
// l-value.
complexLvalues
.
push_back
(
builder
.
getAccessChain
());
complexLvalues
.
push_back
(
builder
.
getAccessChain
());
complexLValueQualifiers
.
push_back
(
glslangOperands
[
arg
]
->
getAsTyped
()
->
getType
().
getQualifier
());
temporaryLvalues
.
push_back
(
builder
.
createVariable
(
temporaryLvalues
.
push_back
(
builder
.
createVariable
(
spv
::
NoPrecision
,
spv
::
StorageClassFunction
,
spv
::
NoPrecision
,
spv
::
StorageClassFunction
,
builder
.
accessChainGetInferredType
(),
"swizzleTemp"
));
builder
.
accessChainGetInferredType
(),
"swizzleTemp"
));
...
@@ -3105,7 +3112,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
...
@@ -3105,7 +3112,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
for
(
unsigned
int
i
=
0
;
i
<
temporaryLvalues
.
size
();
++
i
)
{
for
(
unsigned
int
i
=
0
;
i
<
temporaryLvalues
.
size
();
++
i
)
{
builder
.
setAccessChain
(
complexLvalues
[
i
]);
builder
.
setAccessChain
(
complexLvalues
[
i
]);
builder
.
accessChainStore
(
builder
.
createLoad
(
temporaryLvalues
[
i
],
spv
::
NoPrecision
));
builder
.
accessChainStore
(
builder
.
createLoad
(
temporaryLvalues
[
i
],
spv
::
NoPrecision
)
,
TranslateNonUniformDecoration
(
complexLValueQualifiers
[
i
])
);
}
}
}
}
...
@@ -4170,7 +4177,7 @@ void TGlslangToSpvTraverser::accessChainStore(const glslang::TType& type, spv::I
...
@@ -4170,7 +4177,7 @@ void TGlslangToSpvTraverser::accessChainStore(const glslang::TType& type, spv::I
unsigned
int
alignment
=
builder
.
getAccessChain
().
alignment
;
unsigned
int
alignment
=
builder
.
getAccessChain
().
alignment
;
alignment
|=
type
.
getBufferReferenceAlignment
();
alignment
|=
type
.
getBufferReferenceAlignment
();
builder
.
accessChainStore
(
rvalue
,
builder
.
accessChainStore
(
rvalue
,
TranslateNonUniformDecoration
(
type
.
getQualifier
()),
spv
::
MemoryAccessMask
(
TranslateMemoryAccess
(
coherentFlags
)
&
spv
::
MemoryAccessMask
(
TranslateMemoryAccess
(
coherentFlags
)
&
~
spv
::
MemoryAccessMakePointerVisibleKHRMask
),
~
spv
::
MemoryAccessMakePointerVisibleKHRMask
),
TranslateMemoryScope
(
coherentFlags
),
alignment
);
TranslateMemoryScope
(
coherentFlags
),
alignment
);
...
@@ -4766,12 +4773,15 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
...
@@ -4766,12 +4773,15 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
const
bool
isUnsignedResult
=
node
->
getType
().
getBasicType
()
==
glslang
::
EbtUint
;
const
bool
isUnsignedResult
=
node
->
getType
().
getBasicType
()
==
glslang
::
EbtUint
;
if
(
builder
.
isSampledImage
(
params
.
sampler
)
&&
((
cracked
.
query
&&
node
->
getOp
()
!=
glslang
::
EOpTextureQueryLod
)
||
cracked
.
fragMask
||
cracked
.
fetch
))
{
params
.
sampler
=
builder
.
createUnaryOp
(
spv
::
OpImage
,
builder
.
getImageType
(
params
.
sampler
),
params
.
sampler
);
if
(
imageType
.
getQualifier
().
isNonUniform
())
{
builder
.
addDecoration
(
params
.
sampler
,
spv
::
DecorationNonUniformEXT
);
}
}
// Check for queries
// Check for queries
if
(
cracked
.
query
)
{
if
(
cracked
.
query
)
{
// OpImageQueryLod works on a sampled image, for other queries the image has to be extracted first
if
(
node
->
getOp
()
!=
glslang
::
EOpTextureQueryLod
&&
builder
.
isSampledImage
(
params
.
sampler
))
params
.
sampler
=
builder
.
createUnaryOp
(
spv
::
OpImage
,
builder
.
getImageType
(
params
.
sampler
),
params
.
sampler
);
switch
(
node
->
getOp
())
{
switch
(
node
->
getOp
())
{
case
glslang
:
:
EOpImageQuerySize
:
case
glslang
:
:
EOpImageQuerySize
:
case
glslang
:
:
EOpTextureQuerySize
:
case
glslang
:
:
EOpTextureQuerySize
:
...
@@ -5025,10 +5035,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
...
@@ -5025,10 +5035,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
auto
opIt
=
arguments
.
begin
();
auto
opIt
=
arguments
.
begin
();
std
::
vector
<
spv
::
Id
>
operands
;
std
::
vector
<
spv
::
Id
>
operands
;
// Extract the image if necessary
if
(
builder
.
isSampledImage
(
params
.
sampler
))
params
.
sampler
=
builder
.
createUnaryOp
(
spv
::
OpImage
,
builder
.
getImageType
(
params
.
sampler
),
params
.
sampler
);
operands
.
push_back
(
params
.
sampler
);
operands
.
push_back
(
params
.
sampler
);
++
opIt
;
++
opIt
;
...
@@ -5089,13 +5095,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
...
@@ -5089,13 +5095,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
bias
=
true
;
bias
=
true
;
}
}
// See if the sampler param should really be just the SPV image part
if
(
cracked
.
fetch
)
{
// a fetch needs to have the image extracted first
if
(
builder
.
isSampledImage
(
params
.
sampler
))
params
.
sampler
=
builder
.
createUnaryOp
(
spv
::
OpImage
,
builder
.
getImageType
(
params
.
sampler
),
params
.
sampler
);
}
#ifndef GLSLANG_WEB
#ifndef GLSLANG_WEB
if
(
cracked
.
gather
)
{
if
(
cracked
.
gather
)
{
const
auto
&
sourceExtensions
=
glslangIntermediate
->
getRequestedExtensions
();
const
auto
&
sourceExtensions
=
glslangIntermediate
->
getRequestedExtensions
();
...
@@ -5255,7 +5254,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
...
@@ -5255,7 +5254,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
builder
.
accessChainPush
(
builder
.
makeIntConstant
(
i
),
flags
,
0
);
builder
.
accessChainPush
(
builder
.
makeIntConstant
(
i
),
flags
,
0
);
builder
.
accessChainStore
(
builder
.
createCompositeExtract
(
res
,
builder
.
getContainedTypeId
(
resType
,
i
+
1
),
builder
.
accessChainStore
(
builder
.
createCompositeExtract
(
res
,
builder
.
getContainedTypeId
(
resType
,
i
+
1
),
i
+
1
));
i
+
1
)
,
TranslateNonUniformDecoration
(
imageType
.
getQualifier
())
);
}
}
return
builder
.
createCompositeExtract
(
res
,
resultType
(),
0
);
return
builder
.
createCompositeExtract
(
res
,
resultType
(),
0
);
}
}
...
...
SPIRV/SpvBuilder.cpp
View file @
142cb87f
...
@@ -2761,12 +2761,14 @@ void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizz
...
@@ -2761,12 +2761,14 @@ void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizz
}
}
// Comments in header
// Comments in header
void
Builder
::
accessChainStore
(
Id
rvalue
,
spv
::
MemoryAccessMask
memoryAccess
,
spv
::
Scope
scope
,
unsigned
int
alignment
)
void
Builder
::
accessChainStore
(
Id
rvalue
,
Decoration
nonUniform
,
spv
::
MemoryAccessMask
memoryAccess
,
spv
::
Scope
scope
,
unsigned
int
alignment
)
{
{
assert
(
accessChain
.
isRValue
==
false
);
assert
(
accessChain
.
isRValue
==
false
);
transferAccessChainSwizzle
(
true
);
transferAccessChainSwizzle
(
true
);
Id
base
=
collapseAccessChain
();
Id
base
=
collapseAccessChain
();
addDecoration
(
base
,
nonUniform
);
Id
source
=
rvalue
;
Id
source
=
rvalue
;
// dynamic component should be gone
// dynamic component should be gone
...
...
SPIRV/SpvBuilder.h
View file @
142cb87f
...
@@ -721,7 +721,8 @@ public:
...
@@ -721,7 +721,8 @@ public:
}
}
// use accessChain and swizzle to store value
// use accessChain and swizzle to store value
void
accessChainStore
(
Id
rvalue
,
spv
::
MemoryAccessMask
memoryAccess
=
spv
::
MemoryAccessMaskNone
,
void
accessChainStore
(
Id
rvalue
,
Decoration
nonUniform
,
spv
::
MemoryAccessMask
memoryAccess
=
spv
::
MemoryAccessMaskNone
,
spv
::
Scope
scope
=
spv
::
ScopeMax
,
unsigned
int
alignment
=
0
);
spv
::
Scope
scope
=
spv
::
ScopeMax
,
unsigned
int
alignment
=
0
);
// use accessChain and swizzle to load an r-value
// use accessChain and swizzle to load an r-value
...
...
Test/baseResults/spv.nonuniform.frag.out
View file @
142cb87f
spv.nonuniform.frag
spv.nonuniform.frag
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 8000a
// Generated by (magic number): 8000a
// Id's are bound by 2
12
// Id's are bound by 2
35
Capability Shader
Capability Shader
Capability InputAttachment
Capability InputAttachment
...
@@ -22,7 +22,7 @@ spv.nonuniform.frag
...
@@ -22,7 +22,7 @@ spv.nonuniform.frag
Extension "SPV_EXT_descriptor_indexing"
Extension "SPV_EXT_descriptor_indexing"
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 35 92
EntryPoint Fragment 4 "main" 35 92
182
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Source GLSL 450
SourceExtension "GL_EXT_nonuniform_qualifier"
SourceExtension "GL_EXT_nonuniform_qualifier"
...
@@ -53,20 +53,26 @@ spv.nonuniform.frag
...
@@ -53,20 +53,26 @@ spv.nonuniform.frag
Name 139 "inputAttachment"
Name 139 "inputAttachment"
Name 149 "uniformTexelBuffer"
Name 149 "uniformTexelBuffer"
Name 160 "storageTexelBuffer"
Name 160 "storageTexelBuffer"
Name 170 "v"
Name 171 "uniformTexArr"
Name 185 "uv"
Name 178 "uniformSampler"
Name 195 "m"
Name 182 "inTexcoord"
Name 203 "S"
Name 190 "v"
MemberName 203(S) 0 "a"
Name 205 "uv"
Name 205 "s"
Name 215 "m"
Name 223 "S"
MemberName 223(S) 0 "a"
Name 225 "s"
Decorate 9(nupi) DecorationNonUniformEXT
Decorate 9(nupi) DecorationNonUniformEXT
Decorate 13 DecorationNonUniformEXT
Decorate 13 DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 19 DecorationNonUniformEXT
Decorate 19 DecorationNonUniformEXT
Decorate 18(param) DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 24 DecorationNonUniformEXT
Decorate 24 DecorationNonUniformEXT
Decorate 28 DecorationNonUniformEXT
Decorate 28 DecorationNonUniformEXT
Decorate 29 DecorationNonUniformEXT
Decorate 29 DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 35(nu_inv4) Location 0
Decorate 35(nu_inv4) Location 0
Decorate 35(nu_inv4) DecorationNonUniformEXT
Decorate 35(nu_inv4) DecorationNonUniformEXT
Decorate 39 DecorationNonUniformEXT
Decorate 39 DecorationNonUniformEXT
...
@@ -126,35 +132,48 @@ spv.nonuniform.frag
...
@@ -126,35 +132,48 @@ spv.nonuniform.frag
Decorate 150 DecorationNonUniformEXT
Decorate 150 DecorationNonUniformEXT
Decorate 151 DecorationNonUniformEXT
Decorate 151 DecorationNonUniformEXT
Decorate 152 DecorationNonUniformEXT
Decorate 152 DecorationNonUniformEXT
Decorate 153 DecorationNonUniformEXT
Decorate 160(storageTexelBuffer) DescriptorSet 0
Decorate 160(storageTexelBuffer) DescriptorSet 0
Decorate 160(storageTexelBuffer) Binding 9
Decorate 160(storageTexelBuffer) Binding 9
Decorate 92(nu_ii) DecorationNonUniformEXT
Decorate 92(nu_ii) DecorationNonUniformEXT
Decorate 161 DecorationNonUniformEXT
Decorate 161 DecorationNonUniformEXT
Decorate 162 DecorationNonUniformEXT
Decorate 162 DecorationNonUniformEXT
Decorate 163 DecorationNonUniformEXT
Decorate 163 DecorationNonUniformEXT
Decorate 170(v) DecorationNonUniformEXT
Decorate 171(uniformTexArr) DescriptorSet 0
Decorate 171(uniformTexArr) Binding 10
Decorate 92(nu_ii) DecorationNonUniformEXT
Decorate 172 DecorationNonUniformEXT
Decorate 172 DecorationNonUniformEXT
Decorate 173 DecorationNonUniformEXT
Decorate 174 DecorationNonUniformEXT
Decorate 174 DecorationNonUniformEXT
Decorate 175 DecorationNonUniformEXT
Decorate 175 DecorationNonUniformEXT
Decorate 179 DecorationNonUniformEXT
Decorate 178(uniformSampler) DescriptorSet 0
Decorate 180 DecorationNonUniformEXT
Decorate 178(uniformSampler) Binding 11
Decorate 181 DecorationNonUniformEXT
Decorate 182(inTexcoord) Location 2
Decorate 182 DecorationNonUniformEXT
Decorate 190(v) DecorationNonUniformEXT
Decorate 192 DecorationNonUniformEXT
Decorate 193 DecorationNonUniformEXT
Decorate 194 DecorationNonUniformEXT
Decorate 195 DecorationNonUniformEXT
Decorate 199 DecorationNonUniformEXT
Decorate 200 DecorationNonUniformEXT
Decorate 201 DecorationNonUniformEXT
Decorate 202 DecorationNonUniformEXT
Decorate 92(nu_ii) DecorationNonUniformEXT
Decorate 92(nu_ii) DecorationNonUniformEXT
Decorate 186 DecorationNonUniformEXT
Decorate 187 DecorationNonUniformEXT
Decorate 188 DecorationNonUniformEXT
Decorate 189 DecorationNonUniformEXT
Decorate 190 DecorationNonUniformEXT
Decorate 195(m) DecorationNonUniformEXT
Decorate 196 DecorationNonUniformEXT
Decorate 197 DecorationNonUniformEXT
Decorate 205(s) DecorationNonUniformEXT
Decorate 206 DecorationNonUniformEXT
Decorate 206 DecorationNonUniformEXT
Decorate 207 DecorationNonUniformEXT
Decorate 207 DecorationNonUniformEXT
Decorate 208 DecorationNonUniformEXT
Decorate 208 DecorationNonUniformEXT
Decorate 209 DecorationNonUniformEXT
Decorate 209 DecorationNonUniformEXT
Decorate 210 DecorationNonUniformEXT
Decorate 215(m) DecorationNonUniformEXT
Decorate 216 DecorationNonUniformEXT
Decorate 217 DecorationNonUniformEXT
Decorate 225(s) DecorationNonUniformEXT
Decorate 226 DecorationNonUniformEXT
Decorate 227 DecorationNonUniformEXT
Decorate 228 DecorationNonUniformEXT
Decorate 229 DecorationNonUniformEXT
Decorate 92(nu_ii) DecorationNonUniformEXT
Decorate 232 DecorationNonUniformEXT
Decorate 234 DecorationNonUniformEXT
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeInt 32 1
6: TypeInt 32 1
...
@@ -224,14 +243,24 @@ spv.nonuniform.frag
...
@@ -224,14 +243,24 @@ spv.nonuniform.frag
158: TypeRuntimeArray 75
158: TypeRuntimeArray 75
159: TypePointer UniformConstant 158
159: TypePointer UniformConstant 158
160(storageTexelBuffer): 159(ptr) Variable UniformConstant
160(storageTexelBuffer): 159(ptr) Variable UniformConstant
168: TypeVector 6(int) 4
168: 36(int) Constant 8
169: TypePointer Function 168(ivec4)
169: TypeArray 108 168
171: 36(int) Constant 1
170: TypePointer UniformConstant 169
178: 36(int) Constant 2
171(uniformTexArr): 170(ptr) Variable UniformConstant
193: TypeMatrix 33(fvec4) 4
173: TypePointer UniformConstant 108
194: TypePointer Function 193
176: TypeSampler
203(S): TypeStruct 6(int)
177: TypePointer UniformConstant 176
204: TypePointer Function 203(S)
178(uniformSampler): 177(ptr) Variable UniformConstant
181: TypePointer Input 117(fvec2)
182(inTexcoord): 181(ptr) Variable Input
188: TypeVector 6(int) 4
189: TypePointer Function 188(ivec4)
191: 36(int) Constant 1
198: 36(int) Constant 2
213: TypeMatrix 33(fvec4) 4
214: TypePointer Function 213
223(S): TypeStruct 6(int)
224: TypePointer Function 223(S)
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
16(a): 7(ptr) Variable Function
16(a): 7(ptr) Variable Function
...
@@ -241,10 +270,10 @@ spv.nonuniform.frag
...
@@ -241,10 +270,10 @@ spv.nonuniform.frag
32(b): 31(ptr) Variable Function
32(b): 31(ptr) Variable Function
41(nu_gf): 31(ptr) Variable Function
41(nu_gf): 31(ptr) Variable Function
48(dyn_i): 7(ptr) Variable Function
48(dyn_i): 7(ptr) Variable Function
1
70(v): 16
9(ptr) Variable Function
1
90(v): 18
9(ptr) Variable Function
185(uv): 16
9(ptr) Variable Function
205(uv): 18
9(ptr) Variable Function
195(m): 19
4(ptr) Variable Function
215(m): 21
4(ptr) Variable Function
2
05(s): 20
4(ptr) Variable Function
2
25(s): 22
4(ptr) Variable Function
19: 6(int) Load 17(nu_li)
19: 6(int) Load 17(nu_li)
Store 18(param) 19
Store 18(param) 19
21: 6(int) FunctionCall 11(foo(i1;i1;) 18(param) 20(param)
21: 6(int) FunctionCall 11(foo(i1;i1;) 18(param) 20(param)
...
@@ -341,43 +370,58 @@ spv.nonuniform.frag
...
@@ -341,43 +370,58 @@ spv.nonuniform.frag
166: 30(float) Load 32(b)
166: 30(float) Load 32(b)
167: 30(float) FAdd 166 165
167: 30(float) FAdd 166 165
Store 32(b) 167
Store 32(b) 167
172: 7(ptr) AccessChain 170(v) 171
172: 6(int) Load 92(nu_ii)
173: 6(int) Load 172
174: 173(ptr) AccessChain 171(uniformTexArr) 172
174: 94(ptr) AccessChain 90(uniformBuffer) 173 53
175: 108 Load 174
175: 30(float) Load 174
179: 176 Load 178(uniformSampler)
176: 30(float) Load 32(b)
180: 109 SampledImage 175 179
177: 30(float) FAdd 176 175
183: 117(fvec2) Load 182(inTexcoord)
Store 32(b) 177
184: 33(fvec4) ImageSampleImplicitLod 180 183
179: 7(ptr) AccessChain 170(v) 178
185: 30(float) CompositeExtract 184 0
180: 6(int) Load 179
186: 30(float) Load 32(b)
181: 94(ptr) AccessChain 90(uniformBuffer) 180 53
187: 30(float) FAdd 186 185
182: 30(float) Load 181
Store 32(b) 187
183: 30(float) Load 32(b)
192: 7(ptr) AccessChain 190(v) 191
184: 30(float) FAdd 183 182
193: 6(int) Load 192
Store 32(b) 184
194: 94(ptr) AccessChain 90(uniformBuffer) 193 53
186: 6(int) Load 92(nu_ii)
195: 30(float) Load 194
187: 7(ptr) AccessChain 185(uv) 186
196: 30(float) Load 32(b)
188: 6(int) Load 187
197: 30(float) FAdd 196 195
189: 94(ptr) AccessChain 90(uniformBuffer) 188 53
Store 32(b) 197
190: 30(float) Load 189
199: 7(ptr) AccessChain 190(v) 198
191: 30(float) Load 32(b)
200: 6(int) Load 199
192: 30(float) FAdd 191 190
201: 94(ptr) AccessChain 90(uniformBuffer) 200 53
Store 32(b) 192
202: 30(float) Load 201
196: 31(ptr) AccessChain 195(m) 26 178
203: 30(float) Load 32(b)
197: 30(float) Load 196
204: 30(float) FAdd 203 202
198: 6(int) ConvertFToS 197
Store 32(b) 204
199: 94(ptr) AccessChain 90(uniformBuffer) 198 53
206: 6(int) Load 92(nu_ii)
200: 30(float) Load 199
207: 7(ptr) AccessChain 205(uv) 206
201: 30(float) Load 32(b)
208: 6(int) Load 207
202: 30(float) FAdd 201 200
209: 94(ptr) AccessChain 90(uniformBuffer) 208 53
Store 32(b) 202
210: 30(float) Load 209
206: 7(ptr) AccessChain 205(s) 53
211: 30(float) Load 32(b)
207: 6(int) Load 206
212: 30(float) FAdd 211 210
208: 94(ptr) AccessChain 90(uniformBuffer) 207 53
Store 32(b) 212
209: 30(float) Load 208
216: 31(ptr) AccessChain 215(m) 26 198
210: 30(float) Load 32(b)
217: 30(float) Load 216
211: 30(float) FAdd 210 209
218: 6(int) ConvertFToS 217
Store 32(b) 211
219: 94(ptr) AccessChain 90(uniformBuffer) 218 53
220: 30(float) Load 219
221: 30(float) Load 32(b)
222: 30(float) FAdd 221 220
Store 32(b) 222
226: 7(ptr) AccessChain 225(s) 53
227: 6(int) Load 226
228: 94(ptr) AccessChain 90(uniformBuffer) 227 53
229: 30(float) Load 228
230: 30(float) Load 32(b)
231: 30(float) FAdd 230 229
Store 32(b) 231
232: 6(int) Load 92(nu_ii)
233: 30(float) Load 32(b)
234: 94(ptr) AccessChain 102(storageBuffer) 232 53
Store 234 233
Return
Return
FunctionEnd
FunctionEnd
11(foo(i1;i1;): 6(int) Function None 8
11(foo(i1;i1;): 6(int) Function None 8
...
...
Test/spv.nonuniform.frag
View file @
142cb87f
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
layout
(
location
=
0
)
nonuniformEXT
in
vec4
nu_inv4
;
layout
(
location
=
0
)
nonuniformEXT
in
vec4
nu_inv4
;
nonuniformEXT
float
nu_gf
;
nonuniformEXT
float
nu_gf
;
layout
(
location
=
1
)
in
nonuniformEXT
flat
int
nu_ii
;
layout
(
location
=
1
)
in
nonuniformEXT
flat
int
nu_ii
;
layout
(
location
=
2
)
in
vec2
inTexcoord
;
layout
(
binding
=
0
,
input_attachment_index
=
0
)
uniform
subpassInput
inputAttachmentDyn
[];
layout
(
binding
=
0
,
input_attachment_index
=
0
)
uniform
subpassInput
inputAttachmentDyn
[];
layout
(
binding
=
1
)
uniform
samplerBuffer
uniformTexelBufferDyn
[];
layout
(
binding
=
1
)
uniform
samplerBuffer
uniformTexelBufferDyn
[];
...
@@ -16,6 +17,8 @@ layout(binding=6, r32f) uniform image2D storag
...
@@ -16,6 +17,8 @@ layout(binding=6, r32f) uniform image2D storag
layout
(
binding
=
7
,
input_attachment_index
=
1
)
uniform
subpassInput
inputAttachment
[];
layout
(
binding
=
7
,
input_attachment_index
=
1
)
uniform
subpassInput
inputAttachment
[];
layout
(
binding
=
8
)
uniform
samplerBuffer
uniformTexelBuffer
[];
layout
(
binding
=
8
)
uniform
samplerBuffer
uniformTexelBuffer
[];
layout
(
binding
=
9
,
r32f
)
uniform
imageBuffer
storageTexelBuffer
[];
layout
(
binding
=
9
,
r32f
)
uniform
imageBuffer
storageTexelBuffer
[];
layout
(
binding
=
10
)
uniform
texture2D
uniformTexArr
[
8
];
layout
(
binding
=
11
)
uniform
sampler
uniformSampler
;
nonuniformEXT
int
foo
(
nonuniformEXT
int
nupi
,
nonuniformEXT
out
int
f
)
nonuniformEXT
int
foo
(
nonuniformEXT
int
nupi
,
nonuniformEXT
out
int
f
)
{
{
...
@@ -42,6 +45,7 @@ void main()
...
@@ -42,6 +45,7 @@ void main()
b
+=
subpassLoad
(
inputAttachment
[
nu_ii
]).
x
;
b
+=
subpassLoad
(
inputAttachment
[
nu_ii
]).
x
;
b
+=
texelFetch
(
uniformTexelBuffer
[
nu_ii
],
1
).
x
;
b
+=
texelFetch
(
uniformTexelBuffer
[
nu_ii
],
1
).
x
;
b
+=
imageLoad
(
storageTexelBuffer
[
nu_ii
],
1
).
x
;
b
+=
imageLoad
(
storageTexelBuffer
[
nu_ii
],
1
).
x
;
b
+=
texture
(
sampler2D
(
uniformTexArr
[
nu_ii
],
uniformSampler
),
inTexcoord
.
xy
).
x
;
nonuniformEXT
ivec4
v
;
nonuniformEXT
ivec4
v
;
nonuniformEXT
mat4
m
;
nonuniformEXT
mat4
m
;
...
@@ -52,4 +56,6 @@ void main()
...
@@ -52,4 +56,6 @@ void main()
b
+=
uniformBuffer
[
uv
[
nu_ii
]].
a
;
b
+=
uniformBuffer
[
uv
[
nu_ii
]].
a
;
b
+=
uniformBuffer
[
int
(
m
[
2
].
z
)].
a
;
b
+=
uniformBuffer
[
int
(
m
[
2
].
z
)].
a
;
b
+=
uniformBuffer
[
s
.
a
].
a
;
b
+=
uniformBuffer
[
s
.
a
].
a
;
storageBuffer
[
nu_ii
].
b
=
b
;
}
}
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