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
a353bf1f
Commit
a353bf1f
authored
Jul 28, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nonfunctional: Add reflect test case, and fix long lines in reflection code.
parent
2ceec681
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
9 deletions
+49
-9
reflection.vert.out
Test/baseResults/reflection.vert.out
+8
-0
reflection.vert
Test/reflection.vert
+24
-0
reflection.cpp
glslang/MachineIndependent/reflection.cpp
+17
-9
No files found.
Test/baseResults/reflection.vert.out
View file @
a353bf1f
...
@@ -70,6 +70,9 @@ deepD[1].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1
...
@@ -70,6 +70,9 @@ deepD[1].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1
deepD[1].v3: offset -1, type 8b54, size 1, index -1, binding -1
deepD[1].v3: offset -1, type 8b54, size 1, index -1, binding -1
abl.foo: offset 0, type 1406, size 1, index 7, binding -1
abl.foo: offset 0, type 1406, size 1, index 7, binding -1
abl2.foo: offset 0, type 1406, size 1, index 11, binding -1
abl2.foo: offset 0, type 1406, size 1, index 11, binding -1
buf1.runtimeArray: offset 4, type 1406, size 4, index 12, binding -1
buf2.runtimeArray.c: offset 8, type 1406, size 1, index 13, binding -1
buf3.runtimeArray: offset 4, type 1406, size 0, index 14, binding -1
anonMember1: offset 0, type 8b51, size 1, index 0, binding -1
anonMember1: offset 0, type 8b51, size 1, index 0, binding -1
uf1: offset -1, type 1406, size 1, index -1, binding -1
uf1: offset -1, type 1406, size 1, index -1, binding -1
uf2: offset -1, type 1406, size 1, index -1, binding -1
uf2: offset -1, type 1406, size 1, index -1, binding -1
...
@@ -88,6 +91,10 @@ abl2[0]: offset -1, type ffffffff, size 4, index -1, binding -1
...
@@ -88,6 +91,10 @@ abl2[0]: offset -1, type ffffffff, size 4, index -1, binding -1
abl2[1]: offset -1, type ffffffff, size 4, index -1, binding -1
abl2[1]: offset -1, type ffffffff, size 4, index -1, binding -1
abl2[2]: offset -1, type ffffffff, size 4, index -1, binding -1
abl2[2]: offset -1, type ffffffff, size 4, index -1, binding -1
abl2[3]: offset -1, type ffffffff, size 4, index -1, binding -1
abl2[3]: offset -1, type ffffffff, size 4, index -1, binding -1
buf1: offset -1, type ffffffff, size 4, index -1, binding -1
buf2: offset -1, type ffffffff, size 4, index -1, binding -1
buf3: offset -1, type ffffffff, size 4, index -1, binding -1
buf4: offset -1, type ffffffff, size 4, index -1, binding -1
Vertex attribute reflection:
Vertex attribute reflection:
attributeFloat: offset 0, type 1406, size 0, index 0, binding -1
attributeFloat: offset 0, type 1406, size 0, index 0, binding -1
...
@@ -95,4 +102,5 @@ attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1
...
@@ -95,4 +102,5 @@ attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1
attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1
attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1
attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1
attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1
attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1
attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1
gl_InstanceID: offset 0, type 1404, size 0, index 0, binding -1
Test/reflection.vert
View file @
a353bf1f
...
@@ -133,6 +133,26 @@ uniform abl2 {
...
@@ -133,6 +133,26 @@ uniform abl2 {
float
foo
;
float
foo
;
}
arrBl2
[
4
];
}
arrBl2
[
4
];
buffer
buf1
{
float
scalar
;
float
runtimeArray
[];
}
buf1i
;
buffer
buf2
{
float
scalar
;
N2
runtimeArray
[];
}
buf2i
;
buffer
buf3
{
float
scalar
;
float
runtimeArray
[];
}
buf3i
;
buffer
buf4
{
float
scalar
;
N2
runtimeArray
[];
}
buf4i
;
void
main
()
void
main
()
{
{
liveFunction1
(
image_ui2D
,
sampler_2D
,
sampler_2DMSArray
);
liveFunction1
(
image_ui2D
,
sampler_2D
,
sampler_2DMSArray
);
...
@@ -179,4 +199,8 @@ void main()
...
@@ -179,4 +199,8 @@ void main()
f
+=
attributeFloat3
.
x
;
f
+=
attributeFloat3
.
x
;
f
+=
attributeFloat4
.
x
;
f
+=
attributeFloat4
.
x
;
f
+=
attributeMat4
[
0
][
1
];
f
+=
attributeMat4
[
0
][
1
];
f
+=
buf1i
.
runtimeArray
[
3
];
f
+=
buf2i
.
runtimeArray
[
3
].
c
;
f
+=
buf3i
.
runtimeArray
[
gl_InstanceID
];
f
+=
buf4i
.
runtimeArray
[
gl_InstanceID
].
c
;
}
}
glslang/MachineIndependent/reflection.cpp
View file @
a353bf1f
...
@@ -131,8 +131,11 @@ public:
...
@@ -131,8 +131,11 @@ public:
for
(
int
m
=
0
;
m
<=
index
;
++
m
)
{
for
(
int
m
=
0
;
m
<=
index
;
++
m
)
{
// modify just the children's view of matrix layout, if there is one for this member
// modify just the children's view of matrix layout, if there is one for this member
TLayoutMatrix
subMatrixLayout
=
memberList
[
m
].
type
->
getQualifier
().
layoutMatrix
;
TLayoutMatrix
subMatrixLayout
=
memberList
[
m
].
type
->
getQualifier
().
layoutMatrix
;
int
memberAlignment
=
intermediate
.
getBaseAlignment
(
*
memberList
[
m
].
type
,
memberSize
,
dummyStride
,
type
.
getQualifier
().
layoutPacking
==
ElpStd140
,
int
memberAlignment
=
intermediate
.
getBaseAlignment
(
*
memberList
[
m
].
type
,
memberSize
,
dummyStride
,
subMatrixLayout
!=
ElmNone
?
subMatrixLayout
==
ElmRowMajor
:
type
.
getQualifier
().
layoutMatrix
==
ElmRowMajor
);
type
.
getQualifier
().
layoutPacking
==
ElpStd140
,
subMatrixLayout
!=
ElmNone
?
subMatrixLayout
==
ElmRowMajor
:
type
.
getQualifier
().
layoutMatrix
==
ElmRowMajor
);
RoundToPow2
(
offset
,
memberAlignment
);
RoundToPow2
(
offset
,
memberAlignment
);
if
(
m
<
index
)
if
(
m
<
index
)
offset
+=
memberSize
;
offset
+=
memberSize
;
...
@@ -151,7 +154,8 @@ public:
...
@@ -151,7 +154,8 @@ public:
int
lastMemberSize
;
int
lastMemberSize
;
int
dummyStride
;
int
dummyStride
;
intermediate
.
getBaseAlignment
(
*
memberList
[
lastIndex
].
type
,
lastMemberSize
,
dummyStride
,
blockType
.
getQualifier
().
layoutPacking
==
ElpStd140
,
intermediate
.
getBaseAlignment
(
*
memberList
[
lastIndex
].
type
,
lastMemberSize
,
dummyStride
,
blockType
.
getQualifier
().
layoutPacking
==
ElpStd140
,
blockType
.
getQualifier
().
layoutMatrix
==
ElmRowMajor
);
blockType
.
getQualifier
().
layoutMatrix
==
ElmRowMajor
);
return
lastOffset
+
lastMemberSize
;
return
lastOffset
+
lastMemberSize
;
...
@@ -167,7 +171,7 @@ public:
...
@@ -167,7 +171,7 @@ public:
void
blowUpActiveAggregate
(
const
TType
&
baseType
,
const
TString
&
baseName
,
const
TList
<
TIntermBinary
*>&
derefs
,
void
blowUpActiveAggregate
(
const
TType
&
baseType
,
const
TString
&
baseName
,
const
TList
<
TIntermBinary
*>&
derefs
,
TList
<
TIntermBinary
*>::
const_iterator
deref
,
int
offset
,
int
blockIndex
,
int
arraySize
)
TList
<
TIntermBinary
*>::
const_iterator
deref
,
int
offset
,
int
blockIndex
,
int
arraySize
)
{
{
// process the part of the derefence chain that was explicit in the shader
// process the part of the derefe
re
nce chain that was explicit in the shader
TString
name
=
baseName
;
TString
name
=
baseName
;
const
TType
*
terminalType
=
&
baseType
;
const
TType
*
terminalType
=
&
baseType
;
for
(;
deref
!=
derefs
.
end
();
++
deref
)
{
for
(;
deref
!=
derefs
.
end
();
++
deref
)
{
...
@@ -235,7 +239,7 @@ public:
...
@@ -235,7 +239,7 @@ public:
}
}
// Finally, add a full string to the reflection database, and update the array size if necessary.
// Finally, add a full string to the reflection database, and update the array size if necessary.
// If the derefenced entity to record is an array, compute the size and update the maximum size.
// If the derefe
re
nced entity to record is an array, compute the size and update the maximum size.
// there might not be a final array dereference, it could have been copied as an array object
// there might not be a final array dereference, it could have been copied as an array object
if
(
arraySize
==
0
)
if
(
arraySize
==
0
)
...
@@ -244,7 +248,8 @@ public:
...
@@ -244,7 +248,8 @@ public:
TReflection
::
TNameToIndex
::
const_iterator
it
=
reflection
.
nameToIndex
.
find
(
name
);
TReflection
::
TNameToIndex
::
const_iterator
it
=
reflection
.
nameToIndex
.
find
(
name
);
if
(
it
==
reflection
.
nameToIndex
.
end
())
{
if
(
it
==
reflection
.
nameToIndex
.
end
())
{
reflection
.
nameToIndex
[
name
]
=
(
int
)
reflection
.
indexToUniform
.
size
();
reflection
.
nameToIndex
[
name
]
=
(
int
)
reflection
.
indexToUniform
.
size
();
reflection
.
indexToUniform
.
push_back
(
TObjectReflection
(
name
,
*
terminalType
,
offset
,
mapToGlType
(
*
terminalType
),
reflection
.
indexToUniform
.
push_back
(
TObjectReflection
(
name
,
*
terminalType
,
offset
,
mapToGlType
(
*
terminalType
),
arraySize
,
blockIndex
));
arraySize
,
blockIndex
));
}
else
if
(
arraySize
>
1
)
{
}
else
if
(
arraySize
>
1
)
{
int
&
reflectedArraySize
=
reflection
.
indexToUniform
[
it
->
second
].
size
;
int
&
reflectedArraySize
=
reflection
.
indexToUniform
[
it
->
second
].
size
;
...
@@ -417,7 +422,8 @@ public:
...
@@ -417,7 +422,8 @@ public:
case
Esd2D
:
case
Esd2D
:
switch
((
int
)
sampler
.
ms
)
{
switch
((
int
)
sampler
.
ms
)
{
case
false
:
return
sampler
.
arrayed
?
GL_INT_SAMPLER_2D_ARRAY
:
GL_INT_SAMPLER_2D
;
case
false
:
return
sampler
.
arrayed
?
GL_INT_SAMPLER_2D_ARRAY
:
GL_INT_SAMPLER_2D
;
case
true
:
return
sampler
.
arrayed
?
GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
:
GL_INT_SAMPLER_2D_MULTISAMPLE
;
case
true
:
return
sampler
.
arrayed
?
GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
:
GL_INT_SAMPLER_2D_MULTISAMPLE
;
}
}
case
Esd3D
:
case
Esd3D
:
return
GL_INT_SAMPLER_3D
;
return
GL_INT_SAMPLER_3D
;
...
@@ -435,7 +441,8 @@ public:
...
@@ -435,7 +441,8 @@ public:
case
Esd2D
:
case
Esd2D
:
switch
((
int
)
sampler
.
ms
)
{
switch
((
int
)
sampler
.
ms
)
{
case
false
:
return
sampler
.
arrayed
?
GL_UNSIGNED_INT_SAMPLER_2D_ARRAY
:
GL_UNSIGNED_INT_SAMPLER_2D
;
case
false
:
return
sampler
.
arrayed
?
GL_UNSIGNED_INT_SAMPLER_2D_ARRAY
:
GL_UNSIGNED_INT_SAMPLER_2D
;
case
true
:
return
sampler
.
arrayed
?
GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
:
GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE
;
case
true
:
return
sampler
.
arrayed
?
GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
:
GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE
;
}
}
case
Esd3D
:
case
Esd3D
:
return
GL_UNSIGNED_INT_SAMPLER_3D
;
return
GL_UNSIGNED_INT_SAMPLER_3D
;
...
@@ -495,7 +502,8 @@ public:
...
@@ -495,7 +502,8 @@ public:
case
Esd2D
:
case
Esd2D
:
switch
((
int
)
sampler
.
ms
)
{
switch
((
int
)
sampler
.
ms
)
{
case
false
:
return
sampler
.
arrayed
?
GL_UNSIGNED_INT_IMAGE_2D_ARRAY
:
GL_UNSIGNED_INT_IMAGE_2D
;
case
false
:
return
sampler
.
arrayed
?
GL_UNSIGNED_INT_IMAGE_2D_ARRAY
:
GL_UNSIGNED_INT_IMAGE_2D
;
case
true
:
return
sampler
.
arrayed
?
GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY
:
GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE
;
case
true
:
return
sampler
.
arrayed
?
GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY
:
GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE
;
}
}
case
Esd3D
:
case
Esd3D
:
return
GL_UNSIGNED_INT_IMAGE_3D
;
return
GL_UNSIGNED_INT_IMAGE_3D
;
...
...
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