mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-01-19 12:22:32 +00:00
Headless: Fix compare for 16-bit output.
Most tests have been 32-bit output, so haven't run into this. Enables tests with softgpu to generate 16-bit output.
This commit is contained in:
parent
6d8b78f523
commit
d573bf9cc9
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user