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
87a94fc0
Commit
87a94fc0
authored
May 23, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #302 from amdrexu/bugfix
SPV: Fix an issue of interpolation decoration.
parents
2921e0c5
bbceed7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+18
-8
spv.qualifiers.vert.out
Test/baseResults/spv.qualifiers.vert.out
+2
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
87a94fc0
...
...
@@ -108,7 +108,7 @@ public:
void
dumpSpv
(
std
::
vector
<
unsigned
int
>&
out
);
protected
:
spv
::
Decoration
Translate
Interpolation
Decoration
(
const
glslang
::
TQualifier
&
qualifier
);
spv
::
Decoration
Translate
AuxiliaryStorage
Decoration
(
const
glslang
::
TQualifier
&
qualifier
);
spv
::
BuiltIn
TranslateBuiltInDecoration
(
glslang
::
TBuiltInVariable
,
bool
member
);
spv
::
ImageFormat
TranslateImageFormat
(
const
glslang
::
TType
&
type
);
spv
::
Id
createSpvVariable
(
const
glslang
::
TIntermSymbol
*
);
...
...
@@ -354,18 +354,26 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T
// Translate glslang type to SPIR-V interpolation decorations.
// Returns spv::Decoration(spv::BadValue) when no decoration
// should be applied.
spv
::
Decoration
T
GlslangToSpvTraverser
::
T
ranslateInterpolationDecoration
(
const
glslang
::
TQualifier
&
qualifier
)
spv
::
Decoration
TranslateInterpolationDecoration
(
const
glslang
::
TQualifier
&
qualifier
)
{
if
(
qualifier
.
smooth
)
{
if
(
qualifier
.
smooth
)
// Smooth decoration doesn't exist in SPIR-V 1.0
return
(
spv
::
Decoration
)
spv
::
BadValue
;
}
if
(
qualifier
.
nopersp
)
else
if
(
qualifier
.
nopersp
)
return
spv
::
DecorationNoPerspective
;
else
if
(
qualifier
.
patch
)
return
spv
::
DecorationPatch
;
else
if
(
qualifier
.
flat
)
return
spv
::
DecorationFlat
;
else
return
(
spv
::
Decoration
)
spv
::
BadValue
;
}
// Translate glslang type to SPIR-V auxiliary storage decorations.
// Returns spv::Decoration(spv::BadValue) when no decoration
// should be applied.
spv
::
Decoration
TGlslangToSpvTraverser
::
TranslateAuxiliaryStorageDecoration
(
const
glslang
::
TQualifier
&
qualifier
)
{
if
(
qualifier
.
patch
)
return
spv
::
DecorationPatch
;
else
if
(
qualifier
.
centroid
)
return
spv
::
DecorationCentroid
;
else
if
(
qualifier
.
sample
)
{
...
...
@@ -1890,9 +1898,10 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
builder
.
addMemberName
(
spvType
,
member
,
glslangType
.
getFieldName
().
c_str
());
addMemberDecoration
(
spvType
,
member
,
TranslateLayoutDecoration
(
glslangType
,
subQualifier
.
layoutMatrix
));
addMemberDecoration
(
spvType
,
member
,
TranslatePrecisionDecoration
(
glslangType
));
// Add interpolation decorations only to top-level members of Input and Output storage classes
// Add interpolation
and auxiliary storage
decorations only to top-level members of Input and Output storage classes
if
(
type
.
getQualifier
().
storage
==
glslang
::
EvqVaryingIn
||
type
.
getQualifier
().
storage
==
glslang
::
EvqVaryingOut
)
{
addMemberDecoration
(
spvType
,
member
,
TranslateInterpolationDecoration
(
subQualifier
));
addMemberDecoration
(
spvType
,
member
,
TranslateAuxiliaryStorageDecoration
(
subQualifier
));
}
addMemberDecoration
(
spvType
,
member
,
TranslateInvariantDecoration
(
subQualifier
));
...
...
@@ -3917,6 +3926,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
if
(
!
symbol
->
getType
().
isStruct
())
{
addDecoration
(
id
,
TranslatePrecisionDecoration
(
symbol
->
getType
()));
addDecoration
(
id
,
TranslateInterpolationDecoration
(
symbol
->
getType
().
getQualifier
()));
addDecoration
(
id
,
TranslateAuxiliaryStorageDecoration
(
symbol
->
getType
().
getQualifier
()));
if
(
symbol
->
getType
().
getQualifier
().
hasSpecConstantId
())
addDecoration
(
id
,
spv
::
DecorationSpecId
,
symbol
->
getType
().
getQualifier
().
layoutSpecConstantId
);
if
(
symbol
->
getQualifier
().
hasIndex
())
...
...
Test/baseResults/spv.qualifiers.vert.out
View file @
87a94fc0
...
...
@@ -21,9 +21,11 @@ Linked vertex stage:
Name 15 "outVf"
Name 17 "outVn"
Name 19 "outVcn"
Decorate 9(outVc) Centroid
Decorate 15(outVf) Flat
Decorate 17(outVn) NoPerspective
Decorate 19(outVcn) NoPerspective
Decorate 19(outVcn) Centroid
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
...
...
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