[client] tests: add framebuffer rendering validation

Add an optional EGL framebuffer capture path for the test transport.
Capture the fully composed frame before presentation and retain its
surface format and HDR state for validation.

Add GoogleTest integration tests which run the production client
under a headless Weston compositor and compare every output pixel
against an independent reference implementation.

The matrix covers BGRA, RGBA, BGR32, RGB24, PQ RGBA10 and scRGB
RGBA16F with full, moving, overlapping, maximum-count, invalid, null
and zero-area damage rectangles. Validate HDR-to-SDR conversion and
native HDR output metadata when supported by the compositor.

Keep tests opt-in through ENABLE_RENDER_TESTS and document how to run
the software and native HDR tiers.
This commit is contained in:
Geoffrey McRae
2026-07-30 14:53:38 +10:00
parent a1fc3d20d3
commit 74ae4f543e
11 changed files with 1172 additions and 6 deletions

View File

@@ -19,6 +19,7 @@
*/
#pragma once
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
@@ -110,6 +111,28 @@ typedef struct LG_RendererRect
}
LG_RendererRect;
typedef enum LG_RendererCaptureFormat
{
LG_CAPTURE_RGBA8,
LG_CAPTURE_RGB10_A2,
LG_CAPTURE_RGBA32F,
}
LG_RendererCaptureFormat;
typedef struct LG_RendererCapture
{
unsigned int width;
unsigned int height;
size_t stride;
size_t dataSize;
LG_RendererCaptureFormat format;
bool hdr;
bool hdrPQ;
bool nativeHDR;
void * data;
}
LG_RendererCapture;
typedef enum LG_RendererCursor
{
LG_CURSOR_COLOR ,
@@ -229,6 +252,11 @@ typedef struct LG_RendererOps
const bool newFrame, const bool invalidateWindow,
void (*preSwap)(void * udata), void * udata);
/* Optional test/diagnostic readback of the fully composed framebuffer.
* Called on the render thread before swap while the graphics context is
* current. The caller owns capture->data and must free it. */
bool (*capture)(LG_Renderer * renderer, LG_RendererCapture * capture);
/* called to create a texture from the specified 32-bit RGB image data. This
* method is for use with Dear ImGui
* Context: renderThread */