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
569dd84a
Unverified
Commit
569dd84a
authored
Mar 21, 2018
by
John Kessenich
Committed by
GitHub
Mar 21, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1306 from Igalia/uniform-aml-v2
Improve --auto-map-locations for uniforms (v2)
parents
1b1ad97d
2d539049
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
2 deletions
+40
-2
spv.debugInfo.1.1.frag.out
Test/baseResults/spv.debugInfo.1.1.frag.out
+1
-0
spv.debugInfo.frag.out
Test/baseResults/spv.debugInfo.frag.out
+1
-0
iomapper.cpp
glslang/MachineIndependent/iomapper.cpp
+7
-2
linkValidate.cpp
glslang/MachineIndependent/linkValidate.cpp
+30
-0
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+1
-0
No files found.
Test/baseResults/spv.debugInfo.1.1.frag.out
View file @
569dd84a
...
@@ -94,6 +94,7 @@ void main()
...
@@ -94,6 +94,7 @@ void main()
MemberDecorate 54(ubuf) 0 Offset 0
MemberDecorate 54(ubuf) 0 Offset 0
Decorate 54(ubuf) Block
Decorate 54(ubuf) Block
Decorate 56 DescriptorSet 3
Decorate 56 DescriptorSet 3
Decorate 69(s2d) Location 0
Decorate 69(s2d) DescriptorSet 3
Decorate 69(s2d) DescriptorSet 3
3: TypeVoid
3: TypeVoid
4: TypeFunction 3
4: TypeFunction 3
...
...
Test/baseResults/spv.debugInfo.frag.out
View file @
569dd84a
...
@@ -97,6 +97,7 @@ void main()
...
@@ -97,6 +97,7 @@ void main()
Decorate 54(ubuf) Block
Decorate 54(ubuf) Block
Decorate 56 DescriptorSet 3
Decorate 56 DescriptorSet 3
Decorate 56 Binding 0
Decorate 56 Binding 0
Decorate 69(s2d) Location 0
Decorate 69(s2d) DescriptorSet 3
Decorate 69(s2d) DescriptorSet 3
Decorate 69(s2d) Binding 1
Decorate 69(s2d) Binding 1
3: TypeVoid
3: TypeVoid
...
...
glslang/MachineIndependent/iomapper.cpp
View file @
569dd84a
...
@@ -431,7 +431,8 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
...
@@ -431,7 +431,8 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
// no locations added if already present, a built-in variable, a block, or an opaque
// no locations added if already present, a built-in variable, a block, or an opaque
if
(
type
.
getQualifier
().
hasLocation
()
||
type
.
isBuiltIn
()
||
if
(
type
.
getQualifier
().
hasLocation
()
||
type
.
isBuiltIn
()
||
type
.
getBasicType
()
==
EbtBlock
||
type
.
containsOpaque
())
type
.
getBasicType
()
==
EbtBlock
||
(
type
.
containsOpaque
()
&&
intermediate
.
getSpv
().
openGl
==
0
))
return
-
1
;
return
-
1
;
// no locations on blocks of built-in variables
// no locations on blocks of built-in variables
...
@@ -442,7 +443,11 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
...
@@ -442,7 +443,11 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
return
-
1
;
return
-
1
;
}
}
return
nextUniformLocation
++
;
int
location
=
nextUniformLocation
;
nextUniformLocation
+=
TIntermediate
::
computeTypeUniformLocationSize
(
type
);
return
location
;
}
}
bool
validateInOut
(
EShLanguage
/*stage*/
,
const
char
*
/*name*/
,
const
TType
&
/*type*/
,
bool
/*is_live*/
)
override
bool
validateInOut
(
EShLanguage
/*stage*/
,
const
char
*
/*name*/
,
const
TType
&
/*type*/
,
bool
/*is_live*/
)
override
{
{
...
...
glslang/MachineIndependent/linkValidate.cpp
View file @
569dd84a
...
@@ -962,6 +962,36 @@ int TIntermediate::computeTypeLocationSize(const TType& type, EShLanguage stage)
...
@@ -962,6 +962,36 @@ int TIntermediate::computeTypeLocationSize(const TType& type, EShLanguage stage)
return
1
;
return
1
;
}
}
// Same as computeTypeLocationSize but for uniforms
int
TIntermediate
::
computeTypeUniformLocationSize
(
const
TType
&
type
)
{
// "Individual elements of a uniform array are assigned
// consecutive locations with the first element taking location
// location."
if
(
type
.
isArray
())
{
// TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness
TType
elementType
(
type
,
0
);
if
(
type
.
isImplicitlySizedArray
())
{
// TODO: are there valid cases of having an implicitly-sized array with a location? If so, running this code too early.
return
computeTypeUniformLocationSize
(
elementType
);
}
else
return
type
.
getOuterArraySize
()
*
computeTypeUniformLocationSize
(
elementType
);
}
// "Each subsequent inner-most member or element gets incremental
// locations for the entire structure or array."
if
(
type
.
isStruct
())
{
int
size
=
0
;
for
(
int
member
=
0
;
member
<
(
int
)
type
.
getStruct
()
->
size
();
++
member
)
{
TType
memberType
(
type
,
member
);
size
+=
computeTypeUniformLocationSize
(
memberType
);
}
return
size
;
}
return
1
;
}
// Accumulate xfb buffer ranges and check for collisions as the accumulation is done.
// Accumulate xfb buffer ranges and check for collisions as the accumulation is done.
//
//
// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
...
...
glslang/MachineIndependent/localintermediate.h
View file @
569dd84a
...
@@ -590,6 +590,7 @@ public:
...
@@ -590,6 +590,7 @@ public:
int
addUsedOffsets
(
int
binding
,
int
offset
,
int
numOffsets
);
int
addUsedOffsets
(
int
binding
,
int
offset
,
int
numOffsets
);
bool
addUsedConstantId
(
int
id
);
bool
addUsedConstantId
(
int
id
);
static
int
computeTypeLocationSize
(
const
TType
&
,
EShLanguage
);
static
int
computeTypeLocationSize
(
const
TType
&
,
EShLanguage
);
static
int
computeTypeUniformLocationSize
(
const
TType
&
);
bool
setXfbBufferStride
(
int
buffer
,
unsigned
stride
)
bool
setXfbBufferStride
(
int
buffer
,
unsigned
stride
)
{
{
...
...
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