Add PrintValue specialization for Vector4i Also change the VSCode settings to assume debug flags are enabled. Change-Id: I3656567c8441a3f7232fe104a9284a85070d8a4e Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/71468 Presubmit-Ready: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index a0faf9e..32bda13 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json
@@ -5,6 +5,7 @@ "defines": [ "ENABLE_VK_DEBUGGER=1", "ENABLE_RR_DEBUG_INFO=1", + "ENABLE_RR_PRINT=1", "VERIFY_LLVM_IR=1" ], "includePath": [ @@ -28,6 +29,7 @@ "defines": [ "ENABLE_VK_DEBUGGER=1", "ENABLE_RR_DEBUG_INFO=1", + "ENABLE_RR_PRINT=1", "VERIFY_LLVM_IR=1" ], "includePath": [ @@ -51,6 +53,7 @@ "defines": [ "ENABLE_VK_DEBUGGER=1", "ENABLE_RR_DEBUG_INFO=1", + "ENABLE_RR_PRINT=1", "VERIFY_LLVM_IR=1" ], "includePath": [ @@ -70,4 +73,4 @@ } ], "version": 4 -} \ No newline at end of file +}
diff --git a/src/Pipeline/ShaderCore.hpp b/src/Pipeline/ShaderCore.hpp index 894291a..2449573 100644 --- a/src/Pipeline/ShaderCore.hpp +++ b/src/Pipeline/ShaderCore.hpp
@@ -318,6 +318,22 @@ return PrintValue::vals(v.x, v.y, v.z, v.w); } }; +template<> +struct PrintValue::Ty<sw::Vector4i> +{ + static std::string fmt(const sw::Vector4i &v) + { + return "[x: " + PrintValue::fmt(v.x) + + ", y: " + PrintValue::fmt(v.y) + + ", z: " + PrintValue::fmt(v.z) + + ", w: " + PrintValue::fmt(v.w) + "]"; + } + + static std::vector<rr::Value *> val(const sw::Vector4i &v) + { + return PrintValue::vals(v.x, v.y, v.z, v.w); + } +}; } // namespace rr #endif // ENABLE_RR_PRINT
diff --git a/src/Pipeline/SpirvShaderDebug.hpp b/src/Pipeline/SpirvShaderDebug.hpp index 66a7ca3..7dc4c58 100644 --- a/src/Pipeline/SpirvShaderDebug.hpp +++ b/src/Pipeline/SpirvShaderDebug.hpp
@@ -17,7 +17,7 @@ #include "SpirvShader.hpp" -// Enable this to print verbose debug messages as each SPIR-V instructon is +// Enable this to print verbose debug messages as each SPIR-V instruction is // executed. Very handy for performing text diffs when the thread count is // reduced to 1 and execution is deterministic. #define SPIRV_SHADER_ENABLE_DBG 0