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
7d814198
Commit
7d814198
authored
May 25, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #309 from jekstrand/sampler-params
SPV: Don't shadow sampler parameters when performing function calls
parents
747c328c
76d0ac1a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+10
-5
spv.subpass.frag.out
Test/baseResults/spv.subpass.frag.out
+2
-6
No files found.
SPIRV/GlslangToSpv.cpp
View file @
7d814198
...
@@ -2652,12 +2652,13 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
...
@@ -2652,12 +2652,13 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
std
::
vector
<
spv
::
Id
>
rValues
;
std
::
vector
<
spv
::
Id
>
rValues
;
std
::
vector
<
const
glslang
::
TType
*>
argTypes
;
std
::
vector
<
const
glslang
::
TType
*>
argTypes
;
for
(
int
a
=
0
;
a
<
(
int
)
glslangArgs
.
size
();
++
a
)
{
for
(
int
a
=
0
;
a
<
(
int
)
glslangArgs
.
size
();
++
a
)
{
const
glslang
::
TType
&
paramType
=
glslangArgs
[
a
]
->
getAsTyped
()
->
getType
();
// build l-value
// build l-value
builder
.
clearAccessChain
();
builder
.
clearAccessChain
();
glslangArgs
[
a
]
->
traverse
(
this
);
glslangArgs
[
a
]
->
traverse
(
this
);
argTypes
.
push_back
(
&
glslangArgs
[
a
]
->
getAsTyped
()
->
getType
()
);
argTypes
.
push_back
(
&
paramType
);
// keep outputs as l-values, evaluate input-only as r-values
// keep outputs as
and samplers
l-values, evaluate input-only as r-values
if
(
qualifiers
[
a
]
!=
glslang
::
EvqConstReadOnly
)
{
if
(
qualifiers
[
a
]
!=
glslang
::
EvqConstReadOnly
||
paramType
.
getBasicType
()
==
glslang
::
EbtSampler
)
{
// save l-value
// save l-value
lValues
.
push_back
(
builder
.
getAccessChain
());
lValues
.
push_back
(
builder
.
getAccessChain
());
}
else
{
}
else
{
...
@@ -2674,10 +2675,14 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
...
@@ -2674,10 +2675,14 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
int
rValueCount
=
0
;
int
rValueCount
=
0
;
std
::
vector
<
spv
::
Id
>
spvArgs
;
std
::
vector
<
spv
::
Id
>
spvArgs
;
for
(
int
a
=
0
;
a
<
(
int
)
glslangArgs
.
size
();
++
a
)
{
for
(
int
a
=
0
;
a
<
(
int
)
glslangArgs
.
size
();
++
a
)
{
const
glslang
::
TType
&
paramType
=
glslangArgs
[
a
]
->
getAsTyped
()
->
getType
();
spv
::
Id
arg
;
spv
::
Id
arg
;
if
(
qualifiers
[
a
]
!=
glslang
::
EvqConstReadOnly
)
{
if
(
paramType
.
getBasicType
()
==
glslang
::
EbtSampler
)
{
builder
.
setAccessChain
(
lValues
[
lValueCount
]);
arg
=
builder
.
accessChainGetLValue
();
++
lValueCount
;
}
else
if
(
qualifiers
[
a
]
!=
glslang
::
EvqConstReadOnly
)
{
// need space to hold the copy
// need space to hold the copy
const
glslang
::
TType
&
paramType
=
glslangArgs
[
a
]
->
getAsTyped
()
->
getType
();
arg
=
builder
.
createVariable
(
spv
::
StorageClassFunction
,
convertGlslangToSpvType
(
paramType
),
"param"
);
arg
=
builder
.
createVariable
(
spv
::
StorageClassFunction
,
convertGlslangToSpvType
(
paramType
),
"param"
);
if
(
qualifiers
[
a
]
==
glslang
::
EvqIn
||
qualifiers
[
a
]
==
glslang
::
EvqInOut
)
{
if
(
qualifiers
[
a
]
==
glslang
::
EvqIn
||
qualifiers
[
a
]
==
glslang
::
EvqInOut
)
{
// need to copy the input into output space
// need to copy the input into output space
...
...
Test/baseResults/spv.subpass.frag.out
View file @
7d814198
...
@@ -7,7 +7,7 @@ Linked fragment stage:
...
@@ -7,7 +7,7 @@ Linked fragment stage:
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by
70
// Id's are bound by
68
Capability Shader
Capability Shader
Capability InputAttachment
Capability InputAttachment
...
@@ -28,7 +28,6 @@ Linked fragment stage:
...
@@ -28,7 +28,6 @@ Linked fragment stage:
Name 54 "ucolor"
Name 54 "ucolor"
Name 57 "usub"
Name 57 "usub"
Name 62 "usubMS"
Name 62 "usubMS"
Name 67 "param"
Decorate 30(sub) DescriptorSet 0
Decorate 30(sub) DescriptorSet 0
Decorate 30(sub) InputAttachmentIndex 1
Decorate 30(sub) InputAttachmentIndex 1
Decorate 35(subMS) DescriptorSet 0
Decorate 35(subMS) DescriptorSet 0
...
@@ -81,7 +80,6 @@ Linked fragment stage:
...
@@ -81,7 +80,6 @@ Linked fragment stage:
62(usubMS): 61(ptr) Variable UniformConstant
62(usubMS): 61(ptr) Variable UniformConstant
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
67(param): 8(ptr) Variable Function
31: 28 Load 30(sub)
31: 28 Load 30(sub)
32: 25(fvec4) ImageRead 31 20
32: 25(fvec4) ImageRead 31 20
Store 27(color) 32
Store 27(color) 32
...
@@ -106,9 +104,7 @@ Linked fragment stage:
...
@@ -106,9 +104,7 @@ Linked fragment stage:
65: 52(ivec4) Load 54(ucolor)
65: 52(ivec4) Load 54(ucolor)
66: 52(ivec4) IAdd 65 64
66: 52(ivec4) IAdd 65 64
Store 54(ucolor) 66
Store 54(ucolor) 66
68: 7 Load 46(isubMS)
67: 2 FunctionCall 11(foo(iIPM1;) 46(isubMS)
Store 67(param) 68
69: 2 FunctionCall 11(foo(iIPM1;) 67(param)
Return
Return
FunctionEnd
FunctionEnd
11(foo(iIPM1;): 2 Function None 9
11(foo(iIPM1;): 2 Function None 9
...
...
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