Move SamplerTexturePair from inspector to sem.
The plan is to reuse this datatype for the combine-samplers transform.
Bug: tint:1366
Change-Id: Icd2f4bd45b662f32fe9803e3485f1a54a2c42265
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/76320
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
diff --git a/src/BUILD.gn b/src/BUILD.gn
index f517b74..c36f031 100644
--- a/src/BUILD.gn
+++ b/src/BUILD.gn
@@ -357,7 +357,6 @@
"inspector/inspector.h",
"inspector/resource_binding.cc",
"inspector/resource_binding.h",
- "inspector/sampler_texture_pair.h",
"inspector/scalar.cc",
"inspector/scalar.h",
"intrinsic_table.cc",
@@ -406,6 +405,7 @@
"sem/pointer_type.h",
"sem/reference_type.h",
"sem/sampled_texture_type.h",
+ "sem/sampler_texture_pair.h",
"sem/sampler_type.h",
"sem/storage_texture_type.h",
"sem/switch_statement.h",
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9399b6b..be42ae5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -224,7 +224,6 @@
inspector/inspector.h
inspector/resource_binding.cc
inspector/resource_binding.h
- inspector/sampler_texture_pair.h
inspector/scalar.cc
inspector/scalar.h
intrinsic_table.cc
@@ -277,6 +276,7 @@
sem/pipeline_stage_set.h
sem/node.cc
sem/node.h
+ sem/sampler_texture_pair.h
sem/statement.cc
sem/struct.cc
sem/type_mappings.h
diff --git a/src/inspector/inspector.cc b/src/inspector/inspector.cc
index a9f2f65..33c8449 100644
--- a/src/inspector/inspector.cc
+++ b/src/inspector/inspector.cc
@@ -524,7 +524,7 @@
ResourceBinding::ResourceType::kExternalTexture);
}
-std::vector<SamplerTexturePair> Inspector::GetSamplerTextureUses(
+std::vector<sem::SamplerTexturePair> Inspector::GetSamplerTextureUses(
const std::string& entry_point) {
auto* func = FindEntryPointByName(entry_point);
if (!func) {
@@ -774,7 +774,7 @@
}
sampler_targets_ = std::make_unique<std::unordered_map<
- std::string, utils::UniqueVector<SamplerTexturePair>>>();
+ std::string, utils::UniqueVector<sem::SamplerTexturePair>>>();
auto& sem = program_->Sem();
diff --git a/src/inspector/inspector.h b/src/inspector/inspector.h
index c84233b..e8f573f 100644
--- a/src/inspector/inspector.h
+++ b/src/inspector/inspector.h
@@ -24,9 +24,9 @@
#include "src/inspector/entry_point.h"
#include "src/inspector/resource_binding.h"
-#include "src/inspector/sampler_texture_pair.h"
#include "src/inspector/scalar.h"
#include "src/program.h"
+#include "src/sem/sampler_texture_pair.h"
#include "src/utils/unique_vector.h"
namespace tint {
@@ -129,7 +129,7 @@
/// @param entry_point name of the entry point to get information about.
/// @returns vector of all of the sampler/texture sampling pairs that are used
/// by that entry point.
- std::vector<SamplerTexturePair> GetSamplerTextureUses(
+ std::vector<sem::SamplerTexturePair> GetSamplerTextureUses(
const std::string& entry_point);
/// @param entry_point name of the entry point to get information about.
@@ -141,7 +141,8 @@
const Program* program_;
diag::List diagnostics_;
std::unique_ptr<
- std::unordered_map<std::string, utils::UniqueVector<SamplerTexturePair>>>
+ std::unordered_map<std::string,
+ utils::UniqueVector<sem::SamplerTexturePair>>>
sampler_targets_;
/// @param name name of the entry point to find
diff --git a/src/inspector/sampler_texture_pair.h b/src/sem/sampler_texture_pair.h
similarity index 80%
rename from src/inspector/sampler_texture_pair.h
rename to src/sem/sampler_texture_pair.h
index 2af9fbe..9f0135b 100644
--- a/src/inspector/sampler_texture_pair.h
+++ b/src/sem/sampler_texture_pair.h
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef SRC_INSPECTOR_SAMPLER_TEXTURE_PAIR_H_
-#define SRC_INSPECTOR_SAMPLER_TEXTURE_PAIR_H_
+#ifndef SRC_SEM_SAMPLER_TEXTURE_PAIR_H_
+#define SRC_SEM_SAMPLER_TEXTURE_PAIR_H_
#include <cstdint>
#include <functional>
@@ -21,14 +21,14 @@
#include "src/sem/binding_point.h"
namespace tint {
-namespace inspector {
+namespace sem {
/// Mapping of a sampler to a texture it samples.
struct SamplerTexturePair {
/// group & binding values for a sampler.
- sem::BindingPoint sampler_binding_point;
+ BindingPoint sampler_binding_point;
/// group & binding values for a texture samepled by the sampler.
- sem::BindingPoint texture_binding_point;
+ BindingPoint texture_binding_point;
/// Equality operator
/// @param rhs the SamplerTexturePair to compare against
@@ -46,21 +46,21 @@
}
};
-} // namespace inspector
+} // namespace sem
} // namespace tint
namespace std {
-/// Custom std::hash specialization for tint::inspector::SamplerTexturePair so
+/// Custom std::hash specialization for tint::sem::SamplerTexturePair so
/// SamplerTexturePairs be used as keys for std::unordered_map and
/// std::unordered_set.
template <>
-class hash<tint::inspector::SamplerTexturePair> {
+class hash<tint::sem::SamplerTexturePair> {
public:
/// @param stp the texture pair to create a hash for
/// @return the hash value
inline std::size_t operator()(
- const tint::inspector::SamplerTexturePair& stp) const {
+ const tint::sem::SamplerTexturePair& stp) const {
return tint::utils::Hash(stp.sampler_binding_point,
stp.texture_binding_point);
}
@@ -68,4 +68,4 @@
} // namespace std
-#endif // SRC_INSPECTOR_SAMPLER_TEXTURE_PAIR_H_
+#endif // SRC_SEM_SAMPLER_TEXTURE_PAIR_H_