Switched to std::string for TReflection and TObjectReflection
In MSVC 2017 Debug mode when a reflection is deleted (when a shader goes out of scope) xutility will fail to clear the children due to the TString allocator implementation. By switching to std::string xutility no longer throws the error.
This commit is contained in:
parent
c9e03360e2
commit
91af94019a
2 changed files with 14 additions and 14 deletions
|
|
@ -105,10 +105,10 @@ public:
|
|||
const TString &name = base.getName();
|
||||
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()) {
|
||||
reflection.nameToIndex[name] = (int)reflection.indexToAttribute.size();
|
||||
reflection.indexToAttribute.push_back(TObjectReflection(name, type, 0, mapToGlType(type), 0, 0));
|
||||
reflection.nameToIndex[name.c_str()] = (int)reflection.indexToAttribute.size();
|
||||
reflection.indexToAttribute.push_back(TObjectReflection(name.c_str(), type, 0, mapToGlType(type), 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -327,10 +327,10 @@ public:
|
|||
if (arraySize == 0)
|
||||
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()) {
|
||||
reflection.nameToIndex[name] = (int)reflection.indexToUniform.size();
|
||||
reflection.indexToUniform.push_back(TObjectReflection(name, *terminalType, offset,
|
||||
reflection.nameToIndex[name.c_str()] = (int)reflection.indexToUniform.size();
|
||||
reflection.indexToUniform.push_back(TObjectReflection(name.c_str(), *terminalType, offset,
|
||||
mapToGlType(*terminalType),
|
||||
arraySize, blockIndex));
|
||||
} else if (arraySize > 1) {
|
||||
|
|
@ -430,11 +430,11 @@ public:
|
|||
int addBlockName(const TString& name, const TType& type, int size)
|
||||
{
|
||||
int blockIndex;
|
||||
TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name);
|
||||
if (reflection.nameToIndex.find(name) == reflection.nameToIndex.end()) {
|
||||
TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name.c_str());
|
||||
if (reflection.nameToIndex.find(name.c_str()) == reflection.nameToIndex.end()) {
|
||||
blockIndex = (int)reflection.indexToUniformBlock.size();
|
||||
reflection.nameToIndex[name] = blockIndex;
|
||||
reflection.indexToUniformBlock.push_back(TObjectReflection(name, type, -1, -1, size, -1));
|
||||
reflection.nameToIndex[name.c_str()] = blockIndex;
|
||||
reflection.indexToUniformBlock.push_back(TObjectReflection(name.c_str(), type, -1, -1, size, -1));
|
||||
} else
|
||||
blockIndex = it->second;
|
||||
|
||||
|
|
@ -852,7 +852,7 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate)
|
|||
{
|
||||
// search for ones that have counters
|
||||
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);
|
||||
|
||||
if (index >= 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue