mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Headless: Fix compare of smaller buffers.
When the buffer is smaller, we need to flip properly to compare the correct pixels.
This commit is contained in:
parent
eee62849fe
commit
a45eeb56ed
1 changed files with 13 additions and 9 deletions
|
@ -305,16 +305,14 @@ bool CompareOutput(const Path &bootFilename, const std::string &output, bool ver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int ComparePixel(u32 pix1, u32 pix2)
|
inline int ComparePixel(u32 pix1, u32 pix2) {
|
||||||
{
|
|
||||||
// For now, if they're different at all except alpha, it's an error.
|
// For now, if they're different at all except alpha, it's an error.
|
||||||
if ((pix1 & 0xFFFFFF) != (pix2 & 0xFFFFFF))
|
if ((pix1 & 0xFFFFFF) != (pix2 & 0xFFFFFF))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u32> TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32 stride, u32 h)
|
std::vector<u32> TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32 stride, u32 h) {
|
||||||
{
|
|
||||||
// If the output was small, act like everything outside was 0.
|
// If the output was small, act like everything outside was 0.
|
||||||
// This can happen depending on viewport parameters.
|
// This can happen depending on viewport parameters.
|
||||||
u32 safeW = std::min(stride, buffer->GetStride());
|
u32 safeW = std::min(stride, buffer->GetStride());
|
||||||
|
@ -334,24 +332,30 @@ std::vector<u32> TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32
|
||||||
outStride = -outStride;
|
outStride = -outStride;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip the bottom of the image in the buffer was smaller. Remember, we're flipped.
|
||||||
|
u32 *dst = &data[0];
|
||||||
|
if (safeH < h) {
|
||||||
|
dst += (h - safeH) * stride;
|
||||||
|
}
|
||||||
|
|
||||||
u32 errors = 0;
|
u32 errors = 0;
|
||||||
for (u32 y = 0; y < safeH; ++y) {
|
for (u32 y = 0; y < safeH; ++y) {
|
||||||
switch (buffer->GetFormat()) {
|
switch (buffer->GetFormat()) {
|
||||||
case GPU_DBG_FORMAT_8888:
|
case GPU_DBG_FORMAT_8888:
|
||||||
ConvertBGRA8888ToRGBA8888(&data[y * stride], pixels32, safeW);
|
ConvertBGRA8888ToRGBA8888(&dst[y * stride], pixels32, safeW);
|
||||||
break;
|
break;
|
||||||
case GPU_DBG_FORMAT_8888_BGRA:
|
case GPU_DBG_FORMAT_8888_BGRA:
|
||||||
memcpy(&data[y * stride], pixels32, safeW * sizeof(u32));
|
memcpy(&dst[y * stride], pixels32, safeW * sizeof(u32));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GPU_DBG_FORMAT_565:
|
case GPU_DBG_FORMAT_565:
|
||||||
ConvertRGB565ToBGRA8888(&data[y * stride], pixels16, safeW);
|
ConvertRGB565ToBGRA8888(&dst[y * stride], pixels16, safeW);
|
||||||
break;
|
break;
|
||||||
case GPU_DBG_FORMAT_5551:
|
case GPU_DBG_FORMAT_5551:
|
||||||
ConvertRGBA5551ToBGRA8888(&data[y * stride], pixels16, safeW);
|
ConvertRGBA5551ToBGRA8888(&dst[y * stride], pixels16, safeW);
|
||||||
break;
|
break;
|
||||||
case GPU_DBG_FORMAT_4444:
|
case GPU_DBG_FORMAT_4444:
|
||||||
ConvertRGBA4444ToBGRA8888(&data[y * stride], pixels16, safeW);
|
ConvertRGBA4444ToBGRA8888(&dst[y * stride], pixels16, safeW);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue