Merge pull request #11614 from unknownbrackets/headless

Headless: Allow startup using NULL draw context
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2018-12-01 12:47:52 +01:00
commit 571ea0eec5
3 files changed
+32 -16

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ bool GPU_IsReady() {
}
bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw) {
_assert_(draw);
_assert_(draw || PSP_CoreParameter().gpuCore == GPUCORE_NULL);
#if PPSSPP_PLATFORM(UWP)
SetGPU(new GPU_D3D11(ctx, draw));
return true;
+30 -14
View File
@@ -301,28 +301,44 @@ std::vector<u32> TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32
std::vector<u32> data;
data.resize(stride * h, 0);
const u32 *pixels = (const u32 *)buffer->GetData();
const u32 *pixels32 = (const u32 *)buffer->GetData();
const u16 *pixels16 = (const u16 *)buffer->GetData();
int outStride = buffer->GetStride();
if (!buffer->GetFlipped())
{
if (!buffer->GetFlipped()) {
// Bitmaps are flipped, so we have to compare backwards in this case.
pixels += outStride * (buffer->GetHeight() - 1);
int toLastRow = outStride * (buffer->GetHeight() - 1);
pixels32 += toLastRow;
pixels16 += toLastRow;
outStride = -outStride;
}
u32 errors = 0;
for (u32 y = 0; y < safeH; ++y)
{
if (buffer->GetFormat() == GPU_DBG_FORMAT_8888)
ConvertBGRA8888ToRGBA8888(&data[y * stride], pixels, safeW);
else if (buffer->GetFormat() == GPU_DBG_FORMAT_8888_BGRA)
memcpy(&data[y * stride], pixels, safeW * sizeof(u32));
else
{
for (u32 y = 0; y < safeH; ++y) {
switch (buffer->GetFormat()) {
case GPU_DBG_FORMAT_8888:
ConvertBGRA8888ToRGBA8888(&data[y * stride], pixels32, safeW);
break;
case GPU_DBG_FORMAT_8888_BGRA:
memcpy(&data[y * stride], pixels32, safeW * sizeof(u32));
break;
case GPU_DBG_FORMAT_565:
ConvertRGB565ToBGRA8888(&data[y * stride], pixels16, safeW);
break;
case GPU_DBG_FORMAT_5551:
ConvertRGBA5551ToBGRA8888(&data[y * stride], pixels16, safeW);
break;
case GPU_DBG_FORMAT_4444:
ConvertRGBA4444ToBGRA8888(&data[y * stride], pixels16, safeW);
break;
default:
data.resize(0);
return data;
}
pixels += outStride;
pixels32 += outStride;
pixels16 += outStride;
}
return data;
@@ -365,4 +381,4 @@ double CompareScreenshot(const std::vector<u32> &pixels, u32 stride, u32 w, u32
free(reference);
return (double) errors / (double) (w * h);
}
}
+1 -1
View File
@@ -55,7 +55,7 @@ void HeadlessHost::SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h)
std::string error;
double errors = CompareScreenshot(pixels, FRAME_STRIDE, FRAME_WIDTH, FRAME_HEIGHT, comparisonScreenshot_, error);
if (errors < 0)
SendOrCollectDebugOutput(error);
SendOrCollectDebugOutput(error + "\n");
if (errors > 0)
{