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
76d4dfcd
Commit
76d4dfcd
authored
Jun 16, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV non-functional: minor readability improvements for texturing.
parent
ac666e73
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
42 deletions
+49
-42
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+28
-10
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+3
-3
SpvBuilder.h
SPIRV/SpvBuilder.h
+1
-1
spv.430.vert.out
Test/baseResults/spv.430.vert.out
+0
-3
spv.layoutNested.vert.out
Test/baseResults/spv.layoutNested.vert.out
+17
-25
spv.localAggregates.frag.out
Test/baseResults/spv.localAggregates.frag.out
+0
-0
spv.variableArrayIndex.frag.out
Test/baseResults/spv.variableArrayIndex.frag.out
+0
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
76d4dfcd
...
...
@@ -643,9 +643,9 @@ bool HasNonLayoutQualifiers(const glslang::TQualifier& qualifier)
{
// This should list qualifiers that simultaneous satisfy:
// - struct members can inherit from a struct declaration
// -
e
ffect decorations on the struct members (note smooth does not, and expecting something like volatile to effect the whole object)
// -
a
ffect decorations on the struct members (note smooth does not, and expecting something like volatile to effect the whole object)
// - are not part of the offset/st430/etc or row/column-major layout
return
qualifier
.
invariant
||
qualifier
.
nopersp
||
qualifier
.
flat
||
qualifier
.
centroid
||
qualifier
.
patch
||
qualifier
.
sample
||
qualifier
.
hasLocation
();
return
qualifier
.
invariant
||
qualifier
.
hasLocation
();
}
//
...
...
@@ -1913,8 +1913,10 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
addMemberDecoration
(
spvType
,
member
,
TranslatePrecisionDecoration
(
glslangType
));
// 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
));
if
(
type
.
getBasicType
()
==
glslang
::
EbtBlock
)
{
addMemberDecoration
(
spvType
,
member
,
TranslateInterpolationDecoration
(
subQualifier
));
addMemberDecoration
(
spvType
,
member
,
TranslateAuxiliaryStorageDecoration
(
subQualifier
));
}
}
addMemberDecoration
(
spvType
,
member
,
TranslateInvariantDecoration
(
subQualifier
));
...
...
@@ -2606,14 +2608,16 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
++
extraArgs
;
}
else
if
(
sampler
.
shadow
)
{
std
::
vector
<
spv
::
Id
>
indexes
;
int
c
omp
;
int
dRefC
omp
;
if
(
cracked
.
proj
)
c
omp
=
2
;
// "The resulting 3rd component of P in the shadow forms is used as Dref"
dRefC
omp
=
2
;
// "The resulting 3rd component of P in the shadow forms is used as Dref"
else
c
omp
=
builder
.
getNumComponents
(
params
.
coords
)
-
1
;
indexes
.
push_back
(
c
omp
);
dRefC
omp
=
builder
.
getNumComponents
(
params
.
coords
)
-
1
;
indexes
.
push_back
(
dRefC
omp
);
params
.
Dref
=
builder
.
createCompositeExtract
(
params
.
coords
,
builder
.
getScalarTypeId
(
builder
.
getTypeId
(
params
.
coords
)),
indexes
);
}
// lod
if
(
cracked
.
lod
)
{
params
.
lod
=
arguments
[
2
];
++
extraArgs
;
...
...
@@ -2621,15 +2625,21 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
// we need to invent the default lod for an explicit lod instruction for a non-fragment stage
noImplicitLod
=
true
;
}
// multisample
if
(
sampler
.
ms
)
{
params
.
sample
=
arguments
[
2
];
// For MS, "sample" should be specified
++
extraArgs
;
}
// gradient
if
(
cracked
.
grad
)
{
params
.
gradX
=
arguments
[
2
+
extraArgs
];
params
.
gradY
=
arguments
[
3
+
extraArgs
];
extraArgs
+=
2
;
}
// offset and offsets
if
(
cracked
.
offset
)
{
params
.
offset
=
arguments
[
2
+
extraArgs
];
++
extraArgs
;
...
...
@@ -2637,25 +2647,33 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
params
.
offsets
=
arguments
[
2
+
extraArgs
];
++
extraArgs
;
}
// lod clamp
if
(
cracked
.
lodClamp
)
{
params
.
lodClamp
=
arguments
[
2
+
extraArgs
];
++
extraArgs
;
}
// sparse
if
(
sparse
)
{
params
.
texelOut
=
arguments
[
2
+
extraArgs
];
++
extraArgs
;
}
// bias
if
(
bias
)
{
params
.
bias
=
arguments
[
2
+
extraArgs
];
++
extraArgs
;
}
// gather component
if
(
cracked
.
gather
&&
!
sampler
.
shadow
)
{
// default component is 0, if missing, otherwise an argument
if
(
2
+
extraArgs
<
(
int
)
arguments
.
size
())
{
params
.
comp
=
arguments
[
2
+
extraArgs
];
params
.
comp
onent
=
arguments
[
2
+
extraArgs
];
++
extraArgs
;
}
else
{
params
.
comp
=
builder
.
makeIntConstant
(
0
);
params
.
comp
onent
=
builder
.
makeIntConstant
(
0
);
}
}
...
...
SPIRV/SpvBuilder.cpp
View file @
76d4dfcd
...
...
@@ -1430,10 +1430,10 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
bool
explicitLod
=
false
;
texArgs
[
numArgs
++
]
=
parameters
.
sampler
;
texArgs
[
numArgs
++
]
=
parameters
.
coords
;
if
(
parameters
.
Dref
)
if
(
parameters
.
Dref
!=
NoResult
)
texArgs
[
numArgs
++
]
=
parameters
.
Dref
;
if
(
parameters
.
comp
)
texArgs
[
numArgs
++
]
=
parameters
.
comp
;
if
(
parameters
.
comp
onent
!=
NoResult
)
texArgs
[
numArgs
++
]
=
parameters
.
comp
onent
;
//
// Set up the optional arguments
...
...
SPIRV/SpvBuilder.h
View file @
76d4dfcd
...
...
@@ -321,7 +321,7 @@ public:
Id
gradX
;
Id
gradY
;
Id
sample
;
Id
comp
;
Id
comp
onent
;
Id
texelOut
;
Id
lodClamp
;
};
...
...
Test/baseResults/spv.430.vert.out
View file @
76d4dfcd
...
...
@@ -63,9 +63,6 @@ Linked vertex stage:
Decorate 55(sampb2) Binding 5
Decorate 56(sampb4) DescriptorSet 0
Decorate 56(sampb4) Binding 31
MemberDecorate 60(SS) 0 Flat
MemberDecorate 60(SS) 1 Flat
MemberDecorate 60(SS) 2 Flat
Decorate 62(var) Location 0
MemberDecorate 63(MS) 0 Location 17
Decorate 63(MS) Block
...
...
Test/baseResults/spv.layoutNested.vert.out
View file @
76d4dfcd
...
...
@@ -7,12 +7,12 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 6
7
// Id's are bound by 6
6
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 6
3 66
EntryPoint Vertex 4 "main" 6
2 65
Source GLSL 450
Name 4 "main"
Name 14 "S"
...
...
@@ -82,16 +82,12 @@ Linked vertex stage:
MemberName 58(bBt3) 0 "ntcol"
MemberName 58(bBt3) 1 "ntrow"
Name 60 "bBtn3"
Name 61 "S"
MemberName 61(S) 0 "a"
MemberName 61(S) 1 "b"
MemberName 61(S) 2 "c"
Name 63 "sout"
Name 64 "S"
MemberName 64(S) 0 "a"
MemberName 64(S) 1 "b"
MemberName 64(S) 2 "c"
Name 66 "soutinv"
Name 62 "sout"
Name 63 "S"
MemberName 63(S) 0 "a"
MemberName 63(S) 1 "b"
MemberName 63(S) 2 "c"
Name 65 "soutinv"
Decorate 13 ArrayStride 32
MemberDecorate 14(S) 0 Offset 0
MemberDecorate 14(S) 1 ColMajor
...
...
@@ -166,13 +162,10 @@ Linked vertex stage:
Decorate 58(bBt3) BufferBlock
Decorate 60(bBtn3) DescriptorSet 1
Decorate 60(bBtn3) Binding 0
MemberDecorate 61(S) 0 Flat
MemberDecorate 61(S) 1 Flat
MemberDecorate 61(S) 2 Flat
MemberDecorate 64(S) 0 Invariant
MemberDecorate 64(S) 1 Invariant
MemberDecorate 64(S) 2 Invariant
Decorate 66(soutinv) Invariant
MemberDecorate 63(S) 0 Invariant
MemberDecorate 63(S) 1 Invariant
MemberDecorate 63(S) 2 Invariant
Decorate 65(soutinv) Invariant
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
...
...
@@ -230,12 +223,11 @@ Linked vertex stage:
58(bBt3): TypeStruct 49(Nestor) 54(Nestor)
59: TypePointer Uniform 58(bBt3)
60(bBtn3): 59(ptr) Variable Uniform
61(S): TypeStruct 8(ivec3) 13 7(int)
62: TypePointer Output 61(S)
63(sout): 62(ptr) Variable Output
64(S): TypeStruct 8(ivec3) 13 7(int)
65: TypePointer Output 64(S)
66(soutinv): 65(ptr) Variable Output
61: TypePointer Output 29(S)
62(sout): 61(ptr) Variable Output
63(S): TypeStruct 8(ivec3) 13 7(int)
64: TypePointer Output 63(S)
65(soutinv): 64(ptr) Variable Output
4(main): 2 Function None 3
5: Label
Return
...
...
Test/baseResults/spv.localAggregates.frag.out
View file @
76d4dfcd
This diff is collapsed.
Click to expand it.
Test/baseResults/spv.variableArrayIndex.frag.out
View file @
76d4dfcd
This diff is collapsed.
Click to expand it.
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