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
76f71397
Commit
76f71397
authored
Dec 09, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Modify last merge: Have promoteScalar() generate the correct vectorType.
parent
c51710e0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+3
-6
SpvBuilder.h
SPIRV/SpvBuilder.h
+7
-2
revision.h
glslang/Include/revision.h
+2
-2
No files found.
SPIRV/SpvBuilder.cpp
View file @
76f71397
...
@@ -1174,9 +1174,9 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right)
...
@@ -1174,9 +1174,9 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right)
int
direction
=
getNumComponents
(
right
)
-
getNumComponents
(
left
);
int
direction
=
getNumComponents
(
right
)
-
getNumComponents
(
left
);
if
(
direction
>
0
)
if
(
direction
>
0
)
left
=
smearScalar
(
precision
,
left
,
getTypeId
(
right
));
left
=
smearScalar
(
precision
,
left
,
makeVectorType
(
getTypeId
(
left
),
getNumComponents
(
right
)
));
else
if
(
direction
<
0
)
else
if
(
direction
<
0
)
right
=
smearScalar
(
precision
,
right
,
getTypeId
(
left
));
right
=
smearScalar
(
precision
,
right
,
makeVectorType
(
getTypeId
(
right
),
getNumComponents
(
left
)
));
return
;
return
;
}
}
...
@@ -1185,15 +1185,12 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right)
...
@@ -1185,15 +1185,12 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right)
Id
Builder
::
smearScalar
(
Decoration
/*precision*/
,
Id
scalar
,
Id
vectorType
)
Id
Builder
::
smearScalar
(
Decoration
/*precision*/
,
Id
scalar
,
Id
vectorType
)
{
{
assert
(
getNumComponents
(
scalar
)
==
1
);
assert
(
getNumComponents
(
scalar
)
==
1
);
assert
(
getTypeId
(
scalar
)
==
getScalarTypeId
(
vectorType
));
int
numComponents
=
getNumTypeComponents
(
vectorType
);
int
numComponents
=
getNumTypeComponents
(
vectorType
);
if
(
numComponents
==
1
)
if
(
numComponents
==
1
)
return
scalar
;
return
scalar
;
// Make new vector type if the provided one is incompatible with type of the scalar
if
(
getTypeId
(
scalar
)
!=
getScalarTypeId
(
vectorType
))
vectorType
=
makeVectorType
(
getTypeId
(
scalar
),
numComponents
);
Instruction
*
smear
=
new
Instruction
(
getUniqueId
(),
vectorType
,
OpCompositeConstruct
);
Instruction
*
smear
=
new
Instruction
(
getUniqueId
(),
vectorType
,
OpCompositeConstruct
);
for
(
int
c
=
0
;
c
<
numComponents
;
++
c
)
for
(
int
c
=
0
;
c
<
numComponents
;
++
c
)
smear
->
addIdOperand
(
scalar
);
smear
->
addIdOperand
(
scalar
);
...
...
SPIRV/SpvBuilder.h
View file @
76f71397
...
@@ -279,12 +279,17 @@ public:
...
@@ -279,12 +279,17 @@ public:
// - promoteScalar(scalar, scalar) // do nothing
// - promoteScalar(scalar, scalar) // do nothing
// Other forms are not allowed.
// Other forms are not allowed.
//
//
// Generally, the type of 'scalar' does not need to be the same type as the components in 'vector'.
// The type of the created vector is a vector of components of the same type as the scalar.
//
// Note: One of the arguments will change, with the result coming back that way rather than
// Note: One of the arguments will change, with the result coming back that way rather than
// through the return value.
// through the return value.
void
promoteScalar
(
Decoration
precision
,
Id
&
left
,
Id
&
right
);
void
promoteScalar
(
Decoration
precision
,
Id
&
left
,
Id
&
right
);
// make a value by smearing the scalar to fill the type
// Make a value by smearing the scalar to fill the type.
Id
smearScalar
(
Decoration
precision
,
Id
scalarVal
,
Id
);
// vectorType should be the correct type for making a vector of scalarVal.
// (No conversions are done.)
Id
smearScalar
(
Decoration
precision
,
Id
scalarVal
,
Id
vectorType
);
// Create a call to a built-in function.
// Create a call to a built-in function.
Id
createBuiltinCall
(
Decoration
precision
,
Id
resultType
,
Id
builtins
,
int
entryPoint
,
std
::
vector
<
Id
>&
args
);
Id
createBuiltinCall
(
Decoration
precision
,
Id
resultType
,
Id
builtins
,
int
entryPoint
,
std
::
vector
<
Id
>&
args
);
...
...
glslang/Include/revision.h
View file @
76f71397
...
@@ -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 "SPIRV99.83
1
"
#define GLSLANG_REVISION "SPIRV99.83
6
"
#define GLSLANG_DATE "0
8
-Dec-2015"
#define GLSLANG_DATE "0
9
-Dec-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