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
64b9743c
Commit
64b9743c
authored
Sep 14, 2016
by
Rex Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Support simultaneous l-value swizzle and dynamic component selection.
parent
deb4940c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
9 deletions
+15
-9
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+14
-8
spv.accessChain.frag.out
Test/baseResults/spv.accessChain.frag.out
+0
-0
spv.accessChain.frag
Test/spv.accessChain.frag
+1
-1
No files found.
SPIRV/SpvBuilder.cpp
View file @
64b9743c
...
@@ -1328,15 +1328,20 @@ Id Builder::createRvalueSwizzle(Decoration precision, Id typeId, Id source, std:
...
@@ -1328,15 +1328,20 @@ Id Builder::createRvalueSwizzle(Decoration precision, Id typeId, Id source, std:
// Comments in header
// Comments in header
Id
Builder
::
createLvalueSwizzle
(
Id
typeId
,
Id
target
,
Id
source
,
std
::
vector
<
unsigned
>&
channels
)
Id
Builder
::
createLvalueSwizzle
(
Id
typeId
,
Id
target
,
Id
source
,
std
::
vector
<
unsigned
>&
channels
)
{
{
assert
(
getNumComponents
(
source
)
==
(
int
)
channels
.
size
());
if
(
channels
.
size
()
==
1
&&
getNumComponents
(
source
)
==
1
)
if
(
channels
.
size
()
==
1
&&
getNumComponents
(
source
)
==
1
)
return
createCompositeInsert
(
source
,
target
,
typeId
,
channels
.
front
());
return
createCompositeInsert
(
source
,
target
,
typeId
,
channels
.
front
());
Instruction
*
swizzle
=
new
Instruction
(
getUniqueId
(),
typeId
,
OpVectorShuffle
);
Instruction
*
swizzle
=
new
Instruction
(
getUniqueId
(),
typeId
,
OpVectorShuffle
);
assert
(
isVector
(
source
));
assert
(
isVector
(
target
));
assert
(
isVector
(
target
));
swizzle
->
addIdOperand
(
target
);
swizzle
->
addIdOperand
(
target
);
swizzle
->
addIdOperand
(
source
);
if
(
accessChain
.
component
!=
NoResult
)
// For dynamic component selection, source does not involve in l-value swizzle
swizzle
->
addIdOperand
(
target
);
else
{
assert
(
getNumComponents
(
source
)
==
(
int
)
channels
.
size
());
assert
(
isVector
(
source
));
swizzle
->
addIdOperand
(
source
);
}
// Set up an identity shuffle from the base value to the result value
// Set up an identity shuffle from the base value to the result value
unsigned
int
components
[
4
];
unsigned
int
components
[
4
];
...
@@ -1345,8 +1350,12 @@ Id Builder::createLvalueSwizzle(Id typeId, Id target, Id source, std::vector<uns
...
@@ -1345,8 +1350,12 @@ Id Builder::createLvalueSwizzle(Id typeId, Id target, Id source, std::vector<uns
components
[
i
]
=
i
;
components
[
i
]
=
i
;
// Punch in the l-value swizzle
// Punch in the l-value swizzle
for
(
int
i
=
0
;
i
<
(
int
)
channels
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
(
int
)
channels
.
size
();
++
i
)
{
components
[
channels
[
i
]]
=
numTargetComponents
+
i
;
if
(
accessChain
.
component
!=
NoResult
)
components
[
i
]
=
channels
[
i
];
// Only shuffle the base value
else
components
[
channels
[
i
]]
=
numTargetComponents
+
i
;
}
// finish the instruction with these components selectors
// finish the instruction with these components selectors
for
(
int
i
=
0
;
i
<
numTargetComponents
;
++
i
)
for
(
int
i
=
0
;
i
<
numTargetComponents
;
++
i
)
...
@@ -2118,9 +2127,6 @@ void Builder::accessChainStore(Id rvalue)
...
@@ -2118,9 +2127,6 @@ void Builder::accessChainStore(Id rvalue)
transferAccessChainSwizzle
(
true
);
transferAccessChainSwizzle
(
true
);
Id
base
=
collapseAccessChain
();
Id
base
=
collapseAccessChain
();
if
(
accessChain
.
swizzle
.
size
()
&&
accessChain
.
component
!=
NoResult
)
logger
->
missingFunctionality
(
"simultaneous l-value swizzle and dynamic component selection"
);
// If swizzle still exists, it is out-of-order or not full, we must load the target vector,
// If swizzle still exists, it is out-of-order or not full, we must load the target vector,
// extract and insert elements to perform writeMask and/or swizzle.
// extract and insert elements to perform writeMask and/or swizzle.
Id
source
=
NoResult
;
Id
source
=
NoResult
;
...
...
Test/baseResults/spv.accessChain.frag.out
View file @
64b9743c
This diff is collapsed.
Click to expand it.
Test/spv.accessChain.frag
View file @
64b9743c
...
@@ -71,7 +71,7 @@ void GetColor12(const S i, int comp)
...
@@ -71,7 +71,7 @@ void GetColor12(const S i, int comp)
void
GetColor13
(
const
S
i
,
int
comp
)
void
GetColor13
(
const
S
i
,
int
comp
)
{
{
// OutColor.zy[comp] += i.color.x; // not yet supported
OutColor
.
zy
[
comp
]
+=
i
.
color
.
x
;
}
}
void
main
()
void
main
()
...
...
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