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
cb32c544
Unverified
Commit
cb32c544
authored
Mar 15, 2018
by
John Kessenich
Committed by
GitHub
Mar 15, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1289 from Igalia/igalia/dmat-scalar-division
Use the correct type for the constant for matrix/scalar division
parents
075c8c11
eddb1318
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+2
-1
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+17
-0
SpvBuilder.h
SPIRV/SpvBuilder.h
+1
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
cb32c544
...
@@ -4137,7 +4137,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec
...
@@ -4137,7 +4137,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec
case
spv
:
:
OpFDiv
:
case
spv
:
:
OpFDiv
:
if
(
builder
.
isMatrix
(
left
)
&&
builder
.
isScalar
(
right
))
{
if
(
builder
.
isMatrix
(
left
)
&&
builder
.
isScalar
(
right
))
{
// turn matrix / scalar into a multiply...
// turn matrix / scalar into a multiply...
right
=
builder
.
createBinOp
(
spv
::
OpFDiv
,
builder
.
getTypeId
(
right
),
builder
.
makeFloatConstant
(
1.0
F
),
right
);
spv
::
Id
resultType
=
builder
.
getTypeId
(
right
);
right
=
builder
.
createBinOp
(
spv
::
OpFDiv
,
resultType
,
builder
.
makeFpConstant
(
resultType
,
1.0
),
right
);
op
=
spv
::
OpMatrixTimesScalar
;
op
=
spv
::
OpMatrixTimesScalar
;
}
else
}
else
firstClass
=
false
;
firstClass
=
false
;
...
...
SPIRV/SpvBuilder.cpp
View file @
cb32c544
...
@@ -848,6 +848,23 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant)
...
@@ -848,6 +848,23 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant)
return
c
->
getResultId
();
return
c
->
getResultId
();
}
}
Id
Builder
::
makeFpConstant
(
Id
type
,
double
d
,
bool
specConstant
)
{
assert
(
isFloatType
(
type
));
switch
(
getScalarTypeWidth
(
type
))
{
case
16
:
return
makeFloat16Constant
(
d
,
specConstant
);
case
32
:
return
makeFloatConstant
(
d
,
specConstant
);
case
64
:
return
makeDoubleConstant
(
d
,
specConstant
);
}
assert
(
false
);
}
Id
Builder
::
findCompositeConstant
(
Op
typeClass
,
const
std
::
vector
<
Id
>&
comps
)
Id
Builder
::
findCompositeConstant
(
Op
typeClass
,
const
std
::
vector
<
Id
>&
comps
)
{
{
Instruction
*
constant
=
0
;
Instruction
*
constant
=
0
;
...
...
SPIRV/SpvBuilder.h
View file @
cb32c544
...
@@ -226,6 +226,7 @@ public:
...
@@ -226,6 +226,7 @@ public:
Id
makeFloatConstant
(
float
f
,
bool
specConstant
=
false
);
Id
makeFloatConstant
(
float
f
,
bool
specConstant
=
false
);
Id
makeDoubleConstant
(
double
d
,
bool
specConstant
=
false
);
Id
makeDoubleConstant
(
double
d
,
bool
specConstant
=
false
);
Id
makeFloat16Constant
(
float
f16
,
bool
specConstant
=
false
);
Id
makeFloat16Constant
(
float
f16
,
bool
specConstant
=
false
);
Id
makeFpConstant
(
Id
type
,
double
d
,
bool
specConstant
=
false
);
// Turn the array of constants into a proper spv constant of the requested type.
// Turn the array of constants into a proper spv constant of the requested type.
Id
makeCompositeConstant
(
Id
type
,
const
std
::
vector
<
Id
>&
comps
,
bool
specConst
=
false
);
Id
makeCompositeConstant
(
Id
type
,
const
std
::
vector
<
Id
>&
comps
,
bool
specConst
=
false
);
...
...
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