summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/translator/Cache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/compiler/translator/Cache.cpp')
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Cache.cpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/3rdparty/angle/src/compiler/translator/Cache.cpp b/src/3rdparty/angle/src/compiler/translator/Cache.cpp
index 57a43700ca..417e82403a 100644
--- a/src/3rdparty/angle/src/compiler/translator/Cache.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Cache.cpp
@@ -12,21 +12,20 @@
#include "common/debug.h"
#include "compiler/translator/Cache.h"
+namespace sh
+{
+
namespace
{
class TScopedAllocator : angle::NonCopyable
{
public:
- TScopedAllocator(TPoolAllocator *allocator)
- : mPreviousAllocator(GetGlobalPoolAllocator())
+ TScopedAllocator(TPoolAllocator *allocator) : mPreviousAllocator(GetGlobalPoolAllocator())
{
SetGlobalPoolAllocator(allocator);
}
- ~TScopedAllocator()
- {
- SetGlobalPoolAllocator(mPreviousAllocator);
- }
+ ~TScopedAllocator() { SetGlobalPoolAllocator(mPreviousAllocator); }
private:
TPoolAllocator *mPreviousAllocator;
@@ -40,28 +39,28 @@ TCache::TypeKey::TypeKey(TBasicType basicType,
unsigned char primarySize,
unsigned char secondarySize)
{
- static_assert(sizeof(components) <= sizeof(value),
- "TypeKey::value is too small");
+ static_assert(sizeof(components) <= sizeof(value), "TypeKey::value is too small");
const size_t MaxEnumValue = std::numeric_limits<EnumComponentType>::max();
- UNUSED_ASSERTION_VARIABLE(MaxEnumValue);
// TODO: change to static_assert() once we deprecate MSVC 2013 support
- ASSERT(MaxEnumValue >= EbtLast &&
- MaxEnumValue >= EbpLast &&
- MaxEnumValue >= EvqLast &&
+ ASSERT(MaxEnumValue >= EbtLast && MaxEnumValue >= EbpLast && MaxEnumValue >= EvqLast &&
"TypeKey::EnumComponentType is too small");
- value = 0;
- components.basicType = static_cast<EnumComponentType>(basicType);
- components.precision = static_cast<EnumComponentType>(precision);
- components.qualifier = static_cast<EnumComponentType>(qualifier);
- components.primarySize = primarySize;
+ value = 0;
+ components.basicType = static_cast<EnumComponentType>(basicType);
+ components.precision = static_cast<EnumComponentType>(precision);
+ components.qualifier = static_cast<EnumComponentType>(qualifier);
+ components.primarySize = primarySize;
components.secondarySize = secondarySize;
}
TCache *TCache::sCache = nullptr;
+TCache::TCache()
+{
+}
+
void TCache::initialize()
{
if (sCache == nullptr)
@@ -81,8 +80,7 @@ const TType *TCache::getType(TBasicType basicType,
unsigned char primarySize,
unsigned char secondarySize)
{
- TypeKey key(basicType, precision, qualifier,
- primarySize, secondarySize);
+ TypeKey key(basicType, precision, qualifier, primarySize, secondarySize);
auto it = sCache->mTypes.find(key);
if (it != sCache->mTypes.end())
{
@@ -91,10 +89,11 @@ const TType *TCache::getType(TBasicType basicType,
TScopedAllocator scopedAllocator(&sCache->mAllocator);
- TType *type = new TType(basicType, precision, qualifier,
- primarySize, secondarySize);
+ TType *type = new TType(basicType, precision, qualifier, primarySize, secondarySize);
type->realize();
sCache->mTypes.insert(std::make_pair(key, type));
return type;
}
+
+} // namespace sh