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
e721f49d
Commit
e721f49d
authored
Dec 06, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Distinguish between std140 and std430 layouts, and correctly use alignments…
SPV: Distinguish between std140 and std430 layouts, and correctly use alignments as the base for strides.
parent
dd6ca178
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+12
-4
spv.140.frag.out
Test/baseResults/spv.140.frag.out
+1
-1
revision.h
glslang/Include/revision.h
+1
-1
No files found.
SPIRV/GlslangToSpv.cpp
View file @
e721f49d
...
@@ -1630,10 +1630,18 @@ bool TGlslangToSpvTraverser::requiresExplicitLayout(const glslang::TType& type)
...
@@ -1630,10 +1630,18 @@ bool TGlslangToSpvTraverser::requiresExplicitLayout(const glslang::TType& type)
// Given an array type, returns the integer stride required for that array
// Given an array type, returns the integer stride required for that array
int
TGlslangToSpvTraverser
::
getArrayStride
(
const
glslang
::
TType
&
arrayType
)
int
TGlslangToSpvTraverser
::
getArrayStride
(
const
glslang
::
TType
&
arrayType
)
{
{
glslang
::
TType
derefType
(
arrayType
,
0
);
int
size
;
int
size
;
glslangIntermediate
->
getBaseAlignment
(
derefType
,
size
,
true
);
int
stride
=
glslangIntermediate
->
getBaseAlignment
(
arrayType
,
size
,
arrayType
.
getQualifier
().
layoutPacking
==
glslang
::
ElpStd140
);
return
size
;
if
(
arrayType
.
isMatrix
())
{
// GLSL strides are set to alignments of the matrix flattened to individual rows/cols,
// but SPV needs an array stride for the whole matrix, not the rows/cols
if
(
arrayType
.
getQualifier
().
layoutMatrix
==
glslang
::
ElmRowMajor
)
stride
*=
arrayType
.
getMatrixRows
();
else
stride
*=
arrayType
.
getMatrixCols
();
}
return
stride
;
}
}
// Given a matrix type, returns the integer stride required for that matrix
// Given a matrix type, returns the integer stride required for that matrix
...
@@ -1641,7 +1649,7 @@ int TGlslangToSpvTraverser::getArrayStride(const glslang::TType& arrayType)
...
@@ -1641,7 +1649,7 @@ int TGlslangToSpvTraverser::getArrayStride(const glslang::TType& arrayType)
int
TGlslangToSpvTraverser
::
getMatrixStride
(
const
glslang
::
TType
&
matrixType
)
int
TGlslangToSpvTraverser
::
getMatrixStride
(
const
glslang
::
TType
&
matrixType
)
{
{
int
size
;
int
size
;
return
glslangIntermediate
->
getBaseAlignment
(
matrixType
,
size
,
true
);
return
glslangIntermediate
->
getBaseAlignment
(
matrixType
,
size
,
matrixType
.
getQualifier
().
layoutPacking
==
glslang
::
ElpStd140
);
}
}
// Given a member type of a struct, realign the current offset for it, and compute
// Given a member type of a struct, realign the current offset for it, and compute
...
...
Test/baseResults/spv.140.frag.out
View file @
e721f49d
...
@@ -54,7 +54,7 @@ Linked fragment stage:
...
@@ -54,7 +54,7 @@ Linked fragment stage:
MemberDecorate 88(bn) 4 Offset 640
MemberDecorate 88(bn) 4 Offset 640
MemberDecorate 88(bn) 4 MatrixStride 16
MemberDecorate 88(bn) 4 MatrixStride 16
Decorate 88(bn) Block
Decorate 88(bn) Block
Decorate 92 ArrayStride 1
2
Decorate 92 ArrayStride 1
6
MemberDecorate 93(bi) 0 Offset 0
MemberDecorate 93(bi) 0 Offset 0
Decorate 93(bi) Block
Decorate 93(bi) Block
2: TypeVoid
2: TypeVoid
...
...
glslang/Include/revision.h
View file @
e721f49d
...
@@ -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.82
1
"
#define GLSLANG_REVISION "SPIRV99.82
2
"
#define GLSLANG_DATE "06-Dec-2015"
#define GLSLANG_DATE "06-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