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
ee21fc90
Commit
ee21fc90
authored
Sep 21, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Fix missing 'Member' operand to OpArrayLength.
parent
142d7780
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
4 deletions
+18
-4
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+3
-2
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+10
-0
SpvBuilder.h
SPIRV/SpvBuilder.h
+3
-0
spv.310.comp.out
Test/baseResults/spv.310.comp.out
+1
-1
revision.h
glslang/Include/revision.h
+1
-1
No files found.
SPIRV/GlslangToSpv.cpp
View file @
ee21fc90
...
@@ -741,11 +741,12 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
...
@@ -741,11 +741,12 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
// Normal .length() would have been constant folded by the front-end.
// Normal .length() would have been constant folded by the front-end.
// So, this has to be block.lastMember.length().
// So, this has to be block.lastMember.length().
// SPV wants "block" a
s the operand, go get it
.
// SPV wants "block" a
nd member number as the operands, go get them
.
assert
(
node
->
getOperand
()
->
getType
().
isRuntimeSizedArray
());
assert
(
node
->
getOperand
()
->
getType
().
isRuntimeSizedArray
());
glslang
::
TIntermTyped
*
block
=
node
->
getOperand
()
->
getAsBinaryNode
()
->
getLeft
();
glslang
::
TIntermTyped
*
block
=
node
->
getOperand
()
->
getAsBinaryNode
()
->
getLeft
();
block
->
traverse
(
this
);
block
->
traverse
(
this
);
spv
::
Id
length
=
builder
.
createUnaryOp
(
spv
::
OpArrayLength
,
builder
.
makeIntType
(
32
),
builder
.
accessChainGetLValue
());
unsigned
int
member
=
node
->
getOperand
()
->
getAsBinaryNode
()
->
getRight
()
->
getAsConstantUnion
()
->
getConstArray
()[
0
].
getUConst
();
spv
::
Id
length
=
builder
.
createArrayLength
(
builder
.
accessChainGetLValue
(),
member
);
builder
.
clearAccessChain
();
builder
.
clearAccessChain
();
builder
.
setAccessChainRValue
(
length
);
builder
.
setAccessChainRValue
(
length
);
...
...
SPIRV/SpvBuilder.cpp
View file @
ee21fc90
...
@@ -890,6 +890,16 @@ Id Builder::createAccessChain(StorageClass storageClass, Id base, std::vector<Id
...
@@ -890,6 +890,16 @@ Id Builder::createAccessChain(StorageClass storageClass, Id base, std::vector<Id
return
chain
->
getResultId
();
return
chain
->
getResultId
();
}
}
Id
Builder
::
createArrayLength
(
Id
base
,
unsigned
int
member
)
{
Instruction
*
length
=
new
Instruction
(
getUniqueId
(),
makeIntType
(
32
),
OpArrayLength
);
length
->
addIdOperand
(
base
);
length
->
addImmediateOperand
(
member
);
buildPoint
->
addInstruction
(
length
);
return
length
->
getResultId
();
}
Id
Builder
::
createCompositeExtract
(
Id
composite
,
Id
typeId
,
unsigned
index
)
Id
Builder
::
createCompositeExtract
(
Id
composite
,
Id
typeId
,
unsigned
index
)
{
{
Instruction
*
extract
=
new
Instruction
(
getUniqueId
(),
typeId
,
OpCompositeExtract
);
Instruction
*
extract
=
new
Instruction
(
getUniqueId
(),
typeId
,
OpCompositeExtract
);
...
...
SPIRV/SpvBuilder.h
View file @
ee21fc90
...
@@ -225,6 +225,9 @@ public:
...
@@ -225,6 +225,9 @@ public:
// Create an OpAccessChain instruction
// Create an OpAccessChain instruction
Id
createAccessChain
(
StorageClass
,
Id
base
,
std
::
vector
<
Id
>&
offsets
);
Id
createAccessChain
(
StorageClass
,
Id
base
,
std
::
vector
<
Id
>&
offsets
);
// Create an OpArrayLength instruction
Id
createArrayLength
(
Id
base
,
unsigned
int
member
);
// Create an OpCompositeExtract instruction
// Create an OpCompositeExtract instruction
Id
createCompositeExtract
(
Id
composite
,
Id
typeId
,
unsigned
index
);
Id
createCompositeExtract
(
Id
composite
,
Id
typeId
,
unsigned
index
);
Id
createCompositeExtract
(
Id
composite
,
Id
typeId
,
std
::
vector
<
unsigned
>&
indexes
);
Id
createCompositeExtract
(
Id
composite
,
Id
typeId
,
std
::
vector
<
unsigned
>&
indexes
);
...
...
Test/baseResults/spv.310.comp.out
View file @
ee21fc90
...
@@ -113,7 +113,7 @@ Linked compute stage:
...
@@ -113,7 +113,7 @@ Linked compute stage:
58: 23(fvec4) CompositeConstruct 57 57 57 57
58: 23(fvec4) CompositeConstruct 57 57 57 57
59: 30(ptr) AccessChain 51(outnames) 27 56
59: 30(ptr) AccessChain 51(outnames) 27 56
Store 59 58
Store 59 58
60: 16(int) ArrayLength 15(outbname)
60: 16(int) ArrayLength 15(outbname)
3
62: 61(ptr) AccessChain 51(outnames) 17
62: 61(ptr) AccessChain 51(outnames) 17
Store 62 60
Store 62 60
Return
Return
...
...
glslang/Include/revision.h
View file @
ee21fc90
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "3.0.77
4
"
#define GLSLANG_REVISION "3.0.77
5
"
#define GLSLANG_DATE "21-Sep-2015"
#define GLSLANG_DATE "21-Sep-2015"
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