diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-02-18 03:05:40 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:36:23 +0000 |
| commit | a413ef346e329a415d12985c2f07af08cbe68e8f (patch) | |
| tree | a3a7ab11218cfc32333d5c99198bde8257efc2cb | |
| parent | DrawCommandTest: added structured buffer array, and formatted buffer tests (diff) | |
| download | DiligentCore-a413ef346e329a415d12985c2f07af08cbe68e8f.tar.gz DiligentCore-a413ef346e329a415d12985c2f07af08cbe68e8f.zip | |
Testing swap chain: enabled capturing multiple fail images for the same test
3 files changed, 29 insertions, 17 deletions
diff --git a/Tests/DiligentCoreAPITest/include/TestingSwapChainBase.hpp b/Tests/DiligentCoreAPITest/include/TestingSwapChainBase.hpp index b3c76772..e930aeb9 100644 --- a/Tests/DiligentCoreAPITest/include/TestingSwapChainBase.hpp +++ b/Tests/DiligentCoreAPITest/include/TestingSwapChainBase.hpp @@ -27,6 +27,7 @@ #pragma once #include <vector> +#include <unordered_map> #include "ObjectBase.hpp" #include "RefCntAutoPtr.hpp" @@ -43,13 +44,14 @@ namespace Diligent namespace Testing { -void CompareTestImages(const Uint8* pReferencePixels, - Uint32 RefPixelsStride, - const Uint8* pPixels, - Uint32 PixelsStride, - Uint32 Width, - Uint32 Height, - TEXTURE_FORMAT Format); +void CompareTestImages(const Uint8* pReferencePixels, + Uint32 RefPixelsStride, + const Uint8* pPixels, + Uint32 PixelsStride, + Uint32 Width, + Uint32 Height, + TEXTURE_FORMAT Format, + std::unordered_map<std::string, int>& FailureCounters); // {41BF4655-9B33-4E6C-9300-0CB45FBFE104} static constexpr INTERFACE_ID IID_TestingSwapChain = @@ -182,7 +184,7 @@ public: m_pContext->MapTextureSubresource(m_pStagingTexture, 0, 0, MAP_READ, MapFlag, nullptr, MapData); CompareTestImages(m_ReferenceData.data(), m_ReferenceDataPitch, reinterpret_cast<const Uint8*>(MapData.pData), MapData.Stride, - m_SwapChainDesc.Width, m_SwapChainDesc.Height, m_SwapChainDesc.ColorBufferFormat); + m_SwapChainDesc.Width, m_SwapChainDesc.Height, m_SwapChainDesc.ColorBufferFormat, m_FailureCounters); m_pContext->UnmapTextureSubresource(m_pStagingTexture, 0, 0); } @@ -238,6 +240,8 @@ protected: RefCntAutoPtr<ITextureView> m_pDSV; RefCntAutoPtr<ITexture> m_pStagingTexture; + std::unordered_map<std::string, int> m_FailureCounters; + std::vector<Uint8> m_ReferenceData; Uint32 m_ReferenceDataPitch = 0; }; diff --git a/Tests/DiligentCoreAPITest/src/PipelineResourceSignatureTest.cpp b/Tests/DiligentCoreAPITest/src/PipelineResourceSignatureTest.cpp index 785b4055..6794e41d 100644 --- a/Tests/DiligentCoreAPITest/src/PipelineResourceSignatureTest.cpp +++ b/Tests/DiligentCoreAPITest/src/PipelineResourceSignatureTest.cpp @@ -525,6 +525,8 @@ TEST_F(PipelineResourceSignatureTest, SingleVarType) pContext->Draw(DrawAttrs); pSwapChain->Present(); + std::cout << TestingEnvironment::GetCurrentTestStatusString() << ' ' + << GetShaderVariableTypeLiteralName(VarType) << " vars" << std::endl; } } diff --git a/Tests/DiligentCoreAPITest/src/TestingSwapChainBase.cpp b/Tests/DiligentCoreAPITest/src/TestingSwapChainBase.cpp index 7372dfed..16b43b55 100644 --- a/Tests/DiligentCoreAPITest/src/TestingSwapChainBase.cpp +++ b/Tests/DiligentCoreAPITest/src/TestingSwapChainBase.cpp @@ -41,13 +41,14 @@ namespace Diligent namespace Testing { -void CompareTestImages(const Uint8* pReferencePixels, - Uint32 RefPixelsStride, - const Uint8* pPixels, - Uint32 PixelsStride, - Uint32 Width, - Uint32 Height, - TEXTURE_FORMAT Format) +void CompareTestImages(const Uint8* pReferencePixels, + Uint32 RefPixelsStride, + const Uint8* pPixels, + Uint32 PixelsStride, + Uint32 Width, + Uint32 Height, + TEXTURE_FORMAT Format, + std::unordered_map<std::string, int>& FailureCounters) { VERIFY_EXPR(pReferencePixels != nullptr); VERIFY_EXPR(pPixels != nullptr); @@ -108,15 +109,20 @@ void CompareTestImages(const Uint8* pReferencePixels, return dst; }; - std::string FileName = ValidateName(TestInfo->test_suite_name()); + std::string FileName{ValidateName(TestInfo->test_suite_name())}; + auto& FailureCounter = FailureCounters[FileName]; FileName += '.'; FileName += ValidateName(TestInfo->name()); - FileName += "_FAIL_.png"; + FileName += "_FAIL"; + if (FailureCounter > 0) + FileName += std::to_string(FailureCounter); + FileName += "_.png"; if (stbi_write_png(FileName.c_str(), Width * 2, Height * 2, 3, ReportImage.data(), (Width * 2) * 3) == 0) { LOG_ERROR_MESSAGE("Failed to write ", FileName); } ADD_FAILURE() << "Image rendered by the test is not identical to the reference image"; + ++FailureCounter; } } |
