Use absl::flat_hash_map instead of std::unordered_map in more places This patch replaces std::unordered_map with absl::flat_hash_map in many more places and removes some unused code. Bug: dawn:1513 Change-Id: I5bcf1f3b099ee19f2b6694946c3b81c8e8877451 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/195634 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
diff --git a/src/dawn/native/d3d/D3DCompilationRequest.h b/src/dawn/native/d3d/D3DCompilationRequest.h index 95c21e6..62dabfd 100644 --- a/src/dawn/native/d3d/D3DCompilationRequest.h +++ b/src/dawn/native/d3d/D3DCompilationRequest.h
@@ -30,9 +30,7 @@ #include <d3dcompiler.h> -#include <string> -#include <unordered_map> -#include <vector> +#include <string_view> #include "dawn/native/CacheRequest.h" #include "dawn/native/Serializable.h" @@ -57,8 +55,6 @@ enum class Compiler { FXC, DXC }; -using AccessControl = std::unordered_map<tint::BindingPoint, tint::core::Access>; - using InterStageShaderVariablesMask = std::bitset<tint::hlsl::writer::kMaxInterStageLocations>; #define HLSL_COMPILATION_REQUEST_MEMBERS(X) \
diff --git a/src/dawn/native/opengl/BindingPoint.h b/src/dawn/native/opengl/BindingPoint.h index 86bf647..6b4a59e 100644 --- a/src/dawn/native/opengl/BindingPoint.h +++ b/src/dawn/native/opengl/BindingPoint.h
@@ -28,9 +28,9 @@ #ifndef SRC_DAWN_NATIVE_OPENGL_BINDPOINT_H_ #define SRC_DAWN_NATIVE_OPENGL_BINDPOINT_H_ -#include <unordered_map> #include <utility> +#include "absl/container/flat_hash_map.h" #include "src/tint/api/common/binding_point.h" namespace dawn::native::opengl { @@ -46,7 +46,7 @@ /// Records the field and the byte offset of the data to push in the internal uniform buffer. using FunctionAndOffset = std::pair<BindPointFunction, uint32_t>; /// Maps from binding point to data entry with the information to populate the data. -using BindingPointToFunctionAndOffset = std::unordered_map<tint::BindingPoint, FunctionAndOffset>; +using BindingPointToFunctionAndOffset = absl::flat_hash_map<tint::BindingPoint, FunctionAndOffset>; } // namespace dawn::native::opengl
diff --git a/src/dawn/native/opengl/ShaderModuleGL.cpp b/src/dawn/native/opengl/ShaderModuleGL.cpp index b5dc23a..34d3539 100644 --- a/src/dawn/native/opengl/ShaderModuleGL.cpp +++ b/src/dawn/native/opengl/ShaderModuleGL.cpp
@@ -28,9 +28,9 @@ #include "dawn/native/opengl/ShaderModuleGL.h" #include <sstream> -#include <unordered_map> #include <utility> +#include "absl/container/flat_hash_map.h" #include "dawn/native/BindGroupLayoutInternal.h" #include "dawn/native/CacheRequest.h" #include "dawn/native/Pipeline.h" @@ -42,7 +42,7 @@ #include "dawn/platform/DawnPlatform.h" #include "dawn/platform/tracing/TraceEvent.h" -#include "tint/tint.h" +#include "src/tint/api/common/binding_point.h" namespace dawn::native { namespace { @@ -69,7 +69,7 @@ DAWN_UNREACHABLE(); } -using BindingMap = std::unordered_map<tint::BindingPoint, tint::BindingPoint>; +using BindingMap = absl::flat_hash_map<tint::BindingPoint, tint::BindingPoint>; opengl::CombinedSampler* AppendCombinedSampler(opengl::CombinedSamplerInfo* info, tint::BindingPoint texture,