Pipeline: Add custom debug printers for SamplerFunction.
SamplerFunction can then be passed to RR_LOG and RR_WATCH.
Bug: b/140287657
Change-Id: If37d99469b7df98b539430abdcd184eec81bc08f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33471
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
diff --git a/src/Pipeline/SamplerCore.hpp b/src/Pipeline/SamplerCore.hpp
index 19e99b1..b733710 100644
--- a/src/Pipeline/SamplerCore.hpp
+++ b/src/Pipeline/SamplerCore.hpp
@@ -115,4 +115,22 @@
};
}
+#ifdef ENABLE_RR_PRINT
+namespace rr {
+ template <> struct PrintValue::Ty<sw::SamplerFunction>
+ {
+ static std::string fmt(const sw::SamplerFunction& v)
+ {
+ return std::string("SamplerFunction[") +
+ "method: " + std::to_string(v.method) +
+ ", offset: " + std::to_string(v.offset) +
+ ", sample: " + std::to_string(v.sample) +
+ "]";
+ }
+
+ static std::vector<rr::Value*> val(const sw::SamplerFunction& v) { return {}; }
+ };
+}
+#endif // ENABLE_RR_PRINT
+
#endif // sw_SamplerCore_hpp