Commit c859c0ac by Tim Van Patten Committed by Commit Bot

Batch replace std::unordered_map with angle::HashMap in src/

There are a few places that will remain std::unordered_map due to build or run-time errors, which will need to be evaluated more closely to determine if they should remain std::unordered_map or if there is another Abseil data structure that would be more efficient while still working correctly. Bug: angleproject:4873 Change-Id: Ib04253e3ad6398e63f4cc2bfe12c0f9e57cb112b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2558873 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCharlie Lao <cclao@google.com>
parent b22b1502
...@@ -130,7 +130,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) ...@@ -130,7 +130,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
key.output = output; key.output = output;
using UniqueTCompiler = std::unique_ptr<TCompiler, TCompilerDeleter>; using UniqueTCompiler = std::unique_ptr<TCompiler, TCompilerDeleter>;
static angle::base::NoDestructor<std::unordered_map<TranslatorCacheKey, UniqueTCompiler>> static angle::base::NoDestructor<angle::HashMap<TranslatorCacheKey, UniqueTCompiler>>
translators; translators;
if (translators->find(key) == translators->end()) if (translators->find(key) == translators->end())
......
...@@ -24,7 +24,7 @@ class CollectVariableRefCountsTraverser : public TIntermTraverser ...@@ -24,7 +24,7 @@ class CollectVariableRefCountsTraverser : public TIntermTraverser
public: public:
CollectVariableRefCountsTraverser(); CollectVariableRefCountsTraverser();
using RefCountMap = std::unordered_map<int, unsigned int>; using RefCountMap = angle::HashMap<int, unsigned int>;
RefCountMap &getSymbolIdRefCounts() { return mSymbolIdRefCounts; } RefCountMap &getSymbolIdRefCounts() { return mSymbolIdRefCounts; }
RefCountMap &getStructIdRefCounts() { return mStructIdRefCounts; } RefCountMap &getStructIdRefCounts() { return mStructIdRefCounts; }
......
...@@ -191,7 +191,7 @@ struct InstantiationHash ...@@ -191,7 +191,7 @@ struct InstantiationHash
typedef std::map<ImmutableString, std::unordered_map<Instantiation, TFunction *, InstantiationHash>> typedef std::map<ImmutableString, std::unordered_map<Instantiation, TFunction *, InstantiationHash>>
FunctionInstantiations; FunctionInstantiations;
typedef std::unordered_map<const TFunction *, const TFunction *> FunctionMap; typedef angle::HashMap<const TFunction *, const TFunction *> FunctionMap;
// Generates a new function from the given function using the given // Generates a new function from the given function using the given
// instantiation; generatedInstantiations can be null. // instantiation; generatedInstantiations can be null.
...@@ -299,9 +299,9 @@ struct VariableExtraData ...@@ -299,9 +299,9 @@ struct VariableExtraData
{ {
// The value consists of strides, starting from the outermost array. // The value consists of strides, starting from the outermost array.
// For example, with sampler2D foo[3][6], we would have {1, 6, 18}. // For example, with sampler2D foo[3][6], we would have {1, 6, 18}.
std::unordered_map<const TVariable *, std::vector<size_t>> arrayStrideMap; angle::HashMap<const TVariable *, std::vector<size_t>> arrayStrideMap;
// For each generated array parameter, holds the offset parameter. // For each generated array parameter, holds the offset parameter.
std::unordered_map<const TVariable *, const TVariable *> paramOffsetMap; angle::HashMap<const TVariable *, const TVariable *> paramOffsetMap;
}; };
class Traverser final : public TIntermTraverser, public ArrayTraverser class Traverser final : public TIntermTraverser, public ArrayTraverser
...@@ -489,10 +489,7 @@ class Traverser final : public TIntermTraverser, public ArrayTraverser ...@@ -489,10 +489,7 @@ class Traverser final : public TIntermTraverser, public ArrayTraverser
FunctionInstantiations *getFunctionInstantiations() { return &mFunctionInstantiations; } FunctionInstantiations *getFunctionInstantiations() { return &mFunctionInstantiations; }
std::unordered_map<const TFunction *, const TFunction *> *getFunctionMap() angle::HashMap<const TFunction *, const TFunction *> *getFunctionMap() { return &mFunctionMap; }
{
return &mFunctionMap;
}
private: private:
// This returns the name of a struct sampler reference. References are always TIntermBinary. // This returns the name of a struct sampler reference. References are always TIntermBinary.
...@@ -1024,13 +1021,13 @@ class Traverser final : public TIntermTraverser, public ArrayTraverser ...@@ -1024,13 +1021,13 @@ class Traverser final : public TIntermTraverser, public ArrayTraverser
class MonomorphizeTraverser final : public TIntermTraverser class MonomorphizeTraverser final : public TIntermTraverser
{ {
public: public:
typedef std::unordered_map<const TVariable *, const TVariable *> VariableReplacementMap; typedef angle::HashMap<const TVariable *, const TVariable *> VariableReplacementMap;
explicit MonomorphizeTraverser( explicit MonomorphizeTraverser(
TCompiler *compiler, TCompiler *compiler,
TSymbolTable *symbolTable, TSymbolTable *symbolTable,
FunctionInstantiations *functionInstantiations, FunctionInstantiations *functionInstantiations,
std::unordered_map<const TFunction *, const TFunction *> *functionMap) angle::HashMap<const TFunction *, const TFunction *> *functionMap)
: TIntermTraverser(true, false, true, symbolTable), : TIntermTraverser(true, false, true, symbolTable),
mFunctionInstantiations(*functionInstantiations), mFunctionInstantiations(*functionInstantiations),
mFunctionMap(functionMap), mFunctionMap(functionMap),
...@@ -1131,7 +1128,7 @@ class MonomorphizeTraverser final : public TIntermTraverser ...@@ -1131,7 +1128,7 @@ class MonomorphizeTraverser final : public TIntermTraverser
FunctionInstantiations mGeneratedInstantiations; FunctionInstantiations mGeneratedInstantiations;
// New instantiations caused by other instantiations. // New instantiations caused by other instantiations.
FunctionInstantiations mPendingInstantiations; FunctionInstantiations mPendingInstantiations;
std::unordered_map<const TFunction *, const TFunction *> *mFunctionMap; angle::HashMap<const TFunction *, const TFunction *> *mFunctionMap;
TIntermSequence mReplacementPrototypes; TIntermSequence mReplacementPrototypes;
TCompiler *mCompiler; TCompiler *mCompiler;
bool mSubpassesSucceeded; bool mSubpassesSucceeded;
...@@ -1166,7 +1163,7 @@ class MonomorphizeTraverser final : public TIntermTraverser ...@@ -1166,7 +1163,7 @@ class MonomorphizeTraverser final : public TIntermTraverser
TSymbolTable *symbolTable, TSymbolTable *symbolTable,
FunctionInstantiations *pendingInstantiations, FunctionInstantiations *pendingInstantiations,
FunctionInstantiations *generatedInstantiations, FunctionInstantiations *generatedInstantiations,
std::unordered_map<const TFunction *, const TFunction *> *functionMap) angle::HashMap<const TFunction *, const TFunction *> *functionMap)
: TIntermTraverser(true, false, false, symbolTable), : TIntermTraverser(true, false, false, symbolTable),
mPendingInstantiations(pendingInstantiations), mPendingInstantiations(pendingInstantiations),
mGeneratedInstantiations(generatedInstantiations), mGeneratedInstantiations(generatedInstantiations),
...@@ -1198,7 +1195,7 @@ class MonomorphizeTraverser final : public TIntermTraverser ...@@ -1198,7 +1195,7 @@ class MonomorphizeTraverser final : public TIntermTraverser
private: private:
FunctionInstantiations *mPendingInstantiations; FunctionInstantiations *mPendingInstantiations;
FunctionInstantiations *mGeneratedInstantiations; FunctionInstantiations *mGeneratedInstantiations;
std::unordered_map<const TFunction *, const TFunction *> *mFunctionMap; angle::HashMap<const TFunction *, const TFunction *> *mFunctionMap;
}; };
}; };
} // anonymous namespace } // anonymous namespace
......
...@@ -124,18 +124,18 @@ class RetypeOpaqueVariablesHelper ...@@ -124,18 +124,18 @@ class RetypeOpaqueVariablesHelper
private: private:
// A map from the old global variable to the new one. // A map from the old global variable to the new one.
std::unordered_map<const TVariable *, TVariable *> mReplacedGlobalVariables; angle::HashMap<const TVariable *, TVariable *> mReplacedGlobalVariables;
// A map from functions with old type parameters to one where that's replaced with the new type. // A map from functions with old type parameters to one where that's replaced with the new type.
std::unordered_map<const TFunction *, TFunction *> mReplacedFunctions; angle::HashMap<const TFunction *, TFunction *> mReplacedFunctions;
// A map from function old type parameters to their replacement new type parameter for the // A map from function old type parameters to their replacement new type parameter for the
// current function definition. // current function definition.
std::unordered_map<const TVariable *, TVariable *> mReplacedFunctionParams; angle::HashMap<const TVariable *, TVariable *> mReplacedFunctionParams;
// A map from function call old type arguments to their replacement for the current function // A map from function call old type arguments to their replacement for the current function
// call. // call.
std::stack<std::unordered_map<const TIntermNode *, TIntermTyped *>> mReplacedFunctionCallArgs; std::stack<angle::HashMap<const TIntermNode *, TIntermTyped *>> mReplacedFunctionCallArgs;
}; };
} // namespace sh } // namespace sh
......
...@@ -549,7 +549,7 @@ angle::Result GLES1Renderer::linkProgram(Context *context, ...@@ -549,7 +549,7 @@ angle::Result GLES1Renderer::linkProgram(Context *context,
State *glState, State *glState,
ShaderProgramID vertexShader, ShaderProgramID vertexShader,
ShaderProgramID fragmentShader, ShaderProgramID fragmentShader,
const std::unordered_map<GLint, std::string> &attribLocs, const angle::HashMap<GLint, std::string> &attribLocs,
ShaderProgramID *programOut) ShaderProgramID *programOut)
{ {
ShaderProgramID program = mShaderPrograms->createProgram(context->getImplementation()); ShaderProgramID program = mShaderPrograms->createProgram(context->getImplementation());
...@@ -615,7 +615,7 @@ angle::Result GLES1Renderer::initializeRendererProgram(Context *context, State * ...@@ -615,7 +615,7 @@ angle::Result GLES1Renderer::initializeRendererProgram(Context *context, State *
ANGLE_TRY(compileShader(context, ShaderType::Fragment, fragmentStream.str().c_str(), ANGLE_TRY(compileShader(context, ShaderType::Fragment, fragmentStream.str().c_str(),
&fragmentShader)); &fragmentShader));
std::unordered_map<GLint, std::string> attribLocs; angle::HashMap<GLint, std::string> attribLocs;
attribLocs[(GLint)kVertexAttribIndex] = "pos"; attribLocs[(GLint)kVertexAttribIndex] = "pos";
attribLocs[(GLint)kNormalAttribIndex] = "normal"; attribLocs[(GLint)kNormalAttribIndex] = "normal";
......
...@@ -66,7 +66,7 @@ class GLES1Renderer final : angle::NonCopyable ...@@ -66,7 +66,7 @@ class GLES1Renderer final : angle::NonCopyable
State *glState, State *glState,
ShaderProgramID vshader, ShaderProgramID vshader,
ShaderProgramID fshader, ShaderProgramID fshader,
const std::unordered_map<GLint, std::string> &attribLocs, const angle::HashMap<GLint, std::string> &attribLocs,
ShaderProgramID *programOut); ShaderProgramID *programOut);
angle::Result initializeRendererProgram(Context *context, State *glState); angle::Result initializeRendererProgram(Context *context, State *glState);
......
...@@ -192,12 +192,12 @@ class ProgramAliasedBindings final : angle::NonCopyable ...@@ -192,12 +192,12 @@ class ProgramAliasedBindings final : angle::NonCopyable
int getBindingByLocation(GLuint location) const; int getBindingByLocation(GLuint location) const;
int getBinding(const sh::ShaderVariable &variable) const; int getBinding(const sh::ShaderVariable &variable) const;
using const_iterator = std::unordered_map<std::string, ProgramBinding>::const_iterator; using const_iterator = angle::HashMap<std::string, ProgramBinding>::const_iterator;
const_iterator begin() const; const_iterator begin() const;
const_iterator end() const; const_iterator end() const;
private: private:
std::unordered_map<std::string, ProgramBinding> mBindings; angle::HashMap<std::string, ProgramBinding> mBindings;
}; };
class ProgramState final : angle::NonCopyable class ProgramState final : angle::NonCopyable
......
...@@ -399,9 +399,9 @@ bool ProgramExecutable::linkValidateGlobalNames( ...@@ -399,9 +399,9 @@ bool ProgramExecutable::linkValidateGlobalNames(
InfoLog &infoLog, InfoLog &infoLog,
const ShaderMap<const ProgramState *> &programStates) const const ShaderMap<const ProgramState *> &programStates) const
{ {
std::unordered_map<std::string, const sh::ShaderVariable *> uniformMap; angle::HashMap<std::string, const sh::ShaderVariable *> uniformMap;
using BlockAndFieldPair = std::pair<const sh::InterfaceBlock *, const sh::ShaderVariable *>; using BlockAndFieldPair = std::pair<const sh::InterfaceBlock *, const sh::ShaderVariable *>;
std::unordered_map<std::string, std::vector<BlockAndFieldPair>> uniformBlockFieldMap; angle::HashMap<std::string, std::vector<BlockAndFieldPair>> uniformBlockFieldMap;
for (ShaderType shaderType : kAllGraphicsShaderTypes) for (ShaderType shaderType : kAllGraphicsShaderTypes)
{ {
......
...@@ -47,7 +47,7 @@ class ResourceMap final : angle::NonCopyable ...@@ -47,7 +47,7 @@ class ResourceMap final : angle::NonCopyable
void clear(); void clear();
using IndexAndResource = std::pair<GLuint, ResourceType *>; using IndexAndResource = std::pair<GLuint, ResourceType *>;
using HashMap = std::unordered_map<GLuint, ResourceType *>; using HashMap = angle::HashMap<GLuint, ResourceType *>;
class Iterator final class Iterator final
{ {
...@@ -297,8 +297,8 @@ bool ResourceMap<ResourceType, IDType>::Iterator::operator!=(const Iterator &oth ...@@ -297,8 +297,8 @@ bool ResourceMap<ResourceType, IDType>::Iterator::operator!=(const Iterator &oth
} }
template <typename ResourceType, typename IDType> template <typename ResourceType, typename IDType>
typename ResourceMap<ResourceType, IDType>::Iterator &ResourceMap<ResourceType, IDType>::Iterator:: typename ResourceMap<ResourceType, IDType>::Iterator &
operator++() ResourceMap<ResourceType, IDType>::Iterator::operator++()
{ {
if (mFlatIndex < static_cast<GLuint>(mOrigin.mFlatResourcesSize)) if (mFlatIndex < static_cast<GLuint>(mOrigin.mFlatResourcesSize))
{ {
...@@ -313,15 +313,15 @@ operator++() ...@@ -313,15 +313,15 @@ operator++()
} }
template <typename ResourceType, typename IDType> template <typename ResourceType, typename IDType>
const typename ResourceMap<ResourceType, IDType>::IndexAndResource const typename ResourceMap<ResourceType, IDType>::IndexAndResource *
*ResourceMap<ResourceType, IDType>::Iterator::operator->() const ResourceMap<ResourceType, IDType>::Iterator::operator->() const
{ {
return &mValue; return &mValue;
} }
template <typename ResourceType, typename IDType> template <typename ResourceType, typename IDType>
const typename ResourceMap<ResourceType, IDType>::IndexAndResource const typename ResourceMap<ResourceType, IDType>::IndexAndResource &
&ResourceMap<ResourceType, IDType>::Iterator::operator*() const ResourceMap<ResourceType, IDType>::Iterator::operator*() const
{ {
return mValue; return mValue;
} }
......
...@@ -95,7 +95,7 @@ class ShaderCache : angle::NonCopyable ...@@ -95,7 +95,7 @@ class ShaderCache : angle::NonCopyable
return mDevice->CreatePixelShader(function, shader); return mDevice->CreatePixelShader(function, shader);
} }
typedef std::unordered_map<std::string, ShaderObject *> Map; typedef angle::HashMap<std::string, ShaderObject *> Map;
Map mMap; Map mMap;
std::mutex mMutex; std::mutex mMutex;
......
...@@ -166,7 +166,7 @@ class RendererGL : angle::NonCopyable ...@@ -166,7 +166,7 @@ class RendererGL : angle::NonCopyable
mutable MultiviewImplementationTypeGL mMultiviewImplementationType; mutable MultiviewImplementationTypeGL mMultiviewImplementationType;
// The thread-to-context mapping for the currently active worker threads. // The thread-to-context mapping for the currently active worker threads.
std::unordered_map<std::thread::id, std::unique_ptr<WorkerContext>> mCurrentWorkerContexts; angle::HashMap<std::thread::id, std::unique_ptr<WorkerContext>> mCurrentWorkerContexts;
// The worker contexts available to use. // The worker contexts available to use.
std::list<std::unique_ptr<WorkerContext>> mWorkerContextPool; std::list<std::unique_ptr<WorkerContext>> mWorkerContextPool;
// Protect the concurrent accesses to worker contexts. // Protect the concurrent accesses to worker contexts.
......
...@@ -133,7 +133,7 @@ class DisplayEGL : public DisplayGL ...@@ -133,7 +133,7 @@ class DisplayEGL : public DisplayGL
EGLSurface surface = EGL_NO_SURFACE; EGLSurface surface = EGL_NO_SURFACE;
EGLContext context = EGL_NO_CONTEXT; EGLContext context = EGL_NO_CONTEXT;
}; };
std::unordered_map<std::thread::id, CurrentNativeContext> mCurrentNativeContexts; angle::HashMap<std::thread::id, CurrentNativeContext> mCurrentNativeContexts;
private: private:
void generateCaps(egl::Caps *outCaps) const override; void generateCaps(egl::Caps *outCaps) const override;
......
...@@ -125,7 +125,7 @@ class DisplayGLX : public DisplayGL ...@@ -125,7 +125,7 @@ class DisplayGLX : public DisplayGL
XVisualInfo *mVisuals; XVisualInfo *mVisuals;
glx::Context mContext; glx::Context mContext;
glx::Context mSharedContext; glx::Context mSharedContext;
std::unordered_map<std::thread::id, glx::Context> mCurrentContexts; angle::HashMap<std::thread::id, glx::Context> mCurrentContexts;
// A pbuffer the context is current on during ANGLE initialization // A pbuffer the context is current on during ANGLE initialization
glx::Pbuffer mInitPbuffer; glx::Pbuffer mInitPbuffer;
......
...@@ -118,7 +118,7 @@ class DisplayWGL : public DisplayGL ...@@ -118,7 +118,7 @@ class DisplayWGL : public DisplayGL
HDC dc = nullptr; HDC dc = nullptr;
HGLRC glrc = nullptr; HGLRC glrc = nullptr;
}; };
std::unordered_map<std::thread::id, CurrentNativeContext> mCurrentData; angle::HashMap<std::thread::id, CurrentNativeContext> mCurrentData;
HMODULE mOpenGLModule; HMODULE mOpenGLModule;
......
...@@ -98,7 +98,7 @@ struct ShaderInterfaceVariableInfo ...@@ -98,7 +98,7 @@ struct ShaderInterfaceVariableInfo
// TODO: http://anglebug.com/4524: Need a different hash key than a string, since // TODO: http://anglebug.com/4524: Need a different hash key than a string, since
// that's slow to calculate. // that's slow to calculate.
using ShaderInterfaceVariableInfoMap = std::unordered_map<std::string, ShaderInterfaceVariableInfo>; using ShaderInterfaceVariableInfoMap = angle::HashMap<std::string, ShaderInterfaceVariableInfo>;
using ShaderMapInterfaceVariableInfoMap = gl::ShaderMap<ShaderInterfaceVariableInfoMap>; using ShaderMapInterfaceVariableInfoMap = gl::ShaderMap<ShaderInterfaceVariableInfoMap>;
void GlslangInitialize(); void GlslangInitialize();
......
...@@ -162,7 +162,7 @@ class FormatTable final : angle::NonCopyable ...@@ -162,7 +162,7 @@ class FormatTable final : angle::NonCopyable
void setCompressedFormatCaps(MTLPixelFormat formatId, bool filterable); void setCompressedFormatCaps(MTLPixelFormat formatId, bool filterable);
std::array<Format, angle::kNumANGLEFormats> mPixelFormatTable; std::array<Format, angle::kNumANGLEFormats> mPixelFormatTable;
std::unordered_map<MTLPixelFormat, FormatCaps> mNativePixelFormatCapsTable; angle::HashMap<MTLPixelFormat, FormatCaps> mNativePixelFormatCapsTable;
// One for tightly packed buffers, one for general cases. // One for tightly packed buffers, one for general cases.
std::array<VertexFormat, angle::kNumANGLEFormats> mVertexFormatTables[2]; std::array<VertexFormat, angle::kNumANGLEFormats> mVertexFormatTables[2];
......
...@@ -31,7 +31,7 @@ constexpr uint32_t kGlslangShaderResourceDescSet = 3; ...@@ -31,7 +31,7 @@ constexpr uint32_t kGlslangShaderResourceDescSet = 3;
// Original mapping of front end from sampler name to multiple sampler slots (in form of // Original mapping of front end from sampler name to multiple sampler slots (in form of
// slot:count pair) // slot:count pair)
using OriginalSamplerBindingMap = using OriginalSamplerBindingMap =
std::unordered_map<std::string, std::vector<std::pair<uint32_t, uint32_t>>>; angle::HashMap<std::string, std::vector<std::pair<uint32_t, uint32_t>>>;
angle::Result HandleError(ErrorHandler *context, GlslangError) angle::Result HandleError(ErrorHandler *context, GlslangError)
{ {
...@@ -79,8 +79,8 @@ spv::ExecutionModel ShaderTypeToSpvExecutionModel(gl::ShaderType shaderType) ...@@ -79,8 +79,8 @@ spv::ExecutionModel ShaderTypeToSpvExecutionModel(gl::ShaderType shaderType)
void BindBuffers(spirv_cross::CompilerMSL *compiler, void BindBuffers(spirv_cross::CompilerMSL *compiler,
const spirv_cross::SmallVector<spirv_cross::Resource> &resources, const spirv_cross::SmallVector<spirv_cross::Resource> &resources,
gl::ShaderType shaderType, gl::ShaderType shaderType,
const std::unordered_map<std::string, uint32_t> &uboOriginalBindings, const angle::HashMap<std::string, uint32_t> &uboOriginalBindings,
const std::unordered_map<uint32_t, uint32_t> &xfbOriginalBindings, const angle::HashMap<uint32_t, uint32_t> &xfbOriginalBindings,
std::array<uint32_t, kMaxGLUBOBindings> *uboBindingsRemapOut, std::array<uint32_t, kMaxGLUBOBindings> *uboBindingsRemapOut,
std::array<uint32_t, kMaxShaderXFBs> *xfbBindingRemapOut, std::array<uint32_t, kMaxShaderXFBs> *xfbBindingRemapOut,
bool *uboArgumentBufferUsed) bool *uboArgumentBufferUsed)
...@@ -275,8 +275,8 @@ class SpirvToMslCompiler : public spirv_cross::CompilerMSL ...@@ -275,8 +275,8 @@ class SpirvToMslCompiler : public spirv_cross::CompilerMSL
SpirvToMslCompiler(std::vector<uint32_t> &&spriv) : spirv_cross::CompilerMSL(spriv) {} SpirvToMslCompiler(std::vector<uint32_t> &&spriv) : spirv_cross::CompilerMSL(spriv) {}
void compileEx(gl::ShaderType shaderType, void compileEx(gl::ShaderType shaderType,
const std::unordered_map<std::string, uint32_t> &uboOriginalBindings, const angle::HashMap<std::string, uint32_t> &uboOriginalBindings,
const std::unordered_map<uint32_t, uint32_t> &xfbOriginalBindings, const angle::HashMap<uint32_t, uint32_t> &xfbOriginalBindings,
const OriginalSamplerBindingMap &originalSamplerBindings, const OriginalSamplerBindingMap &originalSamplerBindings,
TranslatedShaderInfo *mslShaderInfoOut) TranslatedShaderInfo *mslShaderInfoOut)
{ {
...@@ -350,14 +350,13 @@ class SpirvToMslCompiler : public spirv_cross::CompilerMSL ...@@ -350,14 +350,13 @@ class SpirvToMslCompiler : public spirv_cross::CompilerMSL
} }
}; };
angle::Result ConvertSpirvToMsl( angle::Result ConvertSpirvToMsl(Context *context,
Context *context, gl::ShaderType shaderType,
gl::ShaderType shaderType, const angle::HashMap<std::string, uint32_t> &uboOriginalBindings,
const std::unordered_map<std::string, uint32_t> &uboOriginalBindings, const angle::HashMap<uint32_t, uint32_t> &xfbOriginalBindings,
const std::unordered_map<uint32_t, uint32_t> &xfbOriginalBindings, const OriginalSamplerBindingMap &originalSamplerBindings,
const OriginalSamplerBindingMap &originalSamplerBindings, std::vector<uint32_t> *sprivCode,
std::vector<uint32_t> *sprivCode, TranslatedShaderInfo *translatedShaderInfoOut)
TranslatedShaderInfo *translatedShaderInfoOut)
{ {
if (!sprivCode || sprivCode->empty()) if (!sprivCode || sprivCode->empty())
{ {
...@@ -479,7 +478,7 @@ angle::Result SpirvCodeToMsl(Context *context, ...@@ -479,7 +478,7 @@ angle::Result SpirvCodeToMsl(Context *context,
TranslatedShaderInfo *mslXfbOnlyShaderInfoOut /** nullable */) TranslatedShaderInfo *mslXfbOnlyShaderInfoOut /** nullable */)
{ {
// Retrieve original uniform buffer bindings generated by front end. We will need to do a remap. // Retrieve original uniform buffer bindings generated by front end. We will need to do a remap.
std::unordered_map<std::string, uint32_t> uboOriginalBindings; angle::HashMap<std::string, uint32_t> uboOriginalBindings;
const std::vector<gl::InterfaceBlock> &blocks = programState.getUniformBlocks(); const std::vector<gl::InterfaceBlock> &blocks = programState.getUniformBlocks();
for (uint32_t bufferIdx = 0; bufferIdx < blocks.size(); ++bufferIdx) for (uint32_t bufferIdx = 0; bufferIdx < blocks.size(); ++bufferIdx)
{ {
...@@ -490,7 +489,7 @@ angle::Result SpirvCodeToMsl(Context *context, ...@@ -490,7 +489,7 @@ angle::Result SpirvCodeToMsl(Context *context,
} }
} }
// Retrieve original XFB buffers bindings produced by front end. // Retrieve original XFB buffers bindings produced by front end.
std::unordered_map<uint32_t, uint32_t> xfbOriginalBindings; angle::HashMap<uint32_t, uint32_t> xfbOriginalBindings;
for (uint32_t bufferIdx = 0; bufferIdx < kMaxShaderXFBs; ++bufferIdx) for (uint32_t bufferIdx = 0; bufferIdx < kMaxShaderXFBs; ++bufferIdx)
{ {
std::string bufferName = rx::GetXfbBufferName(bufferIdx); std::string bufferName = rx::GetXfbBufferName(bufferIdx);
......
...@@ -475,7 +475,7 @@ class RenderPipelineCache final : angle::NonCopyable ...@@ -475,7 +475,7 @@ class RenderPipelineCache final : angle::NonCopyable
bool hasDefaultAttribs(const RenderPipelineDesc &desc) const; bool hasDefaultAttribs(const RenderPipelineDesc &desc) const;
// One table with default attrib and one table without. // One table with default attrib and one table without.
std::unordered_map<RenderPipelineDesc, AutoObjCPtr<id<MTLRenderPipelineState>>> angle::HashMap<RenderPipelineDesc, AutoObjCPtr<id<MTLRenderPipelineState>>>
mRenderPipelineStates[2]; mRenderPipelineStates[2];
RenderPipelineCacheSpecializeShaderFactory *mSpecializedShaderFactory; RenderPipelineCacheSpecializeShaderFactory *mSpecializedShaderFactory;
...@@ -503,8 +503,8 @@ class StateCache final : angle::NonCopyable ...@@ -503,8 +503,8 @@ class StateCache final : angle::NonCopyable
private: private:
AutoObjCPtr<id<MTLDepthStencilState>> mNullDepthStencilState = nil; AutoObjCPtr<id<MTLDepthStencilState>> mNullDepthStencilState = nil;
std::unordered_map<DepthStencilDesc, AutoObjCPtr<id<MTLDepthStencilState>>> mDepthStencilStates; angle::HashMap<DepthStencilDesc, AutoObjCPtr<id<MTLDepthStencilState>>> mDepthStencilStates;
std::unordered_map<SamplerDesc, AutoObjCPtr<id<MTLSamplerState>>> mSamplerStates; angle::HashMap<SamplerDesc, AutoObjCPtr<id<MTLSamplerState>>> mSamplerStates;
}; };
} // namespace mtl } // namespace mtl
......
...@@ -1184,7 +1184,7 @@ angle::Result ProgramExecutableVk::updateImagesDescriptorSet( ...@@ -1184,7 +1184,7 @@ angle::Result ProgramExecutableVk::updateImagesDescriptorSet(
const gl::ActiveTextureArray<TextureVk *> &activeImages = contextVk->getActiveImages(); const gl::ActiveTextureArray<TextureVk *> &activeImages = contextVk->getActiveImages();
bool useOldRewriteStructSamplers = contextVk->useOldRewriteStructSamplers(); bool useOldRewriteStructSamplers = contextVk->useOldRewriteStructSamplers();
std::unordered_map<std::string, uint32_t> mappedImageNameToArrayOffset; angle::HashMap<std::string, uint32_t> mappedImageNameToArrayOffset;
// Write images. // Write images.
for (uint32_t imageIndex = 0; imageIndex < imageBindings.size(); ++imageIndex) for (uint32_t imageIndex = 0; imageIndex < imageBindings.size(); ++imageIndex)
...@@ -1440,7 +1440,7 @@ angle::Result ProgramExecutableVk::updateTexturesDescriptorSet(ContextVk *contex ...@@ -1440,7 +1440,7 @@ angle::Result ProgramExecutableVk::updateTexturesDescriptorSet(ContextVk *contex
for (const gl::ShaderType shaderType : executable->getLinkedShaderStages()) for (const gl::ShaderType shaderType : executable->getLinkedShaderStages())
{ {
std::unordered_map<std::string, uint32_t> mappedSamplerNameToArrayOffset; angle::HashMap<std::string, uint32_t> mappedSamplerNameToArrayOffset;
const gl::ProgramState *programState = programStates[shaderType]; const gl::ProgramState *programState = programStates[shaderType];
ASSERT(programState); ASSERT(programState);
for (uint32_t textureIndex = 0; textureIndex < programState->getSamplerBindings().size(); for (uint32_t textureIndex = 0; textureIndex < programState->getSamplerBindings().size();
......
...@@ -1338,8 +1338,8 @@ class RenderPassCache final : angle::NonCopyable ...@@ -1338,8 +1338,8 @@ class RenderPassCache final : angle::NonCopyable
// Use a two-layer caching scheme. The top level matches the "compatible" RenderPass elements. // Use a two-layer caching scheme. The top level matches the "compatible" RenderPass elements.
// The second layer caches the attachment load/store ops and initial/final layout. // The second layer caches the attachment load/store ops and initial/final layout.
using InnerCache = std::unordered_map<vk::AttachmentOpsArray, vk::RenderPassHelper>; using InnerCache = angle::HashMap<vk::AttachmentOpsArray, vk::RenderPassHelper>;
using OuterCache = std::unordered_map<vk::RenderPassDesc, InnerCache>; using OuterCache = angle::HashMap<vk::RenderPassDesc, InnerCache>;
OuterCache mPayload; OuterCache mPayload;
}; };
......
...@@ -742,7 +742,7 @@ std::string GetConfigNameFromTestIdentifier(const TestIdentifier &id) ...@@ -742,7 +742,7 @@ std::string GetConfigNameFromTestIdentifier(const TestIdentifier &id)
TestQueue BatchTests(const std::vector<TestIdentifier> &tests, int batchSize) TestQueue BatchTests(const std::vector<TestIdentifier> &tests, int batchSize)
{ {
// First sort tests by configuration. // First sort tests by configuration.
std::unordered_map<std::string, std::vector<TestIdentifier>> testsSortedByConfig; angle::HashMap<std::string, std::vector<TestIdentifier>> testsSortedByConfig;
for (const TestIdentifier &id : tests) for (const TestIdentifier &id : tests)
{ {
std::string config = GetConfigNameFromTestIdentifier(id); std::string config = GetConfigNameFromTestIdentifier(id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment