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
8c869679
Commit
8c869679
authored
Nov 28, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: For GLSL only, bitcast OpArrayLength result back to int.
This makes the rest of the AST consuming the result match GLSL semantics and hence get complete type matching.
parent
e045c23a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
22 deletions
+25
-22
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+6
-0
spv.310.comp.out
Test/baseResults/spv.310.comp.out
+19
-22
No files found.
SPIRV/GlslangToSpv.cpp
View file @
8c869679
...
...
@@ -1825,6 +1825,12 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
unsigned
int
member
=
node
->
getOperand
()
->
getAsBinaryNode
()
->
getRight
()
->
getAsConstantUnion
()
->
getConstArray
()[
0
].
getUConst
();
spv
::
Id
length
=
builder
.
createArrayLength
(
builder
.
accessChainGetLValue
(),
member
);
// GLSL semantics say the result of .length() is an int, while SPIR-V says
// signedness must be 0. So, convert from SPIR-V unsigned back to GLSL's
// AST expectation of a signed result.
if
(
glslangIntermediate
->
getSource
()
==
glslang
::
EShSourceGlsl
)
length
=
builder
.
createUnaryOp
(
spv
::
OpBitcast
,
builder
.
makeIntType
(
32
),
length
);
builder
.
clearAccessChain
();
builder
.
setAccessChainRValue
(
length
);
...
...
Test/baseResults/spv.310.comp.out
View file @
8c869679
spv.310.comp
error: SPIRV-Tools Validation Errors
error: OpStore Pointer <id> '62's type does not match Object <id> '60's type.
OpStore %62 %60
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 7
1
// Id's are bound by 7
2
Capability Shader
Capability DeviceGroup
Extension "SPV_KHR_device_group"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 53 6
4
EntryPoint GLCompute 4 "main" 53 6
5
ExecutionMode 4 LocalSize 16 32 4
Source ESSL 310
SourceExtension "GL_EXT_device_group"
...
...
@@ -34,7 +30,7 @@ error: OpStore Pointer <id> '62's type does not match Object <id> '60's type.
MemberName 48(outs) 1 "va"
Name 50 "outnames"
Name 53 "gl_LocalInvocationID"
Name 6
4
"gl_DeviceIndex"
Name 6
5
"gl_DeviceIndex"
Decorate 11 ArrayStride 16
MemberDecorate 12(outb) 0 Offset 0
MemberDecorate 12(outb) 1 Offset 4
...
...
@@ -52,8 +48,8 @@ error: OpStore Pointer <id> '62's type does not match Object <id> '60's type.
Decorate 48(outs) BufferBlock
Decorate 50(outnames) DescriptorSet 0
Decorate 53(gl_LocalInvocationID) BuiltIn LocalInvocationId
Decorate 6
4
(gl_DeviceIndex) BuiltIn DeviceIndex
Decorate 7
0
BuiltIn WorkgroupSize
Decorate 6
5
(gl_DeviceIndex) BuiltIn DeviceIndex
Decorate 7
1
BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
...
...
@@ -93,15 +89,15 @@ error: OpStore Pointer <id> '62's type does not match Object <id> '60's type.
52: TypePointer Input 51(ivec3)
53(gl_LocalInvocationID): 52(ptr) Variable Input
54: TypePointer Input 6(int)
6
1
: TypePointer Uniform 15(int)
6
3
: TypePointer Input 15(int)
6
4(gl_DeviceIndex): 63
(ptr) Variable Input
6
5
: 6(int) Constant 1
6
6
: 6(int) Constant 3400
6
7
: 6(int) Constant 16
6
8
: 6(int) Constant 32
69
: 6(int) Constant 4
7
0: 51(ivec3) ConstantComposite 67 68 69
6
2
: TypePointer Uniform 15(int)
6
4
: TypePointer Input 15(int)
6
5(gl_DeviceIndex): 64
(ptr) Variable Input
6
6
: 6(int) Constant 1
6
7
: 6(int) Constant 3400
6
8
: 6(int) Constant 16
6
9
: 6(int) Constant 32
70
: 6(int) Constant 4
7
1: 51(ivec3) ConstantComposite 68 69 70
4(main): 2 Function None 3
5: Label
ControlBarrier 7 7 8
...
...
@@ -129,9 +125,10 @@ error: OpStore Pointer <id> '62's type does not match Object <id> '60's type.
59: 29(ptr) AccessChain 50(outnames) 26 56
Store 59 58
60: 6(int) ArrayLength 14(outbname) 3
62: 61(ptr) AccessChain 50(outnames) 16
Store 62 60
MemoryBarrier 65 8
MemoryBarrier 7 66
61: 15(int) Bitcast 60
63: 62(ptr) AccessChain 50(outnames) 16
Store 63 61
MemoryBarrier 66 8
MemoryBarrier 7 67
Return
FunctionEnd
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