mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-16 11:03:45 +01:00
Merge pull request #16256 from unknownbrackets/headless
headless: Update tests and fix crash running tests on Vulkan
This commit is contained in:
4 files changed
+22
-11
No files matched your search
@@ -399,6 +399,7 @@ double ScreenshotComparer::Compare(const Path &screenshotFilename) {
|
||||
|
||||
if (header[0] == 'B' && header[1] == 'M') {
|
||||
reference_ = (u32 *)calloc(stride_ * h_, sizeof(u32));
|
||||
referenceStride_ = stride_;
|
||||
asBitmap_ = true;
|
||||
// The bitmap header is 14 + 40 bytes. We could validate it but the test would fail either way.
|
||||
if (reference_ && loader->ReadAt(14 + 40, sizeof(u32), stride_ * h_, reference_) != stride_ * h_) {
|
||||
@@ -424,6 +425,8 @@ double ScreenshotComparer::Compare(const Path &screenshotFilename) {
|
||||
reference_ = nullptr;
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
referenceStride_ = width;
|
||||
}
|
||||
} else {
|
||||
error_ = "Unable to read screenshot: " + screenshotFilename.ToVisualString();
|
||||
@@ -439,15 +442,15 @@ double ScreenshotComparer::Compare(const Path &screenshotFilename) {
|
||||
if (asBitmap_) {
|
||||
// The reference is flipped and BGRA by default for the common BMP compare case.
|
||||
for (u32 y = 0; y < h_; ++y) {
|
||||
u32 yoff = y * stride_;
|
||||
u32 yoff = y * referenceStride_;
|
||||
for (u32 x = 0; x < w_; ++x)
|
||||
errors += ComparePixel(pixels_[y * stride_ + x], reference_[yoff + x]);
|
||||
}
|
||||
} else {
|
||||
// Just convert to BGRA for simplicity.
|
||||
ConvertRGBA8888ToBGRA8888(reference_, reference_, h_ * stride_);
|
||||
ConvertRGBA8888ToBGRA8888(reference_, reference_, h_ * referenceStride_);
|
||||
for (u32 y = 0; y < h_; ++y) {
|
||||
u32 yoff = (h_ - y - 1) * stride_;
|
||||
u32 yoff = (h_ - y - 1) * referenceStride_;
|
||||
for (u32 x = 0; x < w_; ++x)
|
||||
errors += ComparePixel(pixels_[y * stride_ + x], reference_[yoff + x]);
|
||||
}
|
||||
@@ -486,7 +489,7 @@ bool ScreenshotComparer::SaveVisualComparisonPNG(const Path &resultFilename) {
|
||||
if (asBitmap_) {
|
||||
// The reference is flipped and BGRA by default for the common BMP compare case.
|
||||
for (u32 y = 0; y < h_; ++y) {
|
||||
u32 yoff = y * stride_;
|
||||
u32 yoff = y * referenceStride_;
|
||||
u32 comparisonRow = (h_ - y - 1) * 2 * w_ * 2;
|
||||
for (u32 x = 0; x < w_; ++x) {
|
||||
PlotVisualComparison(comparison.get(), comparisonRow + x * 2, pixels_[y * stride_ + x], reference_[yoff + x]);
|
||||
@@ -495,7 +498,7 @@ bool ScreenshotComparer::SaveVisualComparisonPNG(const Path &resultFilename) {
|
||||
} else {
|
||||
// Reference is already in BGRA either way.
|
||||
for (u32 y = 0; y < h_; ++y) {
|
||||
u32 yoff = (h_ - y - 1) * stride_;
|
||||
u32 yoff = (h_ - y - 1) * referenceStride_;
|
||||
u32 comparisonRow = (h_ - y - 1) * 2 * w_ * 2;
|
||||
for (u32 x = 0; x < w_; ++x) {
|
||||
PlotVisualComparison(comparison.get(), comparisonRow + x * 2, pixels_[y * stride_ + x], reference_[yoff + x]);
|
||||
|
||||
@@ -58,6 +58,7 @@ protected:
|
||||
u32 *reference_ = nullptr;
|
||||
bool asBitmap_ = false;
|
||||
std::string error_;
|
||||
u32 referenceStride_ = 0;
|
||||
u32 stride_;
|
||||
u32 w_;
|
||||
u32 h_;
|
||||
|
||||
+11
-4
@@ -203,8 +203,9 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, const
|
||||
Core_UpdateDebugStats(g_Config.bShowDebugStats || g_Config.bLogFrameDrops);
|
||||
|
||||
PSP_BeginHostFrame();
|
||||
if (coreParameter.graphicsContext && coreParameter.graphicsContext->GetDrawContext())
|
||||
coreParameter.graphicsContext->GetDrawContext()->BeginFrame();
|
||||
Draw::DrawContext *draw = coreParameter.graphicsContext ? coreParameter.graphicsContext->GetDrawContext() : nullptr;
|
||||
if (draw)
|
||||
draw->BeginFrame();
|
||||
|
||||
bool passed = true;
|
||||
double deadline = time_now_d() + opt.timeout;
|
||||
@@ -238,8 +239,14 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, const
|
||||
}
|
||||
PSP_EndHostFrame();
|
||||
|
||||
if (coreParameter.graphicsContext && coreParameter.graphicsContext->GetDrawContext())
|
||||
coreParameter.graphicsContext->GetDrawContext()->EndFrame();
|
||||
if (draw) {
|
||||
draw->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::CLEAR, Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE }, "Headless");
|
||||
// Vulkan may get angry if we don't do a final present.
|
||||
if (gpu)
|
||||
gpu->CopyDisplayToOutput(true);
|
||||
|
||||
draw->EndFrame();
|
||||
}
|
||||
|
||||
PSP_Shutdown();
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ tests_good = [
|
||||
"gpu/primitives/indices",
|
||||
"gpu/primitives/invalidprim",
|
||||
"gpu/primitives/points",
|
||||
"gpu/primitives/rectangles",
|
||||
"gpu/primitives/trianglefan",
|
||||
"gpu/primitives/trianglestrip",
|
||||
"gpu/primitives/triangles",
|
||||
@@ -186,6 +187,7 @@ tests_good = [
|
||||
"gpu/textures/mipmap",
|
||||
"gpu/textures/rotate",
|
||||
"gpu/vertices/colors",
|
||||
"gpu/vertices/texcoords",
|
||||
"hash/hash",
|
||||
"hle/check_not_used_uids",
|
||||
"intr/intr",
|
||||
@@ -412,7 +414,6 @@ tests_next = [
|
||||
"gpu/primitives/immediate",
|
||||
"gpu/primitives/lines",
|
||||
"gpu/primitives/linestrip",
|
||||
"gpu/primitives/rectangles",
|
||||
"gpu/primitives/spline",
|
||||
"gpu/reflection/reflection",
|
||||
"gpu/rendertarget/rendertarget",
|
||||
@@ -426,7 +427,6 @@ tests_next = [
|
||||
"gpu/texmtx/uvs",
|
||||
"gpu/textures/size",
|
||||
"gpu/triangle/triangle",
|
||||
"gpu/vertices/texcoords",
|
||||
"intr/registersub",
|
||||
"intr/releasesub",
|
||||
"intr/waits",
|
||||
|
||||
Reference in new issue
Block a user