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
4f50a463
Unverified
Commit
4f50a463
authored
Feb 01, 2019
by
John Kessenich
Committed by
GitHub
Feb 01, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1688 from mattparks/patch-1
Switched to std::string for TReflection and TObjectReflection
parents
de3b8e3b
91af9401
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
reflection.cpp
glslang/MachineIndependent/reflection.cpp
+11
-11
reflection.h
glslang/MachineIndependent/reflection.h
+3
-3
No files found.
glslang/MachineIndependent/reflection.cpp
View file @
4f50a463
...
@@ -105,10 +105,10 @@ public:
...
@@ -105,10 +105,10 @@ public:
const
TString
&
name
=
base
.
getName
();
const
TString
&
name
=
base
.
getName
();
const
TType
&
type
=
base
.
getType
();
const
TType
&
type
=
base
.
getType
();
TReflection
::
TNameToIndex
::
const_iterator
it
=
reflection
.
nameToIndex
.
find
(
name
);
TReflection
::
TNameToIndex
::
const_iterator
it
=
reflection
.
nameToIndex
.
find
(
name
.
c_str
()
);
if
(
it
==
reflection
.
nameToIndex
.
end
())
{
if
(
it
==
reflection
.
nameToIndex
.
end
())
{
reflection
.
nameToIndex
[
name
]
=
(
int
)
reflection
.
indexToAttribute
.
size
();
reflection
.
nameToIndex
[
name
.
c_str
()
]
=
(
int
)
reflection
.
indexToAttribute
.
size
();
reflection
.
indexToAttribute
.
push_back
(
TObjectReflection
(
name
,
type
,
0
,
mapToGlType
(
type
),
0
,
0
));
reflection
.
indexToAttribute
.
push_back
(
TObjectReflection
(
name
.
c_str
()
,
type
,
0
,
mapToGlType
(
type
),
0
,
0
));
}
}
}
}
}
}
...
@@ -327,10 +327,10 @@ public:
...
@@ -327,10 +327,10 @@ public:
if
(
arraySize
==
0
)
if
(
arraySize
==
0
)
arraySize
=
mapToGlArraySize
(
*
terminalType
);
arraySize
=
mapToGlArraySize
(
*
terminalType
);
TReflection
::
TNameToIndex
::
const_iterator
it
=
reflection
.
nameToIndex
.
find
(
name
);
TReflection
::
TNameToIndex
::
const_iterator
it
=
reflection
.
nameToIndex
.
find
(
name
.
c_str
()
);
if
(
it
==
reflection
.
nameToIndex
.
end
())
{
if
(
it
==
reflection
.
nameToIndex
.
end
())
{
reflection
.
nameToIndex
[
name
]
=
(
int
)
reflection
.
indexToUniform
.
size
();
reflection
.
nameToIndex
[
name
.
c_str
()
]
=
(
int
)
reflection
.
indexToUniform
.
size
();
reflection
.
indexToUniform
.
push_back
(
TObjectReflection
(
name
,
*
terminalType
,
offset
,
reflection
.
indexToUniform
.
push_back
(
TObjectReflection
(
name
.
c_str
()
,
*
terminalType
,
offset
,
mapToGlType
(
*
terminalType
),
mapToGlType
(
*
terminalType
),
arraySize
,
blockIndex
));
arraySize
,
blockIndex
));
}
else
if
(
arraySize
>
1
)
{
}
else
if
(
arraySize
>
1
)
{
...
@@ -430,11 +430,11 @@ public:
...
@@ -430,11 +430,11 @@ public:
int
addBlockName
(
const
TString
&
name
,
const
TType
&
type
,
int
size
)
int
addBlockName
(
const
TString
&
name
,
const
TType
&
type
,
int
size
)
{
{
int
blockIndex
;
int
blockIndex
;
TReflection
::
TNameToIndex
::
const_iterator
it
=
reflection
.
nameToIndex
.
find
(
name
);
TReflection
::
TNameToIndex
::
const_iterator
it
=
reflection
.
nameToIndex
.
find
(
name
.
c_str
()
);
if
(
reflection
.
nameToIndex
.
find
(
name
)
==
reflection
.
nameToIndex
.
end
())
{
if
(
reflection
.
nameToIndex
.
find
(
name
.
c_str
()
)
==
reflection
.
nameToIndex
.
end
())
{
blockIndex
=
(
int
)
reflection
.
indexToUniformBlock
.
size
();
blockIndex
=
(
int
)
reflection
.
indexToUniformBlock
.
size
();
reflection
.
nameToIndex
[
name
]
=
blockIndex
;
reflection
.
nameToIndex
[
name
.
c_str
()
]
=
blockIndex
;
reflection
.
indexToUniformBlock
.
push_back
(
TObjectReflection
(
name
,
type
,
-
1
,
-
1
,
size
,
-
1
));
reflection
.
indexToUniformBlock
.
push_back
(
TObjectReflection
(
name
.
c_str
()
,
type
,
-
1
,
-
1
,
size
,
-
1
));
}
else
}
else
blockIndex
=
it
->
second
;
blockIndex
=
it
->
second
;
...
@@ -852,7 +852,7 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate)
...
@@ -852,7 +852,7 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate)
{
{
// search for ones that have counters
// search for ones that have counters
for
(
int
i
=
0
;
i
<
int
(
indexToUniformBlock
.
size
());
++
i
)
{
for
(
int
i
=
0
;
i
<
int
(
indexToUniformBlock
.
size
());
++
i
)
{
const
TString
counterName
(
intermediate
.
addCounterBufferName
(
indexToUniformBlock
[
i
].
name
));
const
TString
counterName
(
intermediate
.
addCounterBufferName
(
indexToUniformBlock
[
i
].
name
)
.
c_str
()
);
const
int
index
=
getIndex
(
counterName
);
const
int
index
=
getIndex
(
counterName
);
if
(
index
>=
0
)
if
(
index
>=
0
)
...
...
glslang/MachineIndependent/reflection.h
View file @
4f50a463
...
@@ -55,7 +55,7 @@ class TReflectionTraverser;
...
@@ -55,7 +55,7 @@ class TReflectionTraverser;
// Data needed for just a single object at the granularity exchanged by the reflection API
// Data needed for just a single object at the granularity exchanged by the reflection API
class
TObjectReflection
{
class
TObjectReflection
{
public
:
public
:
TObjectReflection
(
const
TS
tring
&
pName
,
const
TType
&
pType
,
int
pOffset
,
int
pGLDefineType
,
int
pSize
,
int
pIndex
)
:
TObjectReflection
(
const
std
::
s
tring
&
pName
,
const
TType
&
pType
,
int
pOffset
,
int
pGLDefineType
,
int
pSize
,
int
pIndex
)
:
name
(
pName
),
offset
(
pOffset
),
name
(
pName
),
offset
(
pOffset
),
glDefineType
(
pGLDefineType
),
size
(
pSize
),
index
(
pIndex
),
counterIndex
(
-
1
),
stages
(
EShLanguageMask
(
0
)),
type
(
pType
.
clone
())
{
}
glDefineType
(
pGLDefineType
),
size
(
pSize
),
index
(
pIndex
),
counterIndex
(
-
1
),
stages
(
EShLanguageMask
(
0
)),
type
(
pType
.
clone
())
{
}
...
@@ -78,7 +78,7 @@ public:
...
@@ -78,7 +78,7 @@ public:
}
}
static
TObjectReflection
badReflection
()
{
return
TObjectReflection
();
}
static
TObjectReflection
badReflection
()
{
return
TObjectReflection
();
}
TS
tring
name
;
std
::
s
tring
name
;
int
offset
;
int
offset
;
int
glDefineType
;
int
glDefineType
;
int
size
;
// data size in bytes for a block, array size for a (non-block) object that's an array
int
size
;
// data size in bytes for a block, array size for a (non-block) object that's an array
...
@@ -163,7 +163,7 @@ protected:
...
@@ -163,7 +163,7 @@ protected:
void
buildAttributeReflection
(
EShLanguage
,
const
TIntermediate
&
);
void
buildAttributeReflection
(
EShLanguage
,
const
TIntermediate
&
);
// Need a TString hash: typedef std::unordered_map<TString, int> TNameToIndex;
// Need a TString hash: typedef std::unordered_map<TString, int> TNameToIndex;
typedef
std
::
map
<
TS
tring
,
int
>
TNameToIndex
;
typedef
std
::
map
<
std
::
s
tring
,
int
>
TNameToIndex
;
typedef
std
::
vector
<
TObjectReflection
>
TMapIndexToReflection
;
typedef
std
::
vector
<
TObjectReflection
>
TMapIndexToReflection
;
TObjectReflection
badReflection
;
// return for queries of -1 or generally out of range; has expected descriptions with in it for this
TObjectReflection
badReflection
;
// return for queries of -1 or generally out of range; has expected descriptions with in it for this
...
...
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