diff options
author | Jaebaek Seo <duke.acacia@gmail.com> | 2019-01-29 21:38:20 -0500 |
---|---|---|
committer | dan sinclair <dj2@everburning.com> | 2019-01-29 21:38:20 -0500 |
commit | 37bf9a3c627973fd9cc82899695a3c80580c6d21 (patch) | |
tree | a70af5fa1bafc6f3b1a5acd6a5c28dd88f4e80f3 /src/verifier.cc | |
parent | 026fb9d53760c3a0fabb49adda7a6eb450658df6 (diff) | |
download | amber-37bf9a3c627973fd9cc82899695a3c80580c6d21.tar.gz |
Fix wrong RGBA report from Verifier (#251)
Fix wrong RGBA report from Verifier
Diffstat (limited to 'src/verifier.cc')
-rw-r--r-- | src/verifier.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/verifier.cc b/src/verifier.cc index 87a3c9e..2137f2e 100644 --- a/src/verifier.cc +++ b/src/verifier.cc @@ -480,6 +480,31 @@ bool IsTexelEqualToExpected(const std::vector<double>& texel, return true; } +std::vector<double> GetTexelInRGBA(const std::vector<double>& texel, + const Format* framebuffer_format) { + std::vector<double> texel_in_rgba(texel.size()); + for (size_t i = 0; i < framebuffer_format->GetComponents().size(); ++i) { + const auto& component = framebuffer_format->GetComponents()[i]; + switch (component.type) { + case FormatComponentType::kR: + texel_in_rgba[0] = texel[i]; + break; + case FormatComponentType::kG: + texel_in_rgba[1] = texel[i]; + break; + case FormatComponentType::kB: + texel_in_rgba[2] = texel[i]; + break; + case FormatComponentType::kA: + texel_in_rgba[3] = texel[i]; + break; + default: + continue; + } + } + return texel_in_rgba; +} + } // namespace Verifier::Verifier() = default; @@ -565,7 +590,8 @@ Result Verifier::Probe(const ProbeCommand* command, if (!IsTexelEqualToExpected(actual_texel_values, framebuffer_format, command, tolerance, is_tolerance_percent)) { if (!count_of_invalid_pixels) { - actual_texel_values_on_failure = actual_texel_values; + actual_texel_values_on_failure = + GetTexelInRGBA(actual_texel_values, framebuffer_format); first_invalid_i = i; first_invalid_j = j; } |