Modules/GraphicApplication/tests/RenderTargetRegistryTests.cpp
agent 711793ffd7 GraphicApplication: GPU device, window surfaces, window and platform backends
gpu/ replaces the OpenGL path and is split by lifetime:
- GpuDevice is the instance, device, graphics queue, command pool, one-shot
  uploads and render-target registry, shared by every window.
- WindowSurface is one window's surface, swapchain, render pass,
  depth-stencil and frames in flight. beginFrame() returns a GpuFrame
  (command buffer, frame slot, extent), the narrow view renderers record
  into. Render-finished semaphores are per swapchain image, Vulkan results
  are checked and failures throw GpuError.

backends/contract/ is the only thing a backend and the window share.
PlatformWindow is what a backend implements; it knows no coalescer or GPU
object. PlatformWindowHost is all a backend may call back: rawInput(),
onContentResized(), onSurfaceAvailable() and onSurfaceLost(), so the window
drives the GPU surface. Desktop-only manipulation is the optional
DesktopWindowControls interface. A backend also defines its surface
extensions, its resource directory and createPlatformWindow(), which
receives a typed PlatformContext.

- backends/wayland/ keeps xdg configure handling to itself and acknowledges
  it when the frame loop applies it. The seat is split per device
  (keyboard, pointer, tablet, text input, clipboard); clipboard contents are
  read asynchronously on the event loop. evdev key codes and the touchpad
  pinch converter live here. Resources resolve next to the executable.
- backends/android/ runs on native_app_glue and finishes the activity when
  the application returns or fails.

window/ owns the platform window, its WindowSurface, the coalescer and the
input queue, and exposes roles: WindowEventLoop, WindowInput (state,
injection, raw tap, delivery policies, the one place input is muted),
WindowControls (with desktop() for the optional controls) and
WindowServices. Window's public header names no backend.
2026-10-29 05:24:06 +03:00

39 lines
1.1 KiB
C++

#include "RenderTargetRegistry.hpp"
#include "UnitTest++/UnitTest++.h"
using namespace tp;
SUITE(RenderTargetRegistry) {
TEST(InstancesKeepIndependentTargets) {
RenderTargetRegistry first;
RenderTargetRegistry second;
RenderTargetEntry firstTarget;
firstTarget.width = 640;
firstTarget.height = 480;
RenderTargetEntry secondTarget;
secondTarget.width = 320;
secondTarget.height = 200;
const uint32_t firstId = first.registerTarget(firstTarget);
const uint32_t secondId = second.registerTarget(secondTarget);
CHECK_EQUAL(firstId, secondId);
RenderTargetEntry resolved;
REQUIRE CHECK(first.resolve(firstId, resolved));
CHECK_EQUAL(640, resolved.width);
REQUIRE CHECK(second.resolve(secondId, resolved));
CHECK_EQUAL(320, resolved.width);
firstTarget.width = 800;
first.updateTarget(firstId, firstTarget);
REQUIRE CHECK(first.resolve(firstId, resolved));
CHECK_EQUAL(800, resolved.width);
REQUIRE CHECK(second.resolve(secondId, resolved));
CHECK_EQUAL(320, resolved.width);
first.unregisterTarget(firstId);
CHECK(!first.resolve(firstId, resolved));
CHECK(second.resolve(secondId, resolved));
}
}