CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/headless/Compare.h
Views: 1401
// Copyright (c) 2012- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#include <string>18#include <vector>1920#include "Common/CommonTypes.h"21#include "Common/File/Path.h"2223struct GPUDebugBuffer;2425extern bool teamCityMode;26extern std::string currentTestName;27void TeamCityPrint(const char *fmt, ...);28void GitHubActionsPrint(const char *type, const char *fmt, ...);2930Path ExpectedFromFilename(const Path &bootFilename);31Path ExpectedScreenshotFromFilename(const Path &bootFilename);32std::string GetTestName(const Path &bootFilename);3334bool CompareOutput(const Path &bootFilename, const std::string &output, bool verbose);35std::vector<u32> TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32 stride, u32 h);3637class ScreenshotComparer {38public:39ScreenshotComparer(const std::vector<u32> &pixels, u32 stride, u32 w, u32 h)40: pixels_(pixels), stride_(stride), w_(w), h_(h) {41}42~ScreenshotComparer();4344double Compare(const Path &screenshotFilename);4546std::string GetError() {47return error_;48}4950bool SaveActualBitmap(const Path &filename);51bool SaveVisualComparisonPNG(const Path &filename);5253protected:54void PlotVisualComparison(u32 *dst, u32 offset, u32 actual, u32 reference);5556const std::vector<u32> &pixels_;57u32 *reference_ = nullptr;58bool asBitmap_ = false;59std::string error_;60u32 referenceStride_ = 0;61u32 stride_;62u32 w_;63u32 h_;64};656667