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
91e69c03
Commit
91e69c03
authored
Jul 14, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Address #989: Don't add Location to built-ins when automapping.
parent
56d2b990
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
1 deletion
+81
-1
spv.noBuiltInLoc.vert.out
Test/baseResults/spv.noBuiltInLoc.vert.out
+51
-0
runtests
Test/runtests
+2
-0
spv.noBuiltInLoc.vert
Test/spv.noBuiltInLoc.vert
+14
-0
iomapper.cpp
glslang/MachineIndependent/iomapper.cpp
+14
-1
No files found.
Test/baseResults/spv.noBuiltInLoc.vert.out
0 → 100644
View file @
91e69c03
spv.noBuiltInLoc.vert
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 23
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 9 11 18
Source GLSL 450
Name 4 "main"
Name 9 "bar"
Name 11 "foo"
Name 16 "gl_PerVertex"
MemberName 16(gl_PerVertex) 0 "gl_Position"
MemberName 16(gl_PerVertex) 1 "gl_PointSize"
MemberName 16(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 16(gl_PerVertex) 3 "gl_CullDistance"
Name 18 ""
Decorate 9(bar) Location 0
Decorate 11(foo) Location 0
MemberDecorate 16(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 16(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 16(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 16(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 16(gl_PerVertex) Block
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(bar): 8(ptr) Variable Output
10: TypePointer Input 7(fvec4)
11(foo): 10(ptr) Variable Input
13: TypeInt 32 0
14: 13(int) Constant 1
15: TypeArray 6(float) 14
16(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 15 15
17: TypePointer Output 16(gl_PerVertex)
18: 17(ptr) Variable Output
19: TypeInt 32 1
20: 19(int) Constant 0
4(main): 2 Function None 3
5: Label
12: 7(fvec4) Load 11(foo)
Store 9(bar) 12
21: 7(fvec4) Load 11(foo)
22: 8(ptr) AccessChain 18 20
Store 22 21
Return
FunctionEnd
Test/runtests
View file @
91e69c03
...
@@ -103,6 +103,8 @@ diff -b $BASEDIR/hlsl.multiDescriptorSet.frag.out $TARGETDIR/hlsl.multiDescripto
...
@@ -103,6 +103,8 @@ diff -b $BASEDIR/hlsl.multiDescriptorSet.frag.out $TARGETDIR/hlsl.multiDescripto
echo
Testing SPV no location
echo
Testing SPV no location
$EXE
-V
-C
spv.noLocation.vert
>
$TARGETDIR
/spv.noLocation.vert.out
$EXE
-V
-C
spv.noLocation.vert
>
$TARGETDIR
/spv.noLocation.vert.out
diff
-b
$BASEDIR
/spv.noLocation.vert.out
$TARGETDIR
/spv.noLocation.vert.out
||
HASERROR
=
1
diff
-b
$BASEDIR
/spv.noLocation.vert.out
$TARGETDIR
/spv.noLocation.vert.out
||
HASERROR
=
1
$EXE
-H
--aml
spv.noBuiltInLoc.vert
>
$TARGETDIR
/spv.noBuiltInLoc.vert.out
diff
-b
$BASEDIR
/spv.noBuiltInLoc.vert.out
$TARGETDIR
/spv.noBuiltInLoc.vert.out
||
HASERROR
=
1
#
#
# Testing debug information
# Testing debug information
...
...
Test/spv.noBuiltInLoc.vert
0 → 100644
View file @
91e69c03
#version 450 core
layout
(
location
=
0
)
in
vec4
foo
;
layout
(
location
=
0
)
out
vec4
bar
;
void
main
()
{
bar
=
foo
;
gl_Position
=
foo
;
}
\ No newline at end of file
glslang/MachineIndependent/iomapper.cpp
View file @
91e69c03
...
@@ -413,9 +413,22 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
...
@@ -413,9 +413,22 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
}
}
int
resolveInOutLocation
(
EShLanguage
/*stage*/
,
const
char
*
/*name*/
,
const
TType
&
type
,
bool
/*is_live*/
)
override
int
resolveInOutLocation
(
EShLanguage
/*stage*/
,
const
char
*
/*name*/
,
const
TType
&
type
,
bool
/*is_live*/
)
override
{
{
if
(
!
doAutoLocationMapping
||
type
.
getQualifier
().
hasLocation
())
// kick out of not doing this
if
(
!
doAutoLocationMapping
)
return
-
1
;
return
-
1
;
// no locations added if already present, or a built-in variable
if
(
type
.
getQualifier
().
hasLocation
()
||
type
.
getQualifier
().
builtIn
!=
EbvNone
)
return
-
1
;
// no locations on blocks of built-in variables
if
(
type
.
isStruct
())
{
if
(
type
.
getStruct
()
->
size
()
<
1
)
return
-
1
;
if
((
*
type
.
getStruct
())[
0
].
type
->
getQualifier
().
builtIn
!=
EbvNone
)
return
-
1
;
}
// Placeholder.
// Placeholder.
// TODO: It would be nice to flesh this out using
// TODO: It would be nice to flesh this out using
// intermediate->computeTypeLocationSize(type), or functions that call it like
// intermediate->computeTypeLocationSize(type), or functions that call it like
...
...
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